Help needed in SQLCODE -401.

RDBMS from IBM and IBM's Hierarchical DBMS and Transaction Manager (IMS DC).
Post Reply
Seema Jain
New Member
Posts: 4
Joined: Sun Dec 20, 2015 11:58 pm

Help needed in SQLCODE -401.

Post by Seema Jain »

Hello all-

I am using the following query: Please suggest how to correct it ?

Code: Select all

SELECT * FROM TABLEN  
some conditions
WHERE timestamp_column > CURRENT DATE - 7 YEARS; 

I am simply trying to get the data of 7 years from current date. But it ends in SQLCODE -401.


Thank you.
Last edited by Anuj Dhawan on Mon Jan 04, 2016 4:43 pm, edited 1 time in total.
Reason: Added code Tags.
zprogrammer
Global Moderator
Global Moderator
Posts: 588
Joined: Wed Nov 20, 2013 11:53 am
Location: Mars

Re: Help needed in SQLCODE -401.

Post by zprogrammer »

Try

Code: Select all

WHERE DATE(TIMESTAMP_COLUMN) > CURRENT DATE - 7 YEARS;
zprogrammer
User avatar
Anuj Dhawan
Founder
Posts: 2801
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Help needed in SQLCODE -401.

Post by Anuj Dhawan »

[mention]Seema Jain[/mention],

Please see this previous topic too: SQLCODE -401 in a Date calculation.
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Seema Jain
New Member
Posts: 4
Joined: Sun Dec 20, 2015 11:58 pm

Re: Help needed in SQLCODE -401.

Post by Seema Jain »

Thanks all.

Code: Select all

WHERE DATE(TIMESTAMP_COLUMN) > CURRENT DATE - 7 YEARS;  
has worked. :)
User avatar
Anuj Dhawan
Founder
Posts: 2801
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Help needed in SQLCODE -401.

Post by Anuj Dhawan »

Thanks for posting what has worked for you - appreciate that.
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM DB2 and IMS DB/DC”