I’m creating a SQL command in Oracle to update the value of “LOADDATE” to equal the value of “UPDATEDATE” on my table. What I have here works:
BEGIN
UPDATE LOAD_SETTINGS
SET
LOADDATE = (
SELECT UPDATEDATE
FROM LOAD_SETTINGS
WHERE
MODEL = 'A001'
AND OBJECT = 'A'
)
WHERE
MODEL = 'A001'
AND OBJECT = 'A';
COMMIT;
END;
The one thing I know for sure about Oracle is that there is a lot that I do not know. Is there a better way to do this using any features of Oracle that I may not be familiar with? Perhaps without having to use a subquery? Or is this the the way to go?
Thanks!
Since the where clause on the subquery is the same where on the outer there’s no need for the subselect just reference the column directly