473,788 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.SYSDUMMY 1.
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_DA Y(SYSDATE,'SUND AY' ),'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 1702
------------------------------ Commands Entered
------------------------------
SELECT
QUARTER(CURRENT DATE) Q,
MONTH(CURRENT DATE) MON,
CHAR(NEXT_DAY(C URRENT DATE,'Sunday' ),USA) WEEKEND,
YEAR(CURRENT DATE) "YEAR"
from SYSIBM.SYSDUMMY 1!
------------------------------------------------------------------------------

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
2802
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 Description: The translation hub will work if the following entry is modified in the registry:
0
4749
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, but once per week, the oracle server is brought down for backup. At that time, I get an error that looks like I have the wrong credentials for the database. For every subsequent attempt to run the hourly process, I am getting a broken pipe error,...
11
10758
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 execute in the database server with better performance? Please advise good references for Oracle stored procedures also. thanks!!
1
1599
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. CREATE OR REPLACE TRIGGER "BZ".atable_created_date
2
1399
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 , DECODE(RI.REL_DROP, NULL , B.DROPCOUNT ) AS RCOUNT, RI.CREATED_DATE AS DATE_ENTERED, RI.QA_TARGET_DATE AS DATE_SCH_QA, RI.TARGET_DATE AS DATE_SCH_PRD, Y.READY_FOR_QA,
13
3330
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 to rewrite all your code because Microsoft upgraded all their crap and nothing you wrote 10 years earlier works. It doesn't take a rocket scientist to figure out that Microsoft is unreliable. Try opening an Excel 95 spreadsheet you wrote in...
1
9201
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 will work for 9i and even 10g ) No one had what I needed, so I wrote it myself. I Rule. This code isn't going for efficiency, and isn't trying to be dynamic. It doesn't create the table structure in Oracle, that's up to you. (I
24
4166
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
7
17075
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
9656
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10364
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...
1
10110
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8993
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...
0
5398
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
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
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.