There is one staging table (temp_trans_stable) from the table i need to transfer the date column to transaction main table. I’ve writtenthe pl/sql anonymous block. but it shows some error. help me out
DECLARE
temp_date temp_trans_stable.date%TYPE;
BEGIN
FOR temp_rec IN (SELECT trans_number, date FROM temp_trans_stable) LOOP
BEGIN
UPDATE certificate
SET date = temp_rec.date
WHERE trans_number = temp_rec.trans_number;
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE('Transaction number ' || temp_rec.trans_number || ' not found in transaction table.');
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Error updating Transaction number ' || temp_rec.trans_number || ': ' || SQLERRM);
END;
END LOOP;
COMMIT;
DBMS_OUTPUT.PUT_LINE('Date updated successfully.');
END;
/
Error report –
ORA-06550: line 5, column 9:
PLS-00103: Encountered the symbol “BEGIN” when expecting one of the following:
100p
The symbol “loop” was substituted for “BEGIN” to continue.
06550. 00000 – “line &s, column ts: nts”
*Cause:
Usually a PL/SQL compilation error.
*Action:
Kalai Vanan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.