[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Strange Problem



The date value is 01-jun-99.


---------------------------------------- Message History
      ----------------------------------------


From: Chad.Slattery@csclac.irlgov.ie on 01/05/2000 09:22 AM GMT

Please respond to sqr-users@list.iex.net

To:   SQR-USERS@list.iex.net
cc:
Subject:  Re: Strange Problem




Hi,
Is the date value really 01-jun-1999 or is it 01-jun-99?  I discovered this
problem yesterday and have to change a lot of sqrs.  As Im dealing with
dates of birth Im not going to be too worried about the implications for
another 20 years or so, so Im happy with the fix.  If anybody else has any
better suggestions Id be happy to accept and use them.
Anyway I fixed by the following.
As we had been working with a date eg. 18NOV68 and wanted to use date format
'YYYYMMDD', the yyyy is taking 2000 and not 1900 from the server(obviously).
I extracted out the original date components and concatted a '19' to the
year. Although it may seem a bit lengthy, my procedure already existed, I
just had to add the '19' to $outdt.  Hope you get some use out of it
anyway..

! $a is the date 18nov68

begin-procedure conv-dat($a)
extract $dt-dd from $a 0 2 ! get the day
move $dt-dd to $outdt
concat '-' with $outdt
extract $dt-mm from $a 2 3  ! get the month
concat $dt-mm with $outdt
concat '-' with $outdt
move '19' to $nt
move $nt to $nt 99  ! use format 99
concat $nt with $outdt
extract $dt-yy from $a 5 4  ! get the year
concat $dt-yy with $outdt

begin-select
to_char(to_date($outdt,'DD-MON-YYYY'),'YYYYMMDD') &b
from dual
end-select
let $ndat = &b
end-procedure !conv-dat


Chad.

-----Original Message-----
From: srinivasan.seetharaman@DB.COM
[mailto:srinivasan.seetharaman@DB.COM]
Sent: Wednesday, January 05, 2000 8:53 AM
To: SQR-USERS@LIST.IEX.NET
Subject: Strange Problem


Hello All,
     I have a strange problem. I have a SQL statement in SQR. I select a
date
from a table .Take for instance the date is c_dt, the database variable is
referenced as &c_dt.

In the Insert statement in the same SQR , I'm inserting &c_dt into a date
field.
The insert executes successfully. But surprisingly , a date value(say
01-jun-1999') is inserted as ('01-jun-2099').

Could anyone throw some light on this ?. And let me know what the problem is