GurcanK
asked on
PL/SQL Conditional Execution
Dear Experts,
I want to write a PL/SQL procedure such that: If a result of an Update statement is successful, then I'll delete a record from other table.
How can I implement this?
Best Regards
I want to write a PL/SQL procedure such that: If a result of an Update statement is successful, then I'll delete a record from other table.
How can I implement this?
Best Regards
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Based on the other questions, I will say it again.
Get rid of the delete completely. You are worrying about something you don't need to.
In the case of a failure, truncate the temporary table and then repopulate it. It is a temporary table being used for the updates. No need to try to work around it. Truncate and recreate removes the delete statement and the scan of deleted rows in the event of a restart (the blocks still need to be read as it will be a full table scan).
Get rid of the delete completely. You are worrying about something you don't need to.
In the case of a failure, truncate the temporary table and then repopulate it. It is a temporary table being used for the updates. No need to try to work around it. Truncate and recreate removes the delete statement and the scan of deleted rows in the event of a restart (the blocks still need to be read as it will be a full table scan).
Seems I missed something...
ASKER
loop <condition>
update table ta where ......;
delete table tx where ....
end loop
can it be like:
loop <condition>
update table ta where ......;
ıf no exception then delete table tx where ....
end loop