How To Assign Data of the Deleted Row to Variables
How To Assign Data of the Deleted Row to Variables? - Oracle DBA FAQ - Working with Database Objects in PL/SQL
If a DELETE statement is deleting a single row, you can assign column values of the deleted row to variables by using the RETURNING clause, which an extension of DELETE statements for PL/SQL. The tutorial script shows you how to do this:
CREATE TABLE emp_temp AS SELECT * FROM employees; DECLARE fname VARCHAR2(10); lname VARCHAR2(10); BEGIN DELETE FROM emp_temp WHERE employee_id = 100; RETURNING first_name, last_name INTO fname, lname; DBMS_OUTPUT.PUT_LINE('Name deleted = ' || fname || ' ' || lname); -- This will not work because multiple rows deleted -- DELETE FROM emp_temp WHERE employee_id > 100; -- RETURNING first_name, last_name INTO fname, lname; END; / Name deleted = Steven King
Similar to SELECT ... INTO, RETURNING ... INTO will not work if multiple rows are deleted.
2007-04-27, 4654👍, 0💬
Which are the various programming approaches for WCF?
Have you ever worked with Microsoft Application Blocks, if yes then which? Application Blocks are C#...
Write an equivalent expression for x%8? x&7
What is the benefit of using an enum rather than a #define constant? The use of an enumeration const...
.NET INTERVIEW QUESTIONS - What is Suspend and Resume in Threading ? It is Similar to Sleep and Inte...