473,385 Members | 1,848 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,385 software developers and data experts.

Seek DB2 translation of Oracle statement with date stuff

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,
TO_CHAR(SYSDATE,'YYYY') YEAR
from DUAL

SQL> /

Q MO WEEKEND YEAR
- -- ---------- ----
2 06 06/12/2005 2005
Um.. If I need a custom Quarter function and you have one
that would be nice. Again... Thanks.

Nov 12 '05 #1
2 1687
------------------------------ Commands Entered
------------------------------
SELECT
QUARTER(CURRENT DATE) Q,
MONTH(CURRENT DATE) MON,
CHAR(NEXT_DAY(CURRENT DATE,'Sunday' ),USA) WEEKEND,
YEAR(CURRENT DATE) "YEAR"
from SYSIBM.SYSDUMMY1!
------------------------------------------------------------------------------

Q MON WEEKEND YEAR
----------- ----------- ---------- -----------
2 6 06/12/2005 2005

1 record(s) selected.

NEXT_DAYS is a sample UDF which is included in "Sample UDFs for
Migration".
http://www-106.ibm.com/developerwork...dfs/index.html

"DB2 Basics: Fun with Dates and Times" will be also usefull.
http://www-128.ibm.com/developerwork.../0211yip3.html

Nov 12 '05 #2
Thanks.

The NEXT_DAYS UDF is especially helpful.

Nov 12 '05 #3

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

Similar topics

0
by: Matt | last post by:
Short Description: The Translation Hub is not picking up the TNS names file. I'm using Oracle 9ids. It doesn't work for any users and it has never worked since it's been installed. Long...
0
by: JWM | last post by:
I am trying to implement Oracle connection pooling for the following code, which was written by someone else. Here is my main question -- this java file creates code that is executed every hour,...
11
by: jrefactors | last post by:
I want to know the differences between SQL Server 2000 stored procedures and oracle stored procedures? Do they have different syntax? The concept should be the same that the stored procedures...
1
by: gimme_this_gimme_that | last post by:
I'm new to DB2 and our team is in the process of migrating from Oracle to DB2. Assuming new.created_date is now a TIMESTAMP, what would be the DB2 translation of this Oracle trigger? Thanks....
2
by: gimme_this_gimme_that | last post by:
Can this statement be translated into DB2 ? CREATE VIEW RELEASE_REPORTS AS (SELECT RI.GROUP_ID AS GROUP_ID, RI.RELEASE_ID AS RELEASE_ID, RI.TARGET_REL_ID, RI.REL_DROP, B.DROPCOUNT ,...
13
by: BigDaDDY | last post by:
Um yeah....In case you haven't figured it out, Microsoft sucks. I'm going to be kicked back in my chair eating popcorn and watching football 10 years from now, while all you clowns are scrambling...
1
by: Andrew Arace | last post by:
I scoured the groups for some hands on code to perform the menial task of exporting table data from an Access 2000 database to Oracle database (in this case, it was oracle 8i but i'm assuming this...
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 ...
7
by: sherifffruitfly | last post by:
Hi, God I hate datetime string formatting... How do I get a string of the form "04-Oct-2006", for example, from a DateTime object? Thanks a jillion, cdj
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.