Inserting a timestamp with YYYY-MM-DD HH:MI:SS format

Hi,
I have some software that insert records to a database through an ODBC driver using YYYY-MM-DD HH:MI:SS timestamp format. I was expecting this would automatically be converted back to the local database timestamp format. Each time I try to do this it give an "invalid month" error.
The code is not written by me so I cannot alter the session to specify the format. Is there a way of configuring the database to allow correctly convert the date in its existing format to the local database format or change the format of the local database?
Thanks

Hi,
You can try to crete a trigger logon on schema like below:
create or replace trigger trg_date_format
after logon on schema
begin
  execute immediate 'alter session set nls_date_format=''YYYY-MM-DD HH:MI:SS''';
end;Cheers

Similar Messages

  • Unique or primary key on timestamp with timezone

    Hi,
    I have been experimenting with a date column in a primary key, or actually I tried using a timestamp with time zone in a primary key.
    While researching whether there was a way to avoid ORA-02329, I found the following:
    K15> create table dumdum
      2    (datum date not null
      3    ,naamp varchar2( 30 ) not null);
    Table created.
    K15>
    K15> alter table dumdum
      2    add constraint d_pk
      3        primary key
      4          (datum, naamp)
      5    using index;
    Table altered.
    K15>
    K15> select ind.index_type
      2  from   user_indexes ind
      3  where  ind.index_name = 'D_PK';
    INDEX_TYPE
    NORMAL
    1 row selected.
    K15>
    K15> insert into dumdum
      2    (datum
      3    ,naamp )
      4  select sysdate - (level/1440)
      5  ,      'nomen nescio'
      6  from   dual
      7  connect by level < 1000
      8  ;
    999 rows created.
    K15>
    K15> analyze index d_pk validate structure;
    Index analyzed.
    K15> analyze table dumdum compute statistics;
    Table analyzed.
    K15>
    K15> select naamp
      2  from   dumdum
      3  where  datum > to_date('16-06-2011 15.46.16', 'dd-mm-yyyy hh24.mi.ss' )
      4 
    K15> For the last select statement I get the following "explain plan":
    SELECT STATEMENT  CHOOSE
              Cost: 2  Bytes: 247  Cardinality: 13       
         1 INDEX RANGE SCAN UNIQUE D_PK
                    Cost: 3  Bytes: 247  Cardinality: 13  This behavior lived up to my expectations.
    Then, I tried this:
    K15> create table dumdum
      2    (datum date not null
      3    ,naamp varchar2( 30 ) not null);
    Table created.
    K15>
    K15> alter table dumdum
      2    add constraint d_pk
      3        primary key
      4          (datum, naamp)
      5    using index;
    Table altered.
    K15>
    K15> alter table dumdum
      2        modify datum timestamp(6) with time zone;
    Table altered.
    K15>
    K15> select ind.index_type
      2  from   user_indexes ind
      3  where  ind.index_name = 'D_PK';
    INDEX_TYPE
    NORMAL
    1 row selected.
    K15>
    K15> insert into dumdum
      2    (datum
      3    ,naamp )
      4  select sysdate - (level/1440)
      5  ,      'nomen nescio'
      6  from   dual
      7  connect by level < 1000
      8  ;
    999 rows created.
    K15>
    K15> analyze index d_pk validate structure;
    Index analyzed.
    K15> analyze table dumdum compute statistics;
    Table analyzed.
    K15>
    K15> select naamp
      2  from   dumdum
      3  where  datum > to_date('16-06-2011 15.46.16', 'dd-mm-yyyy hh24.mi.ss' )
      4
    K15> So, at first glance, the alter table statement to change the datatype from DATE to TIMESTAMP seems like a way of fooling Oracle. But the explain plan reveals a different story:
    SELECT STATEMENT  CHOOSE
              Cost: 4  Bytes: 1,25  Cardinality: 50       
         1 TABLE ACCESS FULL DUMDUM
                    Cost: 4  Bytes: 1,25  Cardinality: 50  I was only fooling myself. :-0
    But I wasn't done with my research:
    K15> create table dumdum
      2    (datum timestamp(6) with time zone not null
      3    ,naamp varchar2( 30 ) not null);
    Table created.
    K15>
    K15> create unique index d_ind
      2      on dumdum
      3           (datum, naamp);
    Index created.
    K15>
    K15>
    K15> select ind.index_type
      2  from   user_indexes ind
      3  where  ind.index_name = 'D_IND';
    INDEX_TYPE
    FUNCTION-BASED NORMAL
    1 row selected.
    K15>
    K15> insert into dumdum
      2    (datum
      3    ,naamp )
      4  select systimestamp - (level/1440)
      5  ,      'nomen nescio'
      6  from   dual
      7  connect by level < 1000
      8  ;
    999 rows created.
    K15>
    K15> analyze index d_ind validate structure;
    Index analyzed.
    K15> analyze table dumdum compute statistics;
    Table analyzed.
    K15>
    K15> select naamp
      2  from   dumdum
      3  where  datum > to_date('16-06-2011 15.56.16', 'dd-mm-yyyy hh24.mi.ss' )
      4
    K15>Now, my explain plan looks fine:
    SELECT STATEMENT  CHOOSE
              Cost: 2  Bytes: 1,25  Cardinality: 50       
         1 INDEX RANGE SCAN UNIQUE D_IND
              Cost: 3  Bytes: 1,25  Cardinality: 50  Why is Oracle so adamant about not allowing a timestamp with time zone in a unique key? And, given their position on the matter, where does their tolerance for a unique index come from?
    By the way, if I had a say in it, I would not allow anything that even remotely looks like a date to be part of a primary key, but that's another discussion.
    Thanks,
    Remco
    P.S. All this is on Oracle9i Enterprise Edition Release 9.2.0.8.0. Is it different on 10g or 11g?

    See if this helps. You can create primary key for TIMESTAMP WITH LOCAL TIME ZONE datatype.
    SQL>CREATE TABLE Mytimezone(Localtimezone TIMESTAMP WITH LOCAL TIME ZONE primary key, Location varchar2(20) );
    Table created.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14225/ch4datetime.htm#i1006169
    TIMESTAMP WITH LOCAL TIME ZONE Datatype
    TIMESTAMP WITH LOCAL TIME ZONE is another variant of TIMESTAMP. It differs from TIMESTAMP WITH TIME ZONE as follows: data stored in the database is normalized to the database time zone, and the time zone offset is not stored as part of the column data. When users retrieve the data, Oracle returns it in the users' local session time zone. The time zone offset is the difference (in hours and minutes) between local time and UTC (Coordinated Universal Time, formerly Greenwich Mean Time).
    Thanks
    http://swervedba.wordpress.com/

  • Inserting Current Date with time stamp in oracle database

    Hi Experts,
                     I want to insert the current Date and time stamp in a field in the Oracle Database Table.
    I am able to insert date but i am not able to insert the date with time stamp. Any Suggestions??
    Thanks
    Naveen

    Naveen,
    Do you want to get current date (from sysdate) with a specific format or transform a value containing a date/time value to insert it in ORACLE ?
    Usually, you insert current datetimestamp in a date field using this :
    TO_DATE(sysdate,'dd/mm/yyyy hh:mi:ss')
    you may have to tweak the format pattern ('dd/mm....') according to your needs
    if you want to transform a date, use something like this:
    TO_DATE(your_date,your_format)
    but make sure your format is compliant with your date, ie
    TO_DATE('31/12/2008','MM/DD/YYYY') could raise error (litteral does not match) cuz ORACLE can't recognize 31 as a month pattern
    Chris

  • Create table interval partition on a column timestamp with local time zone

    Hi
    Does anyone have an example for 11g on how to create a table with interval partitioning on a column defined as timestamp with local time zone. I know it's possible. the following does not work.
    CREATE TABLE KOMODO_EXPIRED_RESULTS
    TEST_EVENT_KEY NUMBER NOT NULL,
    HPS_DEVICE_KEY NUMBER NOT NULL,
    RCS_DEVICE_KEY NUMBER,
    EVENT_START_TIMESTAMP TIMESTAMP(6) with local time zone NOT NULL,
    BOOTROMVERSION NUMBER,
    CHANNELNUMBER NUMBER,
    CLIENTVERSION VARCHAR2(4000 BYTE),
    ETHERNET_CRC_ERROR_COUNT NUMBER,
    ETHERNET_DROPPED_PACKETS NUMBER,
    ETHERNET_THROUGHPUT NUMBER,
    ETHERNET_TRAFFIC_IN NUMBER,
    ETHERNET_TRAFFIC_OUT NUMBER,
    IPADDRESS VARCHAR2(4000 BYTE),
    KOMODO_ID VARCHAR2(4000 BYTE),
    LASTREBOOTTIME VARCHAR2(4000 BYTE),
    OSVERSION VARCHAR2(4000 BYTE),
    RECEIVER_AUDIOACCESSCONTROLER NUMBER,
    RECEIVER_AUDIOBUFFEROVERFLOWS NUMBER,
    RECEIVER_AUDIOBUFFERUNDERRUNS NUMBER,
    RECEIVER_AUDIOCODEC VARCHAR2(4000 BYTE),
    RECEIVER_AUDIODATADROPPED NUMBER,
    RECEIVER_AUDIODATATHROUGHPUT NUMBER,
    RECEIVER_AUDIODECODERERRORS NUMBER,
    RECEIVER_AUDIODESCBUFFERUNDER NUMBER,
    RECEIVER_AUDIODESCCRYPTOERROR NUMBER,
    RECEIVER_AUDIODESCDATADROPPED NUMBER,
    RECEIVER_AUDIODESCDATATHROUGH NUMBER,
    RECEIVER_AUDIODESCDECODERERRO NUMBER,
    RECEIVER_AUDIODESCDRMERRORS NUMBER,
    RECEIVER_AUDIODESCPTSDELTA NUMBER,
    RECEIVER_AUDIODESCPTSDELTAHAL NUMBER,
    RECEIVER_AUDIODESCSAMPLESDROP NUMBER,
    RECEIVER_AUDIODSPCRASHES VARCHAR2(4000 BYTE),
    RECEIVER_AUDIOPTSDELTAHAL NUMBER,
    RECEIVER_AUDIOSAMPLESDECODED NUMBER,
    RECEIVER_AUDIOSAMPLESDROPPED NUMBER,
    RECEIVER_AUDIOUNDERRUN NUMBER,
    RECEIVER_BITRATE NUMBER,
    RECEIVER_BUFFEROVERRUN NUMBER,
    RECEIVER_BYTESCCRECEIVED NUMBER,
    RECEIVER_BYTESRECEIVED NUMBER,
    RECEIVER_CHANNEL NUMBER,
    RECEIVER_DECODERSTALL NUMBER,
    RECEIVER_DISCONTINUITIES NUMBER,
    RECEIVER_DISCONTINUITIESPACKE NUMBER,
    RECEIVER_DRIFT NUMBER,
    RECEIVER_DROPPEDPACKETSUNTILR NUMBER,
    RECEIVER_ECMLOOKUPERROR NUMBER,
    RECEIVER_ECMPARSEERRORS NUMBER,
    RECEIVER_PMTCHANGED NUMBER,
    RECEIVER_REBUFFER NUMBER,
    RECEIVER_SELECTCOMPONENTAUDIO NUMBER,
    RECEIVER_TIMELINEDISCONTINUIT NUMBER,
    RECEIVER_VIDEOACCESSCONTROLER NUMBER,
    RECEIVER_VIDEOACCESSCONTROLUN NUMBER,
    RECEIVER_VIDEOBUFFEROVERFLOWS NUMBER,
    RECEIVER_VIDEOBUFFERUNDERRUNS NUMBER,
    RECEIVER_VIDEOCODEC VARCHAR2(4000 BYTE),
    RECEIVER_VIDEOCRYPTOERROR NUMBER,
    RECEIVER_VIDEODATADROPPED NUMBER,
    RECEIVER_VIDEODATATHROUGHPUT NUMBER,
    RECEIVER_VIDEODECODERERRORS NUMBER,
    RECEIVER_VIDEODRMERRORS NUMBER,
    RECEIVER_VIDEODSPCRASHES VARCHAR2(4000 BYTE),
    RECEIVER_VIDEOFIFORD NUMBER,
    RECEIVER_VIDEOFIFOSIZE NUMBER,
    RECEIVER_VIDEOFRAMESDECODED NUMBER,
    RECEIVER_VIDEOFRAMESDROPPED NUMBER,
    RECEIVER_VIDEOPTSDELTA NUMBER,
    RECEIVER_VIDEOPTSDELTAHAL NUMBER,
    RECEIVER_VIDEOUNDERRUN NUMBER,
    SUBNETMASK VARCHAR2(4000 BYTE),
    TUNER_BITRATE NUMBER,
    TUNER_BUFFERFAILURE NUMBER,
    TUNER_CCPACKETSRECEIVED NUMBER,
    TUNER_CHANNEL NUMBER,
    TUNER_DATATIMEOUTS NUMBER,
    TUNER_DELIVERYMODE VARCHAR2(4000 BYTE),
    TUNER_DROPPAST NUMBER,
    TUNER_FILL NUMBER,
    TUNER_HOLE NUMBER,
    TUNER_HOLEDURINGBURST NUMBER,
    TUNER_HOLEDURINGBURSTPACKETS NUMBER,
    TUNER_HOLETOOLARGEPACKETS NUMBER,
    TUNER_MAXIMUMHOLESIZE NUMBER,
    TUNER_MULTICASTADDRESS VARCHAR2(4000 BYTE),
    TUNER_MULTICASTJOINDELAY NUMBER,
    TUNER_OUTOFORDER NUMBER,
    TUNER_OVERFLOWRESET NUMBER,
    TUNER_OVERFLOWRESETTIMES NUMBER,
    TUNER_PACKETSEXPIRED NUMBER,
    TUNER_PACKETSPROCESSED NUMBER,
    TUNER_PACKETSRECEIVED NUMBER,
    TUNER_PACKETSWITHOUTSESSION NUMBER,
    TUNER_PARSEERRORS NUMBER,
    TUNER_SRCUNAVAILABLERECEIVED NUMBER,
    TUNER_TOTALHOLEPACKETS NUMBER,
    TUNER_TOTALPACKETSEXPIRED NUMBER,
    TUNER_TOTALPACKETSRECEIVED NUMBER,
    TUNER_UNICASTADDRESS VARCHAR2(4000 BYTE),
    RECEIVER_TUNEDFOR NUMBER,
    MACADDRESS VARCHAR2(4000 BYTE),
    RECEIVER_TOTALAVUNDERRUNS NUMBER,
    RECEIVER_TOTALDISCONTINUITIES NUMBER,
    SERVICEID VARCHAR2(4000 BYTE),
    DRIVEPRESENT VARCHAR2(4000 BYTE),
    STB_STATE VARCHAR2(32 BYTE),
    PREV_EXPIRED NUMBER,
    PREV_HOLES NUMBER,
    PREV_RECEIVED NUMBER,
    PREV_TIMESTAMP TIMESTAMP(6),
    PREV_REBOOT VARCHAR2(4000 BYTE),
    TOTALPACKETSEXPIRED_RATE NUMBER,
    TOTALHOLEPACKETS_RATE NUMBER,
    TOTALPACKETSRECEIVED_RATE NUMBER,
    CONSTRAINT KOMODO_EXPIRED_RESULTS_PK
    PRIMARY KEY
    (HPS_DEVICE_KEY, EVENT_START_TIMESTAMP)
    USING INDEX
    TABLESPACE HPS_SUMMARY_INDEX
    TABLESPACE HPS_SUMMARY_DATA
    PARTITION BY RANGE (EVENT_START_TIMESTAMP)
    INTERVAL( NUMTODSINTERVAL(1,'DAY'))
    PARTITION DEFAULT_TIME_PART_01 VALUES LESS THAN (TIMESTAMP' 2010-08-01 00:00:00.000000000 +00:00')
    LOGGING
    COMPRESS FOR ALL OPERATIONS
    TABLESPACE HPS_SUMMARY_DATA
    NOCACHE
    PARALLEL ( DEGREE DEFAULT INSTANCES DEFAULT )
    MONITORING
    /

    I am not sure it can be done.
    SQL> create table sales
      2  (
      3  sales_id number,
      4  sales_dt TIMESTAMP(6) with local time zone NOT NULL
      5  )
      6  partition by range (sales_dt)
      7  interval (numtoyminterval(1,'MONTH'))
      8  ( partition p0901 values less than (to_date('2009-02-01','yyyy-mm-dd')) );
    create table sales
    ERROR at line 1:
    ORA-14751: Invalid data type for partitioning column of an interval partitioned
    table
    SQL> ed
    Wrote file afiedt.buf
      1  create table sales
      2  (
      3  sales_id number,
      4  sales_dt TIMESTAMP(6)
      5  )
      6  partition by range (sales_dt)
      7  interval (numtoyminterval(1,'MONTH'))
      8* ( partition p0901 values less than (to_date('2009-02-01','yyyy-mm-dd')) )
    SQL> /
    Table created.

  • Usage of java.sql.Timestamp with classes12.zip and ojdbc14.jar  ?

    Hi all,
    If i'm using java.sql.Timestamp with classes12 it is functioning perfectly,
    if i'm using ojdbc14 and java.sql.Timestamp it is functioning in different way and failing to do the action..
    Example : update set xxx=yy where time = my Timestamp object set in Prepared statement
    Hope to see the answer

    http://forum.java.sun.com/thread.jspa?threadID=460615&messageID=2116517
    Timestamp insert problem
    Using the "classes12.zip" file that comes with the distribution for Oracle versions 8.1.6.x and 8.1.7.x, Oracle's DATE datatype is mapped to the "java.sql.Timestamp" class. However, the "ojdbc14.jar" driver maps DATE to "java.sql.Date", and "java.sql.Date" only holds a date (without a time), whereas "java.sql.Timestamp" holds both a date and a time.

  • Converting timestamp with timezone to milisecs

    Hi guys,
    How to converting timestamp with timezone to milisecs?
    I'm using oracle 10g.

    SeánMacGC wrote:
    Hello, do you mean:
    SQL> select to_char(systimestamp, 'SSSSS') from dual;
    TO_CH
    58435
    'SSSSS' Format Model returns 'Seconds past midnight' not milliseconds. I wonder if OP meant Fractional Seconds?
    SQL> SELECT TO_TIMESTAMP_TZ('1999-12-01 11:00:00.00532 -8:00',
      2         'YYYY-MM-DD HH:MI:SS.FF TZH:TZM') col_1 FROM DUAL
      3  /
    COL_1
    01-DEC-99 11.00.00.005320000 AM -08:00
    SQL> SELECT TO_CHAR(col_1, 'FF') fractional_sec FROM
      2  (SELECT TO_TIMESTAMP_TZ('1999-12-01 11:00:00.00532 -8:00',
      3         'YYYY-MM-DD HH:MI:SS.FF TZH:TZM') col_1 FROM DUAL)
      4  /
    FRACTIONA
    005320000
    SQL>Regards,
    Jo
    Edited by: Joice John : Added Code Tags

  • Regarding timestamp with timezone

    Hi,
    I have the following timestamp with timezone issue.
    From java program I am passing the datetime with timezone value to database (INTERVALTIME (column name)).
    PrepareStatemenet statement;
    java.util.Date dt = ISODateUtil.parse("2006-06-21T18:00:00+00:00");
    SimpleTimeZone zone = new SimpleTimeZone(0,"IST");
    Calendar cal = converting the dt to calendar;
    cal.setTimeZone(zone);
    statement.setTimestamp(col, new Timestamp(cal.getTimeInMillis()),cal);     
    In database INTERVALTIME (column name) coulmn type is TiMESTAMP WITH TIMEZONE.Database is in PDT (GMT-8) timezone.
    Now the problem is :
    Even if i send the datetime of IST timezone, it is displaying in PDT (GMT-8) timezone.
    How can i resolve this issue?

    Reo wrote:
    The query you provided doesn't run. If I want to convert to a different timezone, I need the from_tz.Is column update_time a TIMESTAMP WITH TIME ZONE? If so, then no casting is needed:
    SQL> create table test(id number,update_time timestamp with time zone)
      2  /
    Table created.
    SQL> insert into test values(1,systimestamp)
      2  /
    1 row created.
    SQL> insert into test values(2,systimestamp  at time zone 'UTC')
      2  /
    1 row created.
    SQL> select  id,
      2          update_time,
      3          update_time at time zone 'US/Pacific'
      4    from test
      5  /
            ID
    UPDATE_TIME
    UPDATE_TIMEATTIMEZONE'US/PACIFIC'
             1
    18-NOV-09 04.23.03.241000 PM -05:00
    18-NOV-09 01.23.03.241000 PM US/PACIFIC
             2
    18-NOV-09 09.23.29.346000 PM UTC
    18-NOV-09 01.23.29.346000 PM US/PACIFIC
            ID
    UPDATE_TIME
    UPDATE_TIMEATTIMEZONE'US/PACIFIC'
    SQL> SY.

  • OCCI Fractional time insertion using Timestamp class

    Hello,
    On linux with oracle 10g, I modified the demo app occidml to insert a Timestamp into a table. I print the factional time from the timestamp after it is created to verify that indeed it is the correct value. However, when I query the database using SQL, I find that the fractional time component didn't get inserted. Any ideas on how to resolve this would be highly appreciated.
    Here is the code snippet for inserting the timestamp..
    string sqlStmt = "INSERT INTO author_ag VALUES (:x, :y)";
    stmt=conn->createStatement (sqlStmt);
    try{
    Timestamp ts(env, 2008,9,10,11,12,13, c1);
    uint h,m,s,f;
    ts.getTime(h, m, s, f);
    stmt->setTimestamp (1, ts);
    stmt->setString (2, c2);
    stmt->executeUpdate ();
    cout << "insert - Success" << c1 << " " << f << endl;
    }catch(SQLException ex)
    cout<<"Exception thrown for insertBind"<<endl;
    cout<<"Error number: "<< ex.getErrorCode() << endl;
    cout<<ex.getMessage() << endl;
    I see the following output:
    insert - Success222 222
    The database table is as follows:
    SQL> desc author_ag
    Name Null? Type
    TS TIMESTAMP(3)
    AUTHOR_NAME VARCHAR2(25)

    My mistake. Didn't realize the fractional time had to be specified as NanoSeconds.

  • How to insert a table with variable rows in smart form

    Hi all,
    How to insert a table with variable rows in smart form?
    Any help would be appreciated.
    Regards,
    Mahesh.

    Hi,
    Right click the mouse->create->table
    If you want 5 columns, you need to declare 5 cells in one line type of the table
    Click on Table -> Details, then do the following
    Line Type 1 2 3 4 5
    L1 2mm 3mm etc
    Here specify the width of the columns as many as you want..
    then in the header/main area of the table, click create Table Line, Rowtype is L1, automatically 5 cells will come,In each cell create a text element, display the variable to be printed there.

  • How to insert a logo with final cut express 4?

    How to insert a logo with final cut express 4? like this
    http://www.milano.nl/sbs6_2005.jpg

    I'm not certain, but I think, if there's not a background color saved as part of the original file, you'll retain the transparency. Give it a try.
    What application are you using to create the original file?

  • Is it possible to create a timestamp with an accuracy of 1ms?

    I want to acquire data with PCI-6023 and write them with a precise timestamp to a file. Is it possible to create a timestamp with an accuracy of 1ms?
    Maybe somebody can tell me experiences with logging data over a time periode up to 24 hours (and time-accuracy of 1ms)?

    Hi Hans, This forum is related to one of National Instruments' automation products rather than data aquisition. Perhaps you will acheive better results if you post your question to one of the "Measurement Devices" forms instead.

  • How do I insert a section with another time signature than the one im inser

    How do I insert a section with another time signature than the one im inser

    Yeah I've been trying to figure this out as well, for example... my song might be 90 bpm and I want to program another track using midi but have it play at 180 bpm. The only way I've found to work around this is to write my 180 bpm part make a sample of this and then loop this into the 90 bpm song.

  • Partitioning on a table on the field TIMESTAMP WITH TIME ZONE

    Hi I have a very large size table which has grown to a size that we are not able to query it efficiently. We have decided to partition the table. But the issue is the table has a TIMESTAMP WITH TIME ZONE field and not DATE. I have found some links on the web which state this might cause an error. I am planning to create a temp table with the partition rules and at the same time copy data from the original one.
    using CREATE TABLE XYZ PARTITION BY RANGE (ABC) ( ---- Partition rules ------) NOLOGGING AS SELECT * FROM XYZ_ACTUAL where 1 = 2;
    Then if it works fine, I would rename the table with partitions to the actual name.
    Should all this be fine?
    The database is very critical. Hence the dilemma.

    Have you tried converting the timestamp with time zone to a character string as a partition key, possibly using an edit mask to control the timestamp components used?
    Your plan sounds OK to me - if you can get the partitioned table created - but I would test in a development first o see where the lLw of Unintended Consequences might decide to manifest itself.
    Edited by: riedelme on Dec 8, 2009 9:13 AM

  • Oracle ODBC driver and TIMESTAMP with timezone

    Does anyone know if it is possible to return data from a "TIMESTAMP WITH TIMEZONE" column using the Oracle ODBC driver and an ADO Recordset?
    I am using the Oracle driver version 10.2.0.2 and TIMESTAMP fields work fine.
    I can call Recordset->Open() with a query like "SELECT * FROM TABLE" when the table contains a column of type timestamp with timezone but when I execute a statement to see if there are results as in
    if (!(srcRecsetPtr->BOF && srcRecsetPtr->EndOfFile))
    my application throws an unhandled exception and exits. The exception is not a COM exception and I'm not sure how to get back additional information if that's possible.
    The only information I've been able to find in searching TechNet and MetaLink is that a workaround is to wrap the columns in a TO_CHAR or TO_DATE conversion first but that's not a good solution for my problem since I am executing user specified SQL which may join multiple tables.
    I've found one other note that says the documentation should be corrected and that these fields are NOT supported period (Bug #4011640).
    I've experimented with the Bind Timestamp as Date option in the ODBC connection and with various ALTER SESSION settings to attempt to change the NLS_TIMESTAMP_TZ_FORMAT but I have been unable to get past the problem.
    Any ideas are greatly appreciated.
    Thanks,
    Troy

    Hi Justin
    Thanks for your help.
    I tried what you mentioned and I could connect myself via SQL*Plus without passing a password and a login, Extern authentification seems to work and my user seems to be right configurated.
    But he problem goes on via ODBC. When I test connection in the ODBC Data Source Administrator of Windows XP, test fails and seems to forbid connection without userID and password. When I try to connect via ODBC in my program the same problem appears : "Unable to connect SQLSTATE=28000 [Oracle][ODBC][ORA]Ora-01017: Invalid username/password;logon denied" I could not connect in this way.. What's wrong ?

  • Create a timestamp with current_timestamp but keeping the seconds as 00

    Hi Everyone,
    I was wondering if there is an easier/better way to use the current_timestamp as my base timestamp and display another timestamp with current time and the seconds as 00. E.g., 4:30:00. The below is working but I am thinking it is overly complex.
    CAST('timestamp' || ' ' || char(39) || TRIM(CAST(YEAR(CURRENT_DATE) AS CHAR)) || '-' ||
    CASE WHEN MONTH(CURRENT_DATE) = '1' THEN '01'
    WHEN MONTH(CURRENT_DATE) = '2' THEN '02'
    WHEN MONTH(CURRENT_DATE) = '3' THEN '03'
    WHEN MONTH(CURRENT_DATE) = '4' THEN '04'
    WHEN MONTH(CURRENT_DATE) = '5' THEN '05'
    WHEN MONTH(CURRENT_DATE) = '6' THEN '06'
    WHEN MONTH(CURRENT_DATE) = '7' THEN '07'
    WHEN MONTH(CURRENT_DATE) = '8' THEN '08'
    WHEN MONTH(CURRENT_DATE) = '9' THEN '09'
    ELSE CAST(MONTH(CURRENT_DATE) AS CHAR) END || '-' ||
    CASE WHEN DAYOFMONTH(CURRENT_DATE) = '1' THEN '01'
    WHEN DAYOFMONTH(CURRENT_DATE) = '2' THEN '02'
    WHEN DAYOFMONTH(CURRENT_DATE) = '3' THEN '03'
    WHEN DAYOFMONTH(CURRENT_DATE) = '4' THEN '04'
    WHEN DAYOFMONTH(CURRENT_DATE) = '5' THEN '05'
    WHEN DAYOFMONTH(CURRENT_DATE) = '6' THEN '06'
    WHEN DAYOFMONTH(CURRENT_DATE) = '7' THEN '07'
    WHEN DAYOFMONTH(CURRENT_DATE) = '8' THEN '08'
    WHEN DAYOFMONTH(CURRENT_DATE) = '9' THEN '09'
    ELSE CAST(DAYOFMONTH(CURRENT_DATE) AS CHAR) END || ' ' ||
    TRIM(CASE WHEN HOUR(CURRENT_TIMESTAMP) = '1' THEN '01'
    WHEN HOUR(CURRENT_TIMESTAMP) = '2' THEN '02'
    WHEN HOUR(CURRENT_TIMESTAMP) = '3' THEN '03'
    WHEN HOUR(CURRENT_TIMESTAMP) = '4' THEN '04'
    WHEN HOUR(CURRENT_TIMESTAMP) = '5' THEN '05'
    WHEN HOUR(CURRENT_TIMESTAMP) = '6' THEN '06'
    WHEN HOUR(CURRENT_TIMESTAMP) = '7' THEN '07'
    WHEN HOUR(CURRENT_TIMESTAMP) = '8' THEN '08'
    WHEN HOUR(CURRENT_TIMESTAMP) = '9' THEN '09'
    ELSE CAST(HOUR(CURRENT_TIMESTAMP) AS CHAR) END) || ':' ||
    TRIM(CASE WHEN MINUTE(CURRENT_TIMESTAMP) = '1' THEN '01'
    WHEN MINUTE(CURRENT_TIMESTAMP) = '2' THEN '02'
    WHEN MINUTE(CURRENT_TIMESTAMP) = '3' THEN '03'
    WHEN MINUTE(CURRENT_TIMESTAMP) = '4' THEN '04'
    WHEN MINUTE(CURRENT_TIMESTAMP) = '5' THEN '05'
    WHEN MINUTE(CURRENT_TIMESTAMP) = '6' THEN '06'
    WHEN MINUTE(CURRENT_TIMESTAMP) = '7' THEN '07'
    WHEN MINUTE(CURRENT_TIMESTAMP) = '8' THEN '08'
    WHEN MINUTE(CURRENT_TIMESTAMP) = '9' THEN '09'
    ELSE CAST(MINUTE(CURRENT_TIMESTAMP) AS CHAR) END) || ':00' ||
    char(39) AS TIMESTAMP)
    Thanks in advance for any comments
    Edited by: user10930658 on Mar 25, 2009 2:05 PM

    timestampadd(SQL_TSI_SECOND, -second(current_timestamp ), current_timestamp )

