Click here to Skip to main content
15,888,454 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
What's wrong with my sql?I want to write a trigger to insert the increment id before insert the row.It show that the trigger state is invalid.

SQL
create or replace trigger MYDB.tri_t_form_382
before insert on MYDB.t_form_382 referencing new as new_value 
for each row  
begin 
    if :new_value.id is null or  :new_value.id=0 then
        select MYDB.seq_t_form_382.nextval into :new_value.id from dual; 
    end if;
end tri_t_form_382;


And it shows:

Navicat:

[Err] ORA-24344: success with compilation error
DB SOLO 5:

09:34:04> end if

[Err] ORA-00900: invalid SQL statement
How to fix it?

What I have tried:

I have try to delete the end if string,but it is still wrong.
Posted
Updated 15-Jun-16 19:54pm
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900