When updating date/time fields in a file using embedded SQL in an RPGLE program I can use either CURRENT_DATE
/CURRENT_TIME
or store the current date/time value into a host variable. And use this host for assignign.
Now I wonder which way is the faster one? Or is this irrelevant?
exec sql
update testpf
set t1date = CURRENT_DATE, t1time = CURRENT_TIME
where t1key = someValue;
or
dcl-s date date;
dcl-s time time;
exec sql
set :date = CURRENT_DATE;
exec sql
set :time = CURRENT_TIME;
exec sql
update testpf
set t1date = :date, t1time = :time
where t1key = someValue;
Note: This is all written "on the fly"! But I hope you get what I mean
Edit: To clarify, the goal is not to update just one row, its ment for several updates. Like having a database with invoice positions and a state field. This state field has 3 neigbour fields which track the user changing it on which day at which time. And in my case there can be several hundrets of positions where I need to update the time and date.