|
I am trying to convert a static sql statement to allow for some
flexibility and I'm having trouble with the dates.
This is the original SQL statement.
declare db2curs cursor for
SELECT
TE1DPT, TEMEMP, TEMNAM, TEMBDT, TEMHDT, TEMRDT
, integer(floor(:currentdate - getdatesql(TEMBDT)) / 10000) as age
, integer(floor(:currentdate - getdatesql(TEMHDT)) / 10000) as YOS
FROM tremp
, trei1
WHERE TEMEMP = TE1EMP
and TEMEES = 'FR'
Order by age desc;
Currentdate = %date(daterun:*USA0) ;
Getdatesql is a udf that converts an 8 digit date to a date field.
The problem I'm having is with current date.
Here is where I'm at now.
Select ;
When FPEMP = 'F' ;
Sts = 'TEEMES = ' + Q + 'FR' + Q;
When FPEMP = 'P' ;
Sts = 'TEEMES = ' + Q + 'PT' + Q;
EndSl ;
<<SNIP trying to get currentdate into the dynamic stmt string>>
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.