473,416 Members | 1,737 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

DB2 equivalent of Oracle to_char(created_date,'MM/DD/YYYY')

What is the DB2 equivalent syntax of Oracle's :

select to_char(created_date,'MM/DD/YYYY') from foo
Thanks

Nov 12 '05 #1
4 24397
<gi*******************@yahoo.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
What is the DB2 equivalent syntax of Oracle's :

select to_char(created_date,'MM/DD/YYYY') from foo
Thanks

What does to_char do? If it converts a date to 'MM/DD/YYYY' format, then you
can use:

CHAR(created_date, USA)

Check the SQL Reference vol 1 for other CHAR date formats.
Nov 12 '05 #2
Wow, thanks for the quick response Mark ...

I forgot to mention that created_date is a DB2 TIMESTAMP.

When I execute this statment :

select char(created_date,USA) from foo

I get the following message :

SQL017N The type, length or value of argument "1" of routine
"SYSIBM.CHAR" is incorrect SQLSTATE=42815
Is the SQL Reference you are refering to DB2 specific?

Thanks.

Nov 12 '05 #3
CHAR(DATE(created_date), USA)

Nov 12 '05 #4
You're the man. Thanks Tonkuma!

Nov 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: deadlocklegend | last post by:
Hi all, when i set a date field's type (12) to VARCHAR2 or STRING, I get the date (mm/dd/yyyy) correct, but I can never get the time which is always set to 00:00:00 even if i increase the buffer...
4
by: Prakash | last post by:
Hi Can anyone tell me how to derive "yyyy" from a timestamp column in db2? Something like to_char(sysdate, 'yyyy') ... in oracle. I have to oracle-like to_char function but its very slow. If...
2
by: gimme_this_gimme_that | last post by:
Might some kind soul take on this Oracle statement and translate it into DB2? Yes ... I know the equivalent of SYSDATE is CURRENT TIMESTAMP, and that DUAL is SYSIBM.SYSDUMMY1. But I'm puzzled by...
14
by: peteh | last post by:
Hi All; We have many production jobs that "load from cursor" to a UDB/AIX 8.2 (with dpf) data warehouse from source tables residing Oracle 9i. Since Oracle dates are (roughly) equivalent to DB2...
24
by: clinttoris | last post by:
Could some please finish this line of code. For the life of me whatever I try it does not work. I am trying to insert the current date time into oracle. Now I know that in oracle if I run ...
0
by: jonathan184 | last post by:
This is part of the perl script. Basically i want to try and get the second line of the error message. Now the whole error which is 5 lines long will come up if i use $Errormsg So basically i...
3
by: guajaj | last post by:
I'm trying to show total profit per year of publication, but my pubdate's are all in the full date format. I tried this, but I doesn't quite work: SELECT TO_CHAR(pubdate, 'YYYY') "Year...
0
by: iitt2007 | last post by:
Hi I am newbie. I need to translate the following Oracle script to SQL Server 2005 script. I will appreciate your help and feedback. Thanks a lot in advance. ...
13
by: chandra794 | last post by:
Dear sir, Iam Oracle developer(D2k), i have a problem in developing the query..... let me explain in detail, Report is Revenues for the year of Doctors. i have develope the query, which...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.