473,804 Members | 4,128 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 24427
<gi************ *******@yahoo.c om> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.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_da te, 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_da te,USA) from foo

I get the following message :

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

Thanks.

Nov 12 '05 #3
CHAR(DATE(creat ed_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
36947
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 size? Is there anyway to force pro*c to format correctly without using to_char because with to_char i lose the ability to keep track of correct data type. Thanks
4
5348
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 the column is DATE then I can use char(date, USA) and then substr of 'yyyy', but I am not sure how can I do this with timestamp. Please help
2
1703
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 the 'Q' (Quarter), and NEXT_DAY translations. Thanks. SELECT TO_CHAR(SYSDATE, 'Q') Q, TO_CHAR(SYSDATE, 'MM') MON, TO_CHAR(NEXT_DAY(SYSDATE,'SUNDAY' ),'MM/DD/YYYY') WEEKEND,
14
4449
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 timestamps, we frequently use the date() function to "convert" from the Oracle date datatype to the DB2 date datatype. We have used this technique on over 20 Oracle tables for several months with no problem. One table in particular fails with a...
24
4167
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 select to_char(sysdate, 'dd/mm/yy hh24:mi:ss') from dual result would be 15/06/06 14:49:35
0
1172
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 just want the second line of $errormsg to print is this possible? select TRIM(ed.created_date) Created_Date, TRIM(ed.ERRORMSG) ErrorMsg, to_char(substr(eventdata,instr(eventdata,'<ns0:SiteContractNumber>')+24, ...
3
11473
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 Published", sum(quantity) * (retail - cost) "Total Profit" FROM books JOIN orderitems USING(isbn) GROUP BY pubdate, (retail-cost); I get a Profit for each book, not each year, there are duplicate years.
0
1436
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. ----------------------------------------------------------------------------------------------------------- test_reporting/here4fun@test_PROD SET NEWPAGE NONE; SET SPACE 0; SET LINESIZE 181;
13
1849
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 give out but like: Revenue type doctor name Amount
0
10577
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10332
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9150
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7620
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6853
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5521
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4299
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2991
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.