Skip to content
Advertisement

How to write an SQL statement that runs only if condition is fulfilled?

I want to write a procedure that copies records from SYS.AUD$ to AUDIT_USER.AUDIT_HISTORY_TABLE and then TRUNCATE SYS.AUD$. I want Truncate to be executed ONLY if copy / insert went well.

So something like this:

So I just want to TRUNCATE TABLE SYS.AUD$ only if records were INSERTED into the other table.

Advertisement

Answer

you can try to do it that way. i didn’t test this solution, but it should give you an idea how you could do it

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement