|
I have created a process for CYMD2DATE and DATE2CYMD. Unfortunately, without a C compiler, I cannot create user-defined functions to use them.... The create function... parms may not be exactly right, as I was reading through the programming manual while writing them. However, the code inside the return() is correct. Cymd2date() assumes the size of an integer is 10. These routines are not optimized (especially cymd2date()). create function date2cymd(indate date) returns integer language sql deterministic begin return( cast( strip(char(int(substr(char(year( indate )),1,2))-19))|| substr(char( indate ,iso),3,2)|| substr(char( indate ,iso),6,2)|| substr(char( indate ,iso),9,2) as integer) ); end create function cymd2date(incymd integer) returns date language sql deterministic begin return( date( strip(char((int(substr(substr(digits( incymd ),4,7),1,1)) +19)))|| substr(substr(digits( incymd ),4,7),2,2)||'-'|| substr(substr(digits( incymd ),4,7),4,2)||'-'|| substr(substr(digits( incymd ),4,7),6,2) ) ); end Can someone with SQL development kit and C compiler compile these functions and verify they compile and work? Are the functions standalone objects that could be saved and emailed? Select date2cymd(curdate()) ... Should return 1,020,802 Select date2cymd(date('1999-12-31')) ... Should return 991,231 Select cymd2date(1020802) ... Should return 08/02/02 (USA) Select cymd2date(0991231) ... Should return 12/31/99 (USA) Thanks, Loyd
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.