I wish to delete the contents of a table, populate it with the contents from a very lengthy query, and also add another column of data.
My query and the table use identical field names, but the table has an additional column called LAST_UPDATED. This column needs to be updated with SYSDATE for each row.
My code thus far looks like this:
BEGIN
delete from TABLE;
insert into TABLE
SELECT * from
(Here there is about a thousand lines of code, nested selects, joins, etc);
commit;
END;
So when I run it right now, I get an error that there are not enough values. How do I explicitly set the value of the LAST_UPDATED column to SYSDATE?
(I have tested the query as a script in TOAD on its own (without the delete and insert) and it returns the desired values to the Script Output (minus the LAST_UPDATED column)).