Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Can substring be used for var declared as TIMESTAMP

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
Sriram K

New User


Joined: 17 Feb 2009
Posts: 32
Location: Bangalore

PostPosted: Sat Jun 13, 2009 1:33 pm    Post subject: Can substring be used for var declared as TIMESTAMP
Reply with quote

Can substring be used for a table variable declared as TIMESTAMP.

I tried the below query

* COLA is declared as TIMESTMAP *

Select SUBSTR( COLA, 1, 10)
From TABLEA
...
..


I got sqlcode -171. Can anyone suggest on this.
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


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

PostPosted: Sat Jun 13, 2009 3:35 pm    Post subject:
Reply with quote

Suggest you cast the timestamp column with the scalar function CHAR
Back to top
View user's profile Send private message
Raghu navaikulam

Active User


Joined: 27 Sep 2008
Posts: 193
Location: chennai

PostPosted: Tue Jun 16, 2009 4:03 pm    Post subject: Reply to: Can substring be used for var declared as TIMESTAM
Reply with quote

Hi

As Dick suggested, you can use the CHAR function to convert Packed Decimal Timestamp to Character format and then apply SUBSTR function.

Eg. SELECT SUBSTR(CHAR(COLA), 1,10)) FROM TABLEA;

Regards
Raghu
Back to top
View user's profile Send private message
Sriram K

New User


Joined: 17 Feb 2009
Posts: 32
Location: Bangalore

PostPosted: Wed Jun 17, 2009 8:19 pm    Post subject: SELECT SUBSTR(CHAR(COLA), 1,10)) FROM TABLEA
Reply with quote

It worked.

Thanks.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Getting -504 Cursor Name GTT-ARTS-CUR... Robin Sulsona DB2 2 Fri Mar 17, 2017 1:43 am
No new posts Converting EBCDIC to Unicode (TimeStamp) muralikrishnan_new COBOL Programming 2 Mon Jul 25, 2016 10:42 pm
No new posts Query using SUBSTRING on a column of ... sasanka DB2 5 Mon Jul 04, 2016 1:01 pm
No new posts Convert Timestamp Value mrdinesh DFSORT/ICETOOL 7 Thu May 05, 2016 6:01 pm
No new posts Comparing timestamp in Synscort l.nethaji SYNCSORT 13 Wed Jan 20, 2016 4:47 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us