Link to home
Create AccountLog in
Avatar of GurcanK
GurcanK

asked on

How to check whether insert was successful in a PL/SQL procedure?

Dear Experts,

I would like to run TRUNCATE TABLE statement in below code IF ONLY previous insert was successful. How can I implement this? It would be great if you offer me a piece of complemantary code.

BR


DECLARE
.......
BEGIN
.......
INSERT INTO MAIN_TABLE SELECT * FROM TEMP_TABLE;
COMMIT;
EXECUTE IMMEDIATE 'TRUNCATE TABLE TEMP_TABLE DROP STORAGE';
END;
ASKER CERTIFIED SOLUTION
Avatar of Sean Stuber
Sean Stuber

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer