Hi,
either you use "db2 -x SELECT ..." to suppress the header & footer, or you grep for the leading digit "2" (of 2008...):
- db2 "SELECT ... " | grep ^2 >file.txt
Instead of that you may store the date in a shell variable and use the latter in the next step:
- DTSTAMP=` db2 -x "select ..." `
-
db2 "select * ... where WHERE TIMESTAMP_UPDATED > '$DTSTAMP' "
-
I guess you need the timestamp of the beginning of the script for more than one action. I'd suggest to create an auxiliary table {var varchar(20), value varchar(128)}, for script internal values:
- insert into my.variables (var,value)
-
SELECT 'tstamp', Current_timestamp
-
from sysibm.sysdummy1 ;
-
-
SELECT * from ...
-
WHERE TIMESTAMP_UPDATED>(
-
timestamp(select value from my.variables where var='tstamp')
-
) ;
-
Regards
Doc Diesel