I have a table say EMPLOYER
with EMPLOYER_ID
as the primary key. I write the following script to update a row in the table:
declare
emp_row EMPLOYER%ROWTYPE;
begin
select * into emp_row from EMPLOYER where rownum <= 1;
emp_row.NAME := 'ABC';
emp_row.AGE := 99;
-- Can I write something like below?
update EMPLOYER set ??? = emp_row where EMPLOYER_ID = emp_row.EMPLOYER_ID;
end;
Can I update a row with a record type object in a single statement? Just as shown in the example above.
Please try something like this
update EMPLOYER set ROW = emp_row where EMPLOYER_ID = emp_row.EMPLOYER_ID;
Remember: this UPDATE sets the value of every column in the table, including your primary key, so you should use the SET ROW syntax with great care.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With