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

Need db2 query to match time stamp field thru JCL


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

New User


Joined: 05 Jun 2006
Posts: 51
Location: Bangalore,India

PostPosted: Wed May 28, 2008 8:12 pm
Reply with quote

Hi,

I have to write one SQL query to delete some records based on below condition

I have to check the date field in the table which contains time stamp also but i have to match that field to current date if the date(time stamp) in table is lesser than 6 months i have to delete the record from table. This requirement has to achieve thru JCL only.

Thanks in advance.

Harsha.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed May 28, 2008 8:47 pm
Reply with quote

You can not do it just using JCL!

If you are sure you want to delete rows that are less than 6 months old then this sql statement will do it
DELETE FROM TABLE WHERE CURRENT TIMESTAMP - DATE_COL < 600000000;

For more than 6 months old change the < to >.
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Thu May 29, 2008 7:09 pm
Reply with quote

DB2 date functions should let you do this for more readability

WHERE DATE_COL < CURRENT TIMESTAMP - 6 MONTHS
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 Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts To get the the current time DFSORT/ICETOOL 13
No new posts RC query -Time column CA Products 3
No new posts C Compile time time stamps Java & MQSeries 10
No new posts Parallelization in CICS to reduce res... CICS 4
Search our Forums:

Back to Top