In a Stored Procedue that i created , using cursors i am processing some records and before each record is processed i make an entry into the log table.
Starttime col col col Endtime Status
insert into log ( current_timestamp(0), val, val ,val ,NULL , 'Begin' );
Once the processing is done i have to update the log table status from 'Begin' to 'END' based on the most recent record ie ( startime )
what would be the update syntax for it?
Since you are already using a cursor, just keep the start time as a local variable.
DECLARE theStart TIMESTAMP(0); … -- For each iteration SET theStart = CURRENT_TIMESTAMP(0); INSERT INTO LOG (:theStart, val1, val2, val3, NULL, 'Begin'); -- Do more processing UPDATE LOG SET Endtime=CURRENT_TIMESTAMP(0) , Status='END' WHERE Starttime=:theStart;