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;
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
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.