Question: Whats wrong with my trigger in sql? create or replace trigger increment_id before insert on customer for each row Begin select max(id)+1 into :new.id from

Whats wrong with my trigger in sql?

create or replace trigger increment_id before insert on customer for each row Begin select max(id)+1 into :new.id from customer; EXCEPTION insert values (1) into ID from customer; End ;

the code without the exception works but i think there is a big mistake with my exception handling

what i want is that if there is no ID in the table, then just put it as number 1 automatic

i know my mistake is probably so bad but im just starting to learn sql im sorry

thank u everyone

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!