IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

SQLCODE -180 Date Error


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
satyender

New User


Joined: 05 Jan 2008
Posts: 50
Location: Olympia, WA, USA

PostPosted: Fri Sep 05, 2008 1:28 am
Reply with quote

Hi all,

Could anyone please help in this regard.
Thanks in Advance

I would like to know how to get the data of 5 yrs from a particular date.

I am using the followin query, but getting an error.
SELECT *
FROM
LEXUS.TLCS005
WHERE RID IN
(SELECT RID
FROM LEXUS.TLCS007
WHERE RDNDTE IN
(SELECT RDNDTE
FROM LEXUS.TLCS003
WHERE DATE(RDNDTE) >= DATE('2008/07/23') - 5 YEARS))
WITH UR;


ERROR:

Code:
   RID   OPSEQ  OPCODE      OPCOMB  OPHOURS     OPTECHID  OPDESC       
---------+---------+---------+---------+---------+---------+---------+------
DSNT408I SQLCODE = -180, ERROR:  THE DATE, TIME, OR TIMESTAMP VALUE *N IS   
         INVALID                                                           
DSNT418I SQLSTATE   = 22007 SQLSTATE RETURN CODE                           
DSNT415I SQLERRP    = DSNXRTIM SQL PROCEDURE DETECTING ERROR               
DSNT416I SQLERRD    = -6805 0  0  -1  0  0 SQL DIAGNOSTIC INFORMATION       
DSNT416I SQLERRD    = X'FFFFE56B'  X'00000000'  X'00000000'  X'FFFFFFFF'   
         X'00000000'  X'00000000' SQL DIAGNOSTIC INFORMATION               
---------+---------+---------+---------+---------+---------+---------+----
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Sep 05, 2008 1:37 am
Reply with quote

what is the data-type of RDNDTE?

does your site use backslash / , or hypen - as separator?
is yours a year/month/day system?

answer those three questions, and you will solve the problem, or at least know if it is RDNDTE or your literal.
Back to top
View user's profile Send private message
satyender

New User


Joined: 05 Jan 2008
Posts: 50
Location: Olympia, WA, USA

PostPosted: Fri Sep 05, 2008 3:55 am
Reply with quote

Thanks dbzTHEdinosauer

I have resoved by converting into days. Now its working fine.
Thanks for your quick response.

Code:
SELECT *                                                       
FROM                                                           
LEXUS.TLCS005                                                   
WHERE RID IN                                                   
  (SELECT RID                                                   
    FROM LEXUS.TLCS007                                         
        WHERE RDNDTE IN                                         
       (SELECT RDNDTE                                           
            FROM LEXUS.TLCS003                                 
              WHERE DATE(RDNDTE) >= CURRENT DATE - 1868 DAYS   
              AND DATE(RDNDTE) <= CURRENT DATE - 42 DAYS))     
 WITH UR;
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Sep 05, 2008 5:05 am
Reply with quote

now that you have converted the literal to the db2 current_date.
you probably could go back to the 5 years.

is any five year span always = 1868 days?

due to some recent experience I had, I would also suggest changing the left hand predicate
From: DATE(RDNDTE) TO: RDNDTE
and
CAST the date returned from
<CURRENT_DATE minus whatever>
to what ever data type attribute the column RDNDTE has- is.

you would then reduce the resource requirement by
not executing a function on every row
DATE(RDNDTE)
, and instead, only once:
to derive the right-hand predicates.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Error when install DB2 DB2 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
Search our Forums:

Back to Top