Skip to content

XAware Open Source Data Integration

You are here: Home arrow Forums
XAware Community Forums
Welcome, Guest
Please Login or Register.    Lost Password?
Re:How to get the date data from Oracle database (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Re:How to get the date data from Oracle database
#2259
prichards (User)
XAware user
Posts: 105
User Online Now Click here to see the profile of this user
Re:How to get the date data from Oracle database 5 Months, 1 Week ago Karma: 13  
Oracle's default date format is 'DD-MON-YY'. If you do not change Oracle's default date format, then you will retrieve only the date portion and not the time, when selecting a DATE field from Oracle. Some DB query tools, such as TOAD, will format the date to show the time portion and display a different date format(configurable). If you run the same query in the Oracle SQL*PLus command line, you will see only the date and not the time. (Note when selecting a date in XAware, it is converted to the XAware format 'YYYY-MM-DD'.)

The way to get the time portion of an Oracle date is to use the TO_CHAR() Oracle function. You can edit your SQL query in XAware to add the TO_CHAR function to get the time portion, and format the result as desired. So if your query after building the BizComp looks something like:

<xa:request>SELECT DEMO.AGENT.STARTDATE, DEMO.AGENT.ID ...>

you can edit xa:request (or edit the query in the wizard) and change the query to something like the following (note the 'AS' clause to give you the same field name to reference in the mapping):

<xa:request>SELECT TO_CHAR(DEMO.AGENT.STARTDATE,'YYYY/MM/DD HH24:MI:SS') AS STARTDATE, DEMO.AGENT.ID ...>

Your result should now look something like:

<STARTDATE>1990/12/06 09:14:28</STARTDATE>

The date and time are displayed and the display format is set as specified (rather than the XAware default date format, which you could have also specified.)

Similarly, when you insert a date into Oracle and want to specify the time portion, you can use the TO_DATE() function. There are many web sites and articles that discuss date/time formats in Oracle, and show examples of Oracle functions.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
      Topics Author Date
    thread link
How to get the date data from Oracle database
caoshuang 2008/07/29 06:24
    thread link
thread linkthread link Re:How to get the date data from Oracle database
prichards 2008/07/29 09:32
    thread link
thread linkthread linkthread link Re:How to get the date data from Oracle database
caoshuang 2008/07/29 19:35
    thread link
thread linkthread link Time format - 4:00PM
kotireddy 2008/10/01 07:56
    thread link
thread linkthread linkthread link Re:Time format - 4:00PM
dblack 2008/10/01 09:16
    thread link
thread linkthread linkthread linkthread link Re:Time format - 4:00PM
kotireddy 2008/10/01 23:41
    thread link
thread linkthread link Delete a file that is created by File BizComponent
kotireddy 2008/10/01 08:04
    thread link
thread linkthread linkthread link Re:Delete a file that is created by File BizComponent
dblack 2008/10/01 09:23
    emo
thread linkthread link Replacing text with another text in a file.
kotireddy 2008/10/20 07:11
    thread link
thread linkthread linkthread link Re:Replacing text with another text in a file.
prichards 2008/10/22 16:44
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop

Community Login

Polls

What best describes your current or next project that will include data services?
 

Visit XAware.com