Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions