How to convert bigint to datetime in Oracle

Hi, I'm using Oracle database for xmeta and iadb for Information Analyzer. Both in db2 and oracle the timestamp of Rule execution is stored only as bigint. Am able to convert bigint to datetime in db2 and not in Oracle.

Which part of "Do not post product related questions here" in the forum title did you miss?
Please post your question in the appropriate forum.
locking this thread

Similar Messages

  • How to convert raw to number in oracle 8

    Does anyone know how to convert a raw data to number format ???
    If i do: select dump(50,16) from dual, it will return bytes c1 33.
    With this bytes in a raw variable, how can i convert it to a number variable in Oracle 8.
    PS: Oracle 8 doesn't have utl_raw.cast_to_number function...
    Thanx.

    Thanx for help... But...
    This examples are very usefull, but only converts a value in HEX to number.
    In my case, i need a routine that convert the bytes of value 50 (i.e. 2 bytes -> C1 33) into a number variable. If i only use hex to number, will return wrong value. I need to convert this bytes (C1 33) into original number, i mean, value 50.
    Using dump function for 50, will return C1 33...
    How can i make to convert C1 33 back to value 50??
    I think that is the same of the utl_raw.cast_to_number, but i'm using Oracle 8, and this function is in Oracle 9...
    Anyone have idea ??

  • How to convert varchar to BLOB in oracle 10g?

    Hi all,
    I have 2 columns A and B which are of varchar2(2000) dataype.
    I would like to concatinate these 2 columns and convert them into BLOB in oracle 10g.
    Any help is appreciated.
    Regards,
    Ravi

    don't use BLOB to store large text, use CLOB instead
    anyway:
    SQL> create table test
      2  (txt varchar2(10)
      3  ,other varchar2(10)
      4  );
    Table created.
    SQL>
    SQL> insert into test values ('some text', 'other text');
    1 row created.
    SQL>
    SQL> create table test2
      2  (col blob)
      3  /
    Table created.
    SQL>
    SQL> insert into test2
      2  select utl_raw.cast_to_raw (txt||other)
      3    from test
      4  /
    1 row created.
    SQL> select *
      2    from test2
      3  /
    SP2-0678: Column or attribute type can not be displayed by SQL*Plus
    SQL>
    SQL> select utl_raw.cast_to_varchar2(col)
      2    from test2
      3  /
    UTL_RAW.CAST_TO_VARCHAR2(COL)
    some textother text
    SQL>
    SQL> drop table test
      2  /
    Table dropped.
    SQL> drop table test2
      2  /
    Table dropped.

  • How to convert HTTP to HTTPS in Oracle Application Server 10g(10.1.3)

    Can you please suggest notes to convert HTTP to HTTPS in Oracle Application Server 10g(10.1.3) as we need this to integrate the custom apps with EBS(12.1.3)?
    Appreciate your quick response,
    RM

    For Oracle EBS R12, the docs provided above should be helpful. If you want to configure the application server with SSL (assuming you have 10gAS installed), please refer to Oracle AS10g documentation -- Secure Sockets Layer (SSL)
    Oracle Application Server 10g Release 3 Documentation
    http://www.oracle.com/technetwork/middleware/ias/documentation/index.html
    Secure Sockets Layer (SSL)
    http://download.oracle.com/docs/cd/B25221_04/core.1013/b25209/part4.htm#BEHBDFGD
    Thanks,
    Hussein

  • ORA-01841 Converting SQL Server DateTime to Oracle Date

    I have Oracle 11gR2 x64 running on my Win7 Enterprise x64 personal system. I'm trying to convert the TSQL to create a database in SQL Server 2008 Express for my C# class to Oracle, and I've run into a "interesting" problem loading date data.
    The SQL Server 2008 TSQL InvoiceDate column in the Invoices table has datatype DATETIME:
    *[InvoiceDate] [datetime] NOT NULL,*
    which Oracle does not support. The Oracle InvoiceDate column in the MMAB_Invoices table has datatype DATE:
    InvoiceDate DATE NOT NULL,
    The fun begins with the TSQL INSERT statements (for example):
    INSERT [dbo].[Invoices] ([InvoiceID], [CustomerID], [InvoiceDate], [ProductTotal], [SalesTax], [Shipping], [InvoiceTotal]) VALUES (18, 20, CAST(0x00009CFD00000000 AS DateTime), 151.0000, 11.3300, 6.2500, 168.5800)
    As you can see, whoever wrote the load script thought it would be totally awesome to convert hex (binary?) data to generate a date, instead of using data readable by a human being.
    BTW, the date generated is 2010-01-13 00:00:00.000.
    After Reading The Fabulous Manual and searching the OTN Discussion Fora, what I came up with is
    INSERT INTO MMAB_Invoices (CustomerID, InvoiceDate, ProductTotal, SalesTax, Shipping, InvoiceTotal) VALUES (20, TO_DATE(UTL_RAW.CAST_TO_VARCHAR2(HEXTORAW('00009CFD00000000')), 'YYYY-MM-DD HH:MI:SS'), 151.0000, 11.3300, 6.2500, 168.5800);
    which returned
    Error starting at line 846 in command:
    INSERT INTO MMAB_Invoices (CustomerID, InvoiceDate, ProductTotal, SalesTax, Shipping, InvoiceTotal) VALUES (20, TO_DATE(UTL_RAW.CAST_TO_VARCHAR2(HEXTORAW('00009CFD00000000')), 'YYYY-MM-DD HH:MI:SS'), 151.0000, 11.3300, 6.2500, 168.5800)
    Error report:
    SQL Error: ORA-01841: (full) year must be between -4713 and +9999, and not be 0
    *01841. 00000 - "(full) year must be between -4713 and +9999, and not be 0"*
    **Cause: Illegal year entered*
    **Action: Input year in the specified range*
    The PK InvoiceID is automatically generated by a BEFORE INSERT trigger that uses a sequence.
    Suggestions?
    Thanks.
    P.S. Happy New Year!!!

    Your hex conversion is certainly not returning a date format:
    sql> select UTL_RAW.CAST_TO_VARCHAR2(HEXTORAW('00009CFD00000000')) from dual;
    UTL_RAW.CAST_TO_VARCHAR2(HEXTORAW('00009CFD00000000'))
      ┐²To convert the hex number to decimal, simply use to_number:
    sql> select to_number('00009CFD00000000', 'xxxxxxxxxxxxxxxx') from dual;
    TO_NUMBER('00009CFD00000000','XXXXXXXXXXXXXXXX')
                                          1.7261E+14Now, before you can make any further calculations with that number, you need to know how it represents the date of 2010-01-13. Luckily, we've got Google nowadays. ;-)
    Sql server representation seems to be an 8 byte field. The first 4 bytes stores the number of days since SQL Server's epoch (1st Jan 1900). The second 4 bytes stores the number of milliseconds after midnight.
    sql> select to_number('00009CFD', 'xxxxxxxxxxxxxxxx') from dual;
    TO_NUMBER('00009CFD','XXXXXXXXXXXXXXXX')
                                       40189
    sql> select to_date('1900-01-01','yyyy-mm-dd') + 40189 from dual;
    TO_DATE('
    13-JAN-10So, the conversion would be something like this:
    sql> select to_date('1900-01-01','yyyy-mm-dd') + to_number(substr('00009CFD00000000',1,8), 'xxxxxxxx') + to_number(substr('00009CFD00000000',9,8), 'xxxxxxxx') / (24*60*60*1000) from dual;
    TO_DATE('
    13-JAN-10Note: Oracle DATE format specifies a datetime up to the second, whereas the sqlserver DATETIME format specifies a datetime up to the millisecond; if that precision is needed, use Oracle's TIMESTAMP instead.
    Note: using an internal representation is risky, implementation details may change. In this case, it seems pretty unlikely that Microsoft will ever change the datetime internal representation, since that would break lots and lots of code.
    Edited by: theoa on 2-jan-2012 9:14

  • Convert SQL SERVER DATETIME into ORACLE TIMESTAMP

    I have to convert a column's datatype.
    The source column's datatype is DATETIME which is in SQL Server to TIMESTAMP(datatype in target which is oracle)
    Can anyone help me please

    Just issue ALTER TABLE MODIFY:
    SQL> create table tbl(c date)
      2  /
    Table created.
    SQL> insert into tbl values(sysdate)
      2  /
    1 row created.
    SQL> select to_char(c,'mm/dd/yyyy hh24:mi:ss') from tbl
      2  /
    TO_CHAR(C,'MM/DD/YY
    12/26/2009 20:50:58
    SQL> alter table tbl modify c timestamp
      2  /
    Table altered.
    SQL> select c from tbl
      2  /
    C
    26-DEC-09 08.50.58.000000 PM
    SQL> SY.

  • How to convert data buffer of type "oracle::occi::OCCI_SQLT_NUM" to double

    Hello All,
    I am using bulk reading by utilizing 'setDataBuffer()' method call and fetching N records at a time.
    It works well for fields of Oracle type VARCHAR, when I set
    h5. rs->setDataBuffer(col, buff, oracle::occi::OCCI_SQLT_CHR, size, lens, inds);
    and later iterating and interpreting data within 'buff' like this:
    h5. char* text = ((char*)buff) + size*i; <-- length is in lens array
    When the column's data type is NUMBER however, I am stuck.
    Indicating that data type to data buffer works well:
    h5. rs->setDataBuffer(col, buff, oracle::occi::OCCI_SQLT_NUM, size, lens, inds);
    I would like now to extract a value of c++ double type from that buffer.
    But I do not have an idea how to handle data within buff. I suppose it should have NUMBER stored inside in some internal format (just as described in Oracle® C++ Call Interface Programmer's Guide, section 'Description of External Datatypes', NUMBER)
    Gestures like casting to double or trying to interpet the buffer's inner as oracle::occi::Number do not produce sensible results.
    Could you help me to understand how can I obtain the double value from that buffer in a bulk read?

    I have the following code which has been working for me.
    showln ("Array Fetch");
    sql = "SELECT c1, c2, c3, c4 FROM nd17_otab";
    stmt->setSQL ( sql );
    OCCIResultSet *rs = stmt->executeQuery();
    rs->setDataBuffer (1, num, OCCIINT, sizeof(ub4), lenC1);
    rs->setDataBuffer (2, flt, OCCIBFLOAT, sizeof(float), lenC2);
    rs->setDataBuffer (3, dbl, OCCIBDOUBLE, sizeof(double), lenC3);
    rs->setDataBuffer (4, str, OCCI_SQLT_CHR, CHRS, lenC4);
    if ( rs->next(ROWS) )
    show ("Number of Rows Fetched: ") << rs->getNumArrayRows () << endl;
    showln ("Fetched Records");
    for (int j = 0; j < ROWS; j++ )
    show ("C1: ") << num[j] << endl;
    show ("C2: ") << flt[j] << endl;
    show ("C3: ") << dbl[j] << endl;
    show ("C4: ") << str[j] << endl;
    stmt->closeResultSet(rs);
    c1, c2, c3, c4 columns in table nd17_otab are of type NUMBER, BINARY_FLOAT, BINARY_DOUBLE & VARCHAR2

  • How to Convert Normal XML date or Oracle date to JDE Julian Date

    We can do a simple mathematical step in XSLT :
    'xpath20:format-dateTime(xpath20:current-dateTime(),"[Y0001][d001]") - 1900000'
    Or in SQL :
    Select to_char(sysdate,'YYYYDDD')-1900000 from dual;
    Julian Date is: Year in 4 digits, YYYY, and Number of days in 3 digits, DDD
    JDE Julian Date is Julian Date -1900000 (ie it counts Julian date from 1900 Year)
    "[Y0001][d001]” returns date in Year in 4 digit + number of days in 3 digits. This is the Julian date.
    Subtracting 1900000 ( ie YR ’1900’ & DAY ‘000’) gives the required JDE Julian Date.
    Edited by: prakash.pankaj on Jul 8, 2011 2:13 PM
    Edited by: prakash.pankaj on Jul 8, 2011 4:02 PM
    Edited by: panks on Jul 20, 2011 3:43 PM

    Hi,
    getTime() (in Date) will give you that date in milliseconds since January 1, 1970 00:00:00 GMT.
    To my knowledege, this is the same as Unix date format.

  • How to insert data type information to oracle database

    Hi, there,
    I want to insert date information to oracle database in a jsp page using JSTL. but always got wrong message:
    javax.servlet.jsp.JspException:
    INSERT INTO DATE_TEST
    (date_default,date_short,date_medium)
    values(?,?,?)
    : Invalid column type
    I don't know how to convert java date type to oracle date type or vice versa. the following is the source code(all the fields of DATE_DEFAULT,DATE_SHORT,DATE_MEDIUM are oracle date type. and even I want to insert d instead d1, I got the same wrong message)
    <%@ page contentType="text/html;charset=windows-1252"%>
    <%@ page import="java.util.*" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
    <%
    Calendar now;
    Calendar rightNow = Calendar.getInstance();
    %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>
    Hello World
    </title>
    </head>
    <body>
    <h2>
    The current time is:
    </h2>
    <p>
    <%= new java.util.Date() %></p>
    <%
    java.util.Date d=new java.util.Date();
    java.sql.Date d1=new java.sql.Date(d.getYear(),d.getMonth(),d.getDate());
    out.print(d1.toString());
    %>
    <sql:update>
    INSERT INTO DATE_TEST
    (DATE_DEFAULT,DATE_SHORT,DATE_MEDIUM)
    VALUES(?,?,?)
    <sql:dateParam value="${d}" type="date" />
    <sql:dateParam value="${d}" type="date" />
    <sql:dateParam value="${d}" type="date" />
    </sql:update>
    </body>
    </html>
    thank you very much for the great help!!

    I don't have time to read thru all your code, but I hope this information will help you.
    It depends on how the Oracle database was set up. Usually, the date format is something like this: '27-MAY-2003 22:10:00'. A quick check will be to run this SQL script in SQLPlus:
    select sysdate from dual;
    You have to convert the date from textbox or whatever to this exact Oracle format. Otherwise, Oracle will not accept it. It is very picky on that. I found the best way is to do the conversion inside the SQL statement. It makes life so much easier.
    Hope this helps.

  • How to convert epoch time to datetime in sql*loader Oracle

    Hello,
    I wan't to question how to convert epoch time to datetime in sql*loader Oracle. I try this script for convert epoch time to datetime in sql*loader, but error:
    Record 1: Rejected - Error on table TEMP_TEST_LANGY, column DATADATA.
    ORA-01722: invalid number
    Record 2: Rejected - Error on table TEMP_TEST_LANGY, column DATADATA.
    ORA-01722: invalid number
    Record 3: Rejected - Error on table TEMP_TEST_LANGY, column DATADATA.
    ORA-01722: invalid number
    This is my loader:
    LOAD DATA INFILE 'C:\Documents and Settings\Administrator\My Documents\XL_EXTRACT_211\load.csv'
    into table TEMP_TEST_LANGY append
    FIELDS TERMINATED BY ','
    TRAILING NULLCOLS
    DATADATA CHAR "TO_DATE('01-JAN-1970','DD-MON-YYYY')+:datadata/86400"
    This is my csv file:
    79314313.7066667
    79314336.2933333
    79314214.3466667
    This is my table:
    CREATE TABLE TEMP_TEST_LANGY
    DATADATA DATE
    Thanks
    Edited by: xoops on Sep 21, 2011 8:56 AM
    Edited by: xoops on Sep 21, 2011 8:58 AM

    thanks for your answer, but I asked to use sql loader instead of the external table, which so my question is why can not the epochtime converted to datetime, if there is no way to convert a datetime epochtime using sql loader, so I'm required to use the external table. thank you.
    This is my error log:
    Column Name Position Len Term Encl Datatype
    DATADATA FIRST * , CHARACTER
    SQL string for column : "TO_DATE('1-Jan-1970 00:00:00','dd-MM-YYYY hh24:mi:ss') + (:DATADATA/60/60/24)"
    Record 1: Rejected - Error on table TEMP_TEST_LANGY, column DATADATA.
    ORA-01722: invalid number
    Record 2: Rejected - Error on table TEMP_TEST_LANGY, column DATADATA.
    ORA-01722: invalid number
    Record 3: Rejected - Error on table TEMP_TEST_LANGY, column DATADATA.
    ORA-01722: invalid number
    Edited by: xoops on Sep 21, 2011 12:33 PM

  • Proc C - How to convert datetime variable in Proc C into C?

    Hi,
    Does anyone know how to convert a datetime variable in Pro C into C?
    For Example,
    Order_Table with OrderId and OrderDate fields.
    How do I compare the OrderDate with the system datetime in Pro C or C?
    Thank you.

    Maybe this will help:
    http://asktom.oracle.com/~tkyte/Misc/CTime.html

  • Convert BIGINT Timestamp to a Datetime???

    I have the following date in  Bigint 130234176000000000    
    how to convert it to a proper date?
    The command below gave me an error
    select dateadd(second,
     (Convert(bigINT,convert(varchar,[Time])))/1000
    + 8*60*60,
    '19700101')
    I did the command below but it gave me a different number.
    dateadd(second,  (Convert(bigINT,LEFT(convert(varchar,[Time]),13)))/1000 + 8*60*60, '19700101'))
    hussain

    I found this might help
    Time
    CAST(TimeBias
    AS
    bigint)
    * 600000000
    >= emsevents.dbo.DateTimeToUTCFILETIME(CONVERT(DATETIME,
    '2013-06-19 17:52:38',
    102)))
    hussain

  • How to convert 64-bit to 32-bit oracle 8.1.7

    We are planning to upgrade our O/S version from AIX 4.3.3 to 5.2
    The limitation is that AIX 5.2 and 8.1.7.4 64-bit are not certified. We are also running Oracle Financials 11.0.3 so we cannot upgrade to 9.2.X versions.
    Can anybody tell me how to convert Oracle 8.1.7 64-bit to 32-bit? ( before upgrading to AIX 5.2)
    Is there a performance degradation between 64-bit and 32-bit RDBMS?

    Javed, I suggest you open an iTAR with Oracle support. For one thing I believe you will need a different binary. You may already have the install CD since I believe we received both and choose 64 bit.
    HTH -- Mark D Powell --

  • How to convert Oracle data types to ABAP types.

    Hi,
    I have this oracle table table:
    Type of col.
    Char(6)
    Number
    Number
    Number
    Number
    Date
    I dont know how to convert column of number to abap types. I use exec sgl syntax and I try to insert value to abap structure. But structure <dyn_wa> is wrong.
      EXEC SQL PERFORMING loop_output.
        SELECT *
            INTO   :<dyn_wa>
            FROM   BIND_VAT_CB_SUM_VIEW@DTRTST1
      ENDEXEC.
    ENDFORM.                    "get_data
    Thanks

    HI,
    REPORT demo_native_sql.
    DATA: BEGIN OF wa,
            connid   TYPE spfli-connid,
            cityfrom TYPE spfli-cityfrom,
            cityto   TYPE spfli-cityto,
          END OF wa.
    DATA c1 TYPE spfli-carrid VALUE 'LH'.
    EXEC SQL PERFORMING loop_output.
      SELECT connid, cityfrom, cityto
      INTO   :wa
      FROM   spfli
      WHERE  carrid = :c1
    ENDEXEC.
    FORM loop_output.
      WRITE: / wa-connid, wa-cityfrom, wa-cityto.
    ENDFORM.
    See the below SAP link for more info
    http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb3b8b358411d1829f0000e829fbfe/content.htm
    Thanks
    Sudheer

  • How to convert oracle DDL to mysql DDL

    Dear friends,
    I have Oracle 9.2.0 DDL, (not complexity, no BLOB or CLOB data type, but have foreign key constrains), I want to convert it to mysql DDL, so I can create mysql database using this DDL. could someone give a hint of how to convert it? thank you very much in advance!
    besides, could some one tell me if I can get oracle 9.2.0 DDL through JDBC? how?
    thanks again!

    Hi Sammy,
    I'm not sure what you're looking for when you say you'd like to retrieve Oracle DDL. Would you like to know the table definitions (e.g., table names with associated column names and types)? I think java.sql.DatabaseMetaData might be able to help you out if that's what you mean.
    I usually just go into SQL*Plus and ask Oracle to describe the tables I need. But perhaps I'm not understanding you.
    Yes, I think it's best combine XDoclet and Hibernate. I've been adding XDoclet javadoc tags to my Java classes. There's an Ant task that generates the *.hbm.xml descriptor files for all my classes. There's another Ant task that will take those descriptors and put out the DLL for you. You can change from Oracle to MySQL just by changing the hibernate.properties file.
    I agree - Hibernate is terrific stuff. I hope it can help you. Sincerely, MOD

Maybe you are looking for