Maybe you are looking for

  • Transaction SOLMAN_SET does not exist

    Hi All, I have installed SMD agent  in one if the R/3 System's and trying to configure that managed system in solution manager .As per the document we need to configure managed system from transaction SOLMAN_SETUP. But the txn SOLMAN_SETUP does  not

  • Convert ABAP to Java

    Hello everyone, right now i have an ABAP-function-module which i have to convert into Java-Code. My problem is: i don't really understand ABAP so i have some questions. The part which i don't understand is this: READ TABLE t_ctab INDEX f_char.     IF

  • How to use  mmpur_remove_messages_by_id  ?

    sap ver. 4.7 badi  ME_PURCHDOC_POSTED transction  : me32k how to use  mmpur_remove_messages_by_id  ? what is the parameter (im_id)  that i have to add ? i am using "MMPUR_MESSAGE_FORCED"  to add error message  , it look like it do the job , but after

  • ERRATIC HOME WIFI CONNECTION

    I find that I am almost always using my 4G connection at home, versus my Wi-Fi. My laptop and tablet don't seem to have this problem, just my S3. I am spending a lot of time shutting off/restarting my phone,. turning wi-fi on/off, re-entering passwor

  • SAP CRM Groupware Integration - Create appointments on mobile phone.

    Hi all We have implemented the serverside groupware integration with CRM 2007 and Exchange. Usually the appointments in Outlook are created with category "CRM_ACT_001". Unfortunately some Mobile Phones (like the iPhone) are not able to set the catego