Unix Seconds to Oracle Date...HELP !!!

Hi All
We got a Oracle (8.1.7) database and I am trying to load some data but one of the column is in Unix time format(seconds since 01-01-1970) and I am trying to convert it to Oracle Date & time (dd-mon-yyyy, hh24:mi:ss) in CST time zone.
I am using this formula:
select to_char(new_time(to_date('01011970', 'ddmmyyyy') + 1/24/60/60 * 1090831602, 'GMT', 'CST'), 'dd-Mon-yyyy hh24:mi:ss') "Seconds to Date" from dual;
But it seems to me that I am getting incorrect results.
Could someone please help.
Cheers
Amit

hmmm, this is still poor support! new_time does not "know" if we are in winter or in summer.
select new_time(sysdate, 'GMT', 'EST'), new_time(sysdate + 180, 'GMT', 'EST') from dual
NEW_TIME(SYSDATE,'G NEW_TIME(SYSDATE+18
04.08.2004 05:31:59 31.01.2005 05:31:59
select
  FROM_TZ( CAST(SYSDATE AS TIMESTAMP),'GMT') at time zone 'Europe/Zurich',
  FROM_TZ( CAST(SYSDATE+180 AS TIMESTAMP),'GMT') at time zone 'Europe/Zurich'
from dual;
FROM_TZ(CAST(SYSDATEASTIMESTAMP),'GMT')ATT FROM_TZ(CAST(SYSDATE+180ASTIMESTAMP),'GMT'
04-AUG-04 12.28.15.000000 PM EUROPE/ZURICH 31-JAN-05 11.28.15.000000 AM EUROPE/ZURICH

Similar Messages

  • Select entries between two dates by converting Unix timestamp in Oracle Dat

    Hi,
    I need to select the entries between two dates from an Oracle db. The Oracle db has a column with Unix timestamps. I use the following querry, but it doesnt seem to be working as desired.
    select count(*) from reporter_status where to_char(FIRSTOCCURRENCE, 'mm-dd-yy') between ('08-07-06') and ('08-08-06');
    FIRSTOCCURRENCE has the Unix timestamps.
    Could anyone help me out with this. Thank you for your help.

    Assuming that it is actually a UNIX timestamp, then it is the number of seconds since Jan 1, 1970, so you need something like:
    SELECT COUNT(*)
    FROM reporter_status
    WHERE TO_DATE('01-Jan-1970', 'dd-mon-yyyy') + (firstoccurrence/24/60/60)
                    BETWEEN TO_DATE('08-07-2006', 'mm-dd-yyyy') AND
                            TO_DATE('08-08-2006, 'mm-dd-yyyy');Did Y2K not teach us anything? Use 4 digit years.
    John

  • Converting numeric date (seconds) to Oracle date

    Hello all,
    Not sure if this is the correct place for my question but here goes...
    I am extracting data from an Oracle table in which the date/time is stored as a number (seconds since 1970). How can I convert this to an Oracle recognized date? I tried to extract the date as a number and then convert it using the localtime function in PERL but ran into other problems. Any help or advice would be greatly appreciated.
    David

    Instead of writing PERL script if you write on a format trigger same coad (using Pl/SQL) it will work.

  • Help with displaying Date from Unix seconds

    My program receives seconds taken from a Unix system and must display them on my GUI. I realize I have to convert seconds to milliseconds for the Date, plus I take into consideration the timezone.
    My problem is that everything works correctly for time zones from GMT -1:00 all the way to GMT -12:00, but GMT time and all the zones between GMT +1:00 to GMT +12:00 display the wrong time. It varies how many hours off it is.
    Does anyone have any suggestions? I have been searching for similar issues.
    here is my code:
    static public String SecToTimeOfDay(long sec)
       SimpleDateFormat  dateFormat  = new SimpleDateFormat("HH:mm:ss");
       long timeZone  = java.util.TimeZone.getDefault().getRawOffset();
       int milli = 1000;
       String date;
       if (timeZone < 0)
          timeZone = timeZone * -1;
       //convert to seconds to milliseconds
       date = dateFormat.format(new java.util.Date((sec * milli) + timeZone));
       return date;
    }

    That is not the right way to handle time zones. Try the following and see if you're still having problems.
    static public String SecToTimeOfDay(long sec){  
        SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
        dateFormat.setTimeZone(java.util.TimeZone.getDefault());
        int milli = 1000;
        date = dateFormat.format(new java.util.Date(sec * milli));
        return date;
    }

  • H/W & Data migration form AS 400/DB2 V5 R4 to Unix/Linux and Oracle

    We are considering migration of huge data(in Terabytes) from AS 400/DB2 V5 R4 to Unix/Linux and Oracle.
    We are changing operating system and data base also..Please advise if R98403 can be used to move data in terabytes.
    I understand Oracle work bench does not support V5 R4.
    I would like to know pointers on possible tools and approach for the migration.
    Thanks
    Las

    Hi,
    May I know the reason for this huge change? As most of the current setups of E1 are on AS00 only. Then also if you are planning to migrate your hardware and data from DB2/OS400 to Orcle and Unix/Linux you can consider below options for data migration:
    1) R98403 and R98403A are best approach for this type of migration it may consule some extra time but accurate..! As no other tools like Oracle Workbench can
    provide 100% accuracy.
    2) Archive data size if possible with the help of BA team and work on some purging this will help you to great level.
    3) If you decide to go live on new setup please consider going live module wise as a specific module data can be moved fast, and if BA team can specify some specific tables only getting hit for module trasection they can develop TC reports for specific data to be migrated and can save your time instead of copying entire data set again at go live.
    Good Luck..!
    Thanks,
    Manoj Kathare

  • Need help in oracle data recovery

    Friends ,i need help in oracle data recovery.
    I had an oracle 8i database running on windows.
    For some reason Windows operating system crashed.
    It is not booting up.
    I dont have current backups.But my database physical files are in the disk.
    Controlfile,datafiles and redo log files are there.
    Is there any way I can recover my database?
    Please help in this issue.
    regards
    Ajith

    HI citrus,
    thanks for the reply.
    I have installed database 9i on the same PC after O/S reinstallation.
    You are saying that ,I need to keep oracle root folder same as that of my old installation ,and copy control files,redo log and data files in exactly same folders as that of old database,and then start the database?
    thank you for your patience and support.
    regards.,
    Ajith

  • Help with Creating a Oracle Data Source

    Hello:
    I am trying to create a Oracle Data source.
    I was successful in creating a JDBC Conection Pool.
    But I am stumped creating a new datasource that uses the Oracle Connection Pool.
    It asks for a JNDI Name and I have no clue what I should enter in this box.
    Can somebody help me?
    Thanks.
    venki

    Enter whatever name suits you. This is the name you will use when looking up your datasource in the JNDI tree, i.e.
    Context ctx = new InitialContext();
    DataSource oracleDS = (DataSource) ctx.lookup("myJNDIName");

  • Help!! Want to immigrate Oracle Data in ASCII7 code to a Simplified Chinese Database

    I want to immigrate Oracle Data in ASCII7 code to a Simplified Chinese Database?
    I use exp& imp but it failed.
    Who can help me !
    Thanks a lot!

    Can you please specify the exact character sets you are migrating, such as US7ASCII ->ZHS16GBK . There are a couple of common scenarios. One is the source character set is not a subset of the target. Another is that the source character set has illegal characters. In your case maybe non ASCII characters. A third possibility is that you have not set up your NLS_LANG settings properly when you did your import or export. Can you please also describe the error message you are getting? What versions of Oracle do the source and target database reside? There is an Oracle utility that is highly recommended to use with Oracle8i before doing migrations called the Character Set Scanner. For more information on database character set migration issues and the Character Set Scanner please refer to
    http://st-doc.us.oracle.com/8.0/817/addendum.817/a85455/nlsadden.htm.

  • Setting Oracle date in Unix

    Lately I have made a change in the date/time by modifying the timezone. I rebooted the Unix Server and the date is now as I want. However I have noticed that Oracle Enterprise Manager (10g) is still displaying time with the old timezone.
    Do I need to change something else?
    thanks.

    I've made some research and discovered that what i need to change is the 'systimestamp' or 'sessiontimestamp'.
    What do I need to set these functions one hour back?

  • How to access Oracle Data Base on Unix using Visual Basic ?

    Hi !
    I want to use visual basic and access the Oracle Data Base on Unix server. How can i do that ? Do i need any software?
    .Prashant

    You need an oracle client installation and setup your TNS names.

  • Oracle Data Access with Delphi - Please help

    Hello: We would like to access Oracle Applications data using a third party tool. I understand we can use Delphi development environment to access Oracle data. Can somebody help, how do we do this? Any online tutorial or White paper. Basically we want some simple UI screens to fetch Oracle Applications data. Thanks for your help, in advance.

    Google: "Delphi" and "Oracle" and "connection"

  • Oracle date function to add one second

    how to add one second to the date, example, SYSDATE+1 will add one day to current day, but how to add one second to the current time. for example, the current date is "2006-4-21 12:01:12", and I want to add 1 second to the current time, and the result will be "2006-4-21 12:01:13", how to achieve it&#65311;&#65311;

    select to_char(sysdate,'hh24:mi:ss'),
    to_char(sysdate+1/24/60/60,'hh24:mi:ss') from dual;
    TO_CHAR( TO_CHAR(
    09:44:44 09:44:45

  • Need help on how to create the simple mapping using ORACLE DATA INTEGRATOR

    Hi guys,
    am new to learn odi.. please share me or steps how to develop the simple mapping using ODI...

    Hi,
    I am a newbie to Oracle Data Integrator as well. You should have a look here first; http://www.business-intelligence-quotient.com/?p=379
    Try to play around with ODI and then come back if you have specific questions. You should better move to this ODI-forum; Data Integrator
    Good Luck,
    Daan Bakboord
    http://obibb.wordpress.com

  • Unix timestamp to Oracle timestamp conversion

    Hi all,
    I am trying to convert the UNIX timestamp to ORACLE timestamp .
    I have done like this upto now.
    CREATE OR REPLCACE FUNCTION unixts_to_oraclets(unixtimestamp IN INTEGER)
    RETURN DATE IS
    result DATE;
    BEGIN
    result := TO_DATE('1970-01-01', 'YYYY-MM-DD') + numtodsinterval(unixtimestamp, 'SECOND');
    return(result);
    end unixts_to_oraclets;
    now i have run this query
    SQL> select unixts_to_oraclets(1139291114) as TS from dual;
    TS
    07-FEB-06
    now i need the ouput to like this 07-FEB-06 01:10:12
    for that i have done like this:
    DECLARE
    v_date DATE;
    res_date DATE;
    BEGIN
    SELECT from_uts(1139291114)INTO v_date FROM dual;
    SELECT TO_TIMESTAMP(v_date,'DD-MON-RRHH24.MI.SS.FF') INTO res_date FROM dual;
    DBMS_OUTPUT.PUT_LINE(res_date);
    END;
    but the output is :
    SQL> /
    07-FEB-06
    PL/SQL procedure successfully completed.
    why is that it is not printing 07-FEB-06 01:10:12 ?
    how should i moodify the code to get the desired output.
    please help me i this regard
    Trinath Somanchi,
    Hyderabad.

    SQL> exec dbms_output.put_line(sysdate);
    07-FEB-06
    PL/SQL procedure successfully completed.
    SQL> exec dbms_output.put_line(to_char(sysdate, 'DD-MM-YYYY HH24:MI:SS'));
    07-02-2006 02:48:35
    PL/SQL procedure successfully completed.
    SQL> alter session set nls_date_format='DD-MM-YYYY HH24:MI:SS';
    Session altered.
    SQL> exec dbms_output.put_line(sysdate);
    07-02-2006 02:49:03
    PL/SQL procedure successfully completed.

  • Oracle Data Loader On Demand on EHA Pod

    Oracle Data Loader doesn't work correctly.
    I downloaded it from Staging(EHA Pod).
    And I did the following work.
    1.Move to "config" folder,and update "OracleDataLoaderOnDemand.config".
    hosturl=https://secure-ausomxeha.crmondemand.com
    2.Move to "sample" folder,and change Owner_Full_Name at "account-insert.csv".
    And at the command prompt,run the batch file.
    It runs successfully,but records aren't inserted on EHA Pod.Records exist on EGA Pod.
    This is the log.
    Is Data Loader for only EGA Pod?Would please give me some advices?
    [2012-09-19 14:49:55,281] DEBUG - [main] BulkOpsClient.main(): Execution begin.
    [2012-09-19 14:49:55,281] DEBUG - [main] BulkOpsClient.main(): List of all configurations loaded: {sessionkeepchkinterval=300, maxthreadfailure=1, testmode=production, logintimeoutms=180000, csvblocksize=1000, maxsoapsize=10240, impstatchkinterval=30, numofthreads=1, hosturl=https://secure-ausomxeha.crmondemand.com, maxloginattempts=1, routingurl=https://sso.crmondemand.com, manifestfiledir=.\Manifest\}
    [2012-09-19 14:49:55,281] DEBUG - [main] BulkOpsClient.main(): List of all options loaded: {datafilepath=sample/account-insert.csv, waitforcompletion=False, clientlogfiledir=., datetimeformat=usa, operation=insert, username=XXXX/XXXX, help=False, disableimportaudit=False, clientloglevel=detailed, mapfilepath=sample/account.map, duplicatecheckoption=externalid, csvdelimiter=,, importloglevel=errors, recordtype=account}
    [2012-09-19 14:49:55,296] DEBUG - [main] BulkOpsClientUtil.getPassword(): Entering.
    [2012-09-19 14:49:59,828] DEBUG - [main] BulkOpsClientUtil.getPassword(): Exiting.
    [2012-09-19 14:49:59,828] DEBUG - [main] BulkOpsClientUtil.lookupHostURL(): Entering.
    [2012-09-19 14:49:59,937] DEBUG - [main] BulkOpsClientUtil.lookupHostURL(): Sending Host lookup request to: https://sso.crmondemand.com/router/GetTarget
    [2012-09-19 14:50:03,953] DEBUG - [main] BulkOpsClientUtil.lookupHostURL(): Host lookup returned: <?xml version="1.0" encoding="UTF-8"?>
    <HostUrl>https://secure-ausomxega.crmondemand.com</HostUrl>
    [2012-09-19 14:50:03,953] DEBUG - [main] BulkOpsClientUtil.lookupHostURL(): Successfully extracted Host URL: https://secure-ausomxega.crmondemand.com
    [2012-09-19 14:50:03,953] DEBUG - [main] BulkOpsClientUtil.lookupHostURL(): Exiting.
    [2012-09-19 14:50:03,953] DEBUG - [main] BulkOpsClientUtil.determineWSHostURL(): Entering.
    [2012-09-19 14:50:03,953] DEBUG - [main] BulkOpsClientUtil.determineWSHostURL(): Host URL from the Routing app=https://secure-ausomxega.crmondemand.com
    [2012-09-19 14:50:03,953] DEBUG - [main] BulkOpsClientUtil.determineWSHostURL(): Host URL from config file=https://secure-ausomxeha.crmondemand.com
    [2012-09-19 14:50:03,953] DEBUG - [main] BulkOpsClientUtil.determineWSHostURL(): Successfully updated the config file: .\config\OracleDataLoaderOnDemand.config
    [2012-09-19 14:50:03,953] DEBUG - [main] BulkOpsClientUtil.determineWSHostURL(): Host URL set to https://secure-ausomxega.crmondemand.com
    [2012-09-19 14:50:03,953] DEBUG - [main] BulkOpsClientUtil.determineWSHostURL(): Exiting.
    [2012-09-19 14:50:03,953] INFO - [main] Attempting to log in...
    [2012-09-19 14:50:10,171] INFO - [main] Successfully logged in as: XXXX/XXXX
    [2012-09-19 14:50:10,171] DEBUG - [main] BulkOpsClient.doImport(): Execution begin.
    [2012-09-19 14:50:10,171] INFO - [main] Validating Oracle Data Loader On Demand Import request...
    [2012-09-19 14:50:10,171] DEBUG - [main] FieldMappingManager.parseMappings(): Execution begin.
    [2012-09-19 14:50:10,171] DEBUG - [main] FieldMappingManager.parseMappings(): Execution complete.
    [2012-09-19 14:50:11,328] DEBUG - [Thread-3] ODWSSessionKeeperThread.Run(): Submitting BulkOpImportGetRequestDetail WS call
    [2012-09-19 14:50:11,328] INFO - [main] A SOAP request was sent to the server to create the import request.
    [2012-09-19 14:50:13,640] DEBUG - [Thread-3] SOAPImpRequestManager.sendImportGetRequestDetail(): SOAP request sent successfully and a response was received
    [2012-09-19 14:50:13,640] DEBUG - [Thread-3] ODWSSessionKeeperThread.Run(): BulkOpImportGetRequestDetail WS call finished
    [2012-09-19 14:50:13,640] DEBUG - [Thread-3] ODWSSessionKeeperThread.Run(): SOAP response status code=OK
    [2012-09-19 14:50:13,640] DEBUG - [Thread-3] ODWSSessionKeeperThread.Run(): Going to sleep for 300 seconds.
    [2012-09-19 14:50:20,328] INFO - [main] A response to the SOAP request sent to create the import request on the server has been received.
    [2012-09-19 14:50:20,328] DEBUG - [main] SOAPImpRequestManager.sendImportCreateRequest(): SOAP request sent successfully and a response was received
    [2012-09-19 14:50:20,328] INFO - [main] Oracle Data Loader On Demand Import validation PASSED.
    [2012-09-19 14:50:20,328] DEBUG - [main] BulkOpsClient.sendValidationRequest(): Execution complete.
    [2012-09-19 14:50:20,343] DEBUG - [main] ManifestManager.initManifest(): Creating manifest directory: .\\Manifest\\
    [2012-09-19 14:50:20,343] DEBUG - [main] BulkOpsClient.submitImportRequest(): Execution begin.
    [2012-09-19 14:50:20,390] DEBUG - [main] BulkOpsClient.submitImportRequest(): Sending CSV Data Segments.
    [2012-09-19 14:50:20,390] DEBUG - [main] CSVDataSender.CSVDataSender(): CSVDataSender will use 1 threads.
    [2012-09-19 14:50:20,390] INFO - [main] Submitting Oracle Data Loader On Demand Import request with the following Request Id: AEGA-FX28VK...
    [2012-09-19 14:50:20,390] DEBUG - [main] CSVDataSender.sendCSVData(): Creating thread 0
    [2012-09-19 14:50:20,390] INFO - [main] Import Request Submission Status: Started
    [2012-09-19 14:50:20,390] DEBUG - [main] CSVDataSender.sendCSVData(): Starting thread 0
    [2012-09-19 14:50:20,390] DEBUG - [main] CSVDataSender.sendCSVData(): There are pending requests. Going to sleep.
    [2012-09-19 14:50:20,406] DEBUG - [Thread-5] CSVDataSenderThread.run(): Thread 0 submitting CSV Data Segment: 1 of 1
    [2012-09-19 14:50:24,328] INFO - [Thread-5] A response to the import data SOAP request sent to the server has been received.
    [2012-09-19 14:50:24,328] DEBUG - [Thread-5] SOAPImpRequestManager.sendImportDataRequest(): SOAP request sent successfully and a response was received
    [2012-09-19 14:50:24,328] INFO - [Thread-5] A SOAP request containing import data was sent to the server: 1 of 1
    [2012-09-19 14:50:24,328] DEBUG - [Thread-5] CSVDataSenderThread.run(): There is no more pending request to be picked up by Thread 0.
    [2012-09-19 14:50:24,328] DEBUG - [Thread-5] CSVDataSenderThread.run(): Thread 0 terminating now.
    [2012-09-19 14:50:25,546] INFO - [main] Import Request Submission Status: 100.00%
    [2012-09-19 14:50:26,546] INFO - [main] Oracle Data Loader On Demand Import submission completed succesfully.
    [2012-09-19 14:50:26,546] DEBUG - [main] BulkOpsClient.submitImportRequest(): Execution complete.
    [2012-09-19 14:50:26,546] DEBUG - [main] BulkOpsClient.doImport(): Execution complete.
    [2012-09-19 14:50:26,546] INFO - [main] Attempting to log out...
    [2012-09-19 14:50:31,390] INFO - [main] XXXX/XXXX is now logged out.
    [2012-09-19 14:50:31,390] DEBUG - [Thread-3] ODWSSessionKeeperThread.Run(): Interrupted.
    [2012-09-19 14:50:31,390] DEBUG - [main] BulkOpsClient.main(): Execution complete.

    Hi,
    the Data Loader points by default to the production environment regardless if you download it from staging or production.
    To change the pod edit the config file and input the below content:
    hosturl=https://secure-ausomxeha.crmondemand.com
    routingurl=https://secure-ausomxeha.crmondemand.com
    testmode=debug

Maybe you are looking for