# ADD_COD_STEP

## Informazioni

- **Tabella**: TB_TIPI_MAT
- **Evento**: INSERT
- **Tipo**: BEFORE EACH ROW
- **Stato**: ENABLED

## Codice Sorgente

```sql
TRIGGER "APOLLINARECATERINGPROD"."ADD_COD_STEP" 
BEFORE INSERT ON TB_TIPI_MAT 

FOR EACH ROW 
BEGIN
  <<COLUMN_SEQUENCES>>
  BEGIN
    IF INSERTING AND :NEW.cod_step IS NULL THEN
        select max(cod_step)+1
        into :NEW.cod_step
        from tb_tipi_mat
        where cod_step not in (9999999, -1, 0);
    END IF;
  END COLUMN_SEQUENCES;
END;



```
