SQL Loader Oracle 10g problem in upload date with time data -- Very urgent.

Hi
I am trying to upload data using SQL loader. There are three columns in the table
defined as DATE. When I tried upload a data like this '2007-02-15 15:10:20', it is not loading time part. The date stored as 02/15/2008' only. There is not time on that. I tried with many different format nothing work. Can please help me ?
I have also tried with to_date --> to_timestamp it did not work.
The application is going to be in production, I cannot change DATE to TIME STAMP. This is very urgent.
LASTWRITTEN "decode(:LASTWRITTEN,'null',Null, to_date(:LASTWRITTEN,'YYYY-MM-DD HH24:Mi:SS'))",
CREATEDON "decode(:CREATEDON,'null',Null, to_date(:CREATEDON,'YYYY-MM-DD HH24:Mi:SS'))",
LASTUPDATEDON(21) "decode(:LASTUPDATEDON,'null',Null, to_date(:LASTUPDATEDON(21),'DD/MM/YYYY HH24:MI:SS'))"

Your problem is most likely in decode - the return type in your expression will be character based on first search value ('null'), so it will be implicitly converted to character and then again implicitly converted to date by loading into date column. At some of this conversions you probably are loosing your time part. You can try instead use cast:
SQL> desc t
Name                                      Null?    Type
LASTWRITTEN                                        DATE
CREATEDON                                          DATE
LASTUPDATEDON                                      DATE
SQL> select * from t;
no rows selected
SQL> !cat t.ctl
LOAD DATA
INFILE *
INTO TABLE T
TRUNCATE
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS
LASTWRITTEN
"decode(:LASTWRITTEN,'null',cast(Null as date),
  to_date(:LASTWRITTEN,'YYYY-MM-DD HH24:MI:SS'))",
CREATEDON
"decode(:CREATEDON,'null',cast(Null as date),
  to_date(:CREATEDON,'YYYY-MM-DD HH24:MI:SS'))",
LASTUPDATEDON
"decode(:LASTUPDATEDON,'null',cast(Null as date),
  to_date(:LASTUPDATEDON,'DD/MM/YYYY HH24:MI:SS'))"
BEGINDATA
2007-02-15 15:10:20,null,null
null,2007-02-15 15:10:20,null
null,null,15/02/2007 15:10:20
SQL> !sqlldr userid=scott/tiger control=t.ctl log=t.log
SQL*Loader: Release 10.2.0.3.0 - Production on Fri Feb 29 00:20:07 2008
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
Commit point reached - logical record count 3
SQL> select * from t;
LASTWRITTEN         CREATEDON           LASTUPDATEDON
15.02.2007 15:10:20
                    15.02.2007 15:10:20
                                        15.02.2007 15:10:20Best regards
Maxim

Similar Messages

  • 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

  • Problem in Uploading sales order text data using LSMW

    Hi All,
    I am facing Problem in uploading open sales order data from legacy to SAP using LSMW.
    We are trying to upload sales order data using LSMW Standard Batch/Direct input using program name RVINVB10 and program type D. We are not able to upload item text but have no problem in uploading remaining data.
    the details we are passing to BTEXHKOM structure are......
    BTEXHKOM-OLDNR = IHEADER-OLDORD_NO.
    BTEXHKOM-LAISO = 'EN'.
    BTEXHKOM-TDID = 'Z009'.
    and the for structure BTEXLKOM
    BTEXLKOM-OLDNR = IHEADER-OLDORD_NO.
    BTEXLKOM-TXPARGRAPH = '/'.
    CONCATENATE LITEM-DEPTID LITEM-DEPTNAME
    INTO BTEXLKOM-TXLINE SEPARATED BY ' '.
    we have three input source structures.
    IHEADER Header structure
    LITEM Line item structure ( Material data )
    IPARTN Partners structure
    The structure relationships are
    BTEXHKOM <<< IHEADER.
    BTEXLKOM <<< IHEADER.
    Please let me know if I am doing some thing wrong or some thing else need to be done.
    Thanks,
    Chindam.

    you can pass below values also
    OLDNR         :  order number and item nuber
    TXPARGRAPH  : VBBK
    TXLINE        : your text.....

  • Oracle 10g problem on win 2000 server!!

    Hi,
    I have installed oracle 10g on win 2000 server with service pack 4 to my home machine but the problem I am facing is that when I start my db on the system my system gets slow it consumes most of the Ram.I alter few SGA parameters in init.ora file but the problem continues to be effect me.I need to get around that problem asap hope you guys help me as u did in past....
    thanks a lot...

    Hi,
    It's 128MB should i expand it? or what abt oracle 9i if i uninstall of oralce 10g.act I was earlier using oralce 9i.I would like to know that all the commands which used to support to oracle 9i will it support completly to 10g.
    thanks a lot..

  • Learning PL/SQL in Oracle 10G XE

    Successfully installed Oracle 10G XE on my desktop. I'm a newbie Oracle user who wants to learn PL/SQL through Oracle 10G XE.
    Is this possible? Hope you can give me tips and advice on how I would start with this?
    Thanks!

    Certainly possible. I would suggest you crack open the PL/SQL Users Guide. DO you have previous programming experience? If so, looks at the examples.

  • UNDERSTAND THE NEW DATE AND TIME DATA TYPES IN ORACLE 9I

    제품 : SQL*PLUS
    작성날짜 : 2001-08-01
    UNDERSTAND THE NEW DATE AND TIME DATA TYPES IN ORACLE 9I
    ========================================================
    PURPOSE
    Oracle 9i 에서 소개되는 새로운 datetime data type 에 대해 소개한다.
    Explanation
    Example
    1. Datetime Datatypes
    1) TIMESTAMP
    : YEAR/MONTH/DAY/HOUR/MINUTE/SECOND
    2) TIMESTAMP WITH TIME ZONE
    : YEAR/MONTH/DAY/HOUR/MINUTE/SECOND/
    TIMEZONE_HOUR/TIMEZONE_MINUTE( +09:00 )
    or TIMEZONE_REGION( Asia/Seoul )
    3) TIMESTAMP WITH LOCAL TIME ZONE
    : YEAR/MONTH/DAY/HOUR/MINUTE/SECOND
    4) TIME WITH TIME ZONE
    : HOUR/MINUTE/SECOND/TIMEZONE_HOUR/TIMEZONE_MINUTE
    2. Datetime Fields
    1) YEAR/MONTH/DAY/HOUR/MINUTE
    2) SECOND(00 to 59.9(N) is precision) : Range 0 to 9, default is 6
    3) TIMEZONE_HOUR : -12 to 13
    4) TIMEZONE_MINUTE : 00 to 59
    5) TIMEZONE_REGION : Listed in v$timezone_names
    3. DATE 와 TIMESTAMP 와의 차이점
    SQL> select hiredate from emp;
    HIREDATE
    17-DEC-80
    20-FEB-81
    SQL> alter table employees modify hiredate timestamp;
    SQL> select hiredate from employees;
    HIREDATE
    17-DEC-80 12.00.00.000000 AM
    20-FEB-81 12.00.00.000000 AM
    단, 해당 Column 에 Data 가 있다면 DATE/TIMESTAMP -> TIMESTAMP WITH
    TIME ZONE 으로 Convert 할 수 없다.
    SQL> alter table employees modify hiredate timestamp with time zone;
    alter table employees modify hiredate timestamp with time zone
    ERROR at line 1:
    ORA-01439: column to be modified must be empty to change datatype
    4. TIMESTAMP WITH TIME ZONE Datatype
    TIMESTAMP '2001-05-24 10:00:00 +09:00'
    TIMESTAMP '2001-05-24 10:00:00 Asia/Seoul'
    TIMESTAMP '2001-05-24 10:00:00 KST'
    5. TIMESTAMP WITH LOCAL TIME ZONE Datatype
    SQL> create table date_tab (date_col TIMESTAMP WITH LOCAL TIME ZONE);
    SQL> insert into date_tab values ('15-NOV-00 09:34:28 AM');
    SQL> select * from date_tab;
    DATE_COL
    15-NOV-00 09.34.28.000000 AM
    SQL> alter session set TIME_ZONE = 'EUROPE/LONDON';
    SQL> select * from date_tab;
    DATE_COL
    15-NOV-00 12.34.28.000000 AM
    6. INTERVAL Datatypes
    1) INTERVAL YEAR(year_precision) TO MONTH
    : YEAR/MONTH
    : Year_precision default value is 2
    SQL> create table orders (warranty interval year to month);
    SQL> insert into orders values ('2-6');
    SQL> select warranty from orders;
    WARRANTY
    +02-06
    2) INTERVAL DAY (day_precision) TO SECOND (fractional_seconds_precision)
    : DAY/HOUR/MINUTE/SECOND
    : Logon time 확인시 주로 사용
    : day_precision range 0 to 9, default is 2
    SQL> create table orders (warranty interval day(2) to second);
    SQL> insert into orders values ('90 00:00:00');
    SQL> select warranty from orders;
    WARRANTY
    +90 00:00:00.000000
    7. Interval Fields
    - YEAR : Any positive or negative integer
    - MONTH : 00 to 11
    - DAY : Any positive or negative integer
    - HOUR : 00 to 23
    - MINUTE : 00 to 59
    - SECOND : 00 to 59.9(N) where 9(N) is precision
    8. Using Time Zones
    1) Database operation
    - Defined at CREATE DATABASE
    - Can be altered with ALTER DATABASE
    - Current value given by DBTIMEZONE
    2) Session operation
    - Defined with environment variable ORA_SDTZ
    - Can be altered with ALTER SESSION SET TIME_ZONE
    - Current value given by SESSIONTIMEZONE
    3) TIMESTAMP WITH LOCAL TIMEZONE
    - TIME_ZONE Session parameter
    : O/S Local Time Zone
    Alter session set time_zone = '-05:00';
    : An absolute offset
    Alter session set time_zone = dbtimezone;
    : Database time zone
    Alter session set time_zone = local;
    : A named region
    Alter session set time_zone = 'America/New_York';
    Reference Document
    ------------------

    Hi ,
    I am facing the same problem and my scenario is also same (BAPI's).
    So can you please tell me how you overcome this problem .
    Thanks,
    Rahul

  • 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

  • Oracle 10g for Fedora Linux 3 with Kernel 2.6.9

    Can any body suggest a link, from where I can download the Oracle database 10g for Fedora Core 3 Linux with Kernel version 2.6.9-1*.
    I went through the oracle site site but i was not able to find a one for Fedora 3 instead i found for Fedora 4.
    Thanks.......
    Suneel

    You will not find one exactly as you require.
    As I suggested in the duplicate link
    Oracle 10g for Fedora Linux 3 with Kernel 2.6.9 you need to take a version of Oracle that seems to close to your Linux and then carefully tinker to make it work.,

  • Not able to use date with time in sql query

    Hi,
    select a.contract_number,b.start_date,b.end_date,b.price_negotiated,b.attribute_category,b.attribute1,a.sts_code,a.contract_number_modifier,b.cle_id,b.creation_date
    from OKC_K_HEADERS_ALL_B a,OKC_K_LINES_B b
    where a.id = b.dnz_chr_id
    and b.cle_id is not null
    and a.contract_number_modifier is not null
    and a.sts_code in ('ACTIVE','SIGNED','60 DAY HOLD','HOLD')
    and b.creation_date between to_date('21-10-2013 9:19:48','DD-MM-YYYY HH24:MI:SS')  and  sysdate;
    If I execute this query in toad it is giving me proper results.This query populates the results between the two date with time.
    But I am facing issue when I am using this query in the procedure. The procedure is as below.
    If I use the same query in the procedure I am getting wrong output.
    CREATE OR REPLACE procedure xx_prog_upd_annualized_amt(errbuf out varchar2, retcode out varchar2)
    as
    cursor c1 (l_date in varchar2)is
    select a.contract_number,b.start_date,b.end_date,b.price_negotiated,b.attribute_category,b.attribute1,a.sts_code,a.contract_number_modifier,b.cle_id
    from OKC_K_HEADERS_ALL_B a,OKC_K_LINES_B b
    where a.id = b.dnz_chr_id
    and b.cle_id is not null
    and a.contract_number_modifier is not null
    and a.sts_code in ('ACTIVE','SIGNED','60 DAY HOLD','HOLD')
    and b.creation_date between  to_date(l_date,'DD-MM-YYYY HH24:MI:SS')  and  sysdate;
    v_date varchar2(100);
    v_total_days number;
    v_annualized_amount number;
    begin
    begin
    select max(fcr.actual_start_date) into v_date
    from fnd_concurrent_programs_vl fcp
    ,fnd_concurrent_requests fcr
    where fcp.concurrent_program_id = fcr.concurrent_program_id
    and fcp.user_concurrent_program_name like 'Renewed Annualized Amount Updation';
    exception
    when others then
    fnd_file.put_line(fnd_file.log,'Invalid date');
    end;
    fnd_file.put_line(fnd_file.output,v_date);
    fnd_file.put_line(fnd_file.output,sysdate);
    fnd_file.put_line(fnd_file.output,'***************Start of Program***************');
    fnd_file.put_line(fnd_file.output,'***************Hi***************');
    For i in c1(v_date) loop
    SELECT
             1
           + 30 * TRUNC (MONTHS_BETWEEN ( TO_DATE (i.end_date, 'DD-MON-YYYY'),  TO_DATE (i.start_date, 'DD-MON-YYYY')))
           + LEAST (EXTRACT (DAY FROM TO_DATE (i.end_date, 'DD-MON-YYYY')), 30)
           - LEAST (EXTRACT (DAY FROM TO_DATE (i.start_date, 'DD-MON-YYYY')), 30)
           + CASE
                WHEN EXTRACT (DAY FROM TO_DATE (i.end_date, 'DD-MON-YYYY')) < EXTRACT (DAY FROM TO_DATE (i.start_date, 'DD-MON-YYYY')) THEN 30
                ELSE 0
             END
              daysbetween into v_total_days
      FROM dual;
      fnd_file.put_line(fnd_file.output,i.contract_number);
      fnd_file.put_line(fnd_file.output,v_total_days);
      If v_total_days < 360 then
      v_annualized_amount := (360*i.price_negotiated)/v_total_days;
      update OKC_K_LINES_B
      set attribute_category = 'Annualized Amount',attribute1 = v_annualized_amount
      where cle_id = i.cle_id;
       fnd_file.put_line(fnd_file.output,v_annualized_amount);
        fnd_file.put_line(fnd_file.output,i.cle_id);
        elsif v_total_days >= 360 then
      update OKC_K_LINES_B
      set attribute_category = 'Annualized Amount',attribute1 = i.price_negotiated
      where cle_id = i.cle_id;
      end if;
    end loop;
    commit;
    fnd_file.put_line(fnd_file.output,'***************End of Program***************');
    null;
    end;

    SureshM wrote:
    Hi Purvesh,
    Apologize for not giving the sufficient information.
    max(fcr.actual_start_date) = here I am getting date with time (for eg :9/4/2012 6:47:49 PM)
    Datatype for this column is date.
    This actual start date I am storing in varchar2 variable and then converting this value to date with time.
    My requirement is to pick the rows between the two timestamps which I am unable to do in the procedure.
    Regards
    Suresh
    YOu are losing the Time information while fetching the data into a VARCHAR2 variable. change the datatype of v_date to DATE and get rid of the TO_DATE logic in cursor and simply use v_date variable.
    Message was edited by: PurveshK misread.

  • Why does my phone use data with cellular data turned off?

    I have problems with my iPhone 5 using data on its own. It usually happens at night, with all the apps closed and plugged in to charge (should be connected to my wifi). Recently, I started turning off my cellular data any time I'm at home out of desperation to save my data. Last night, my phone used 6MB of data with my data off, plugged in. I use My Data Manager to track, it matches up with AT&T's record of my data usage, so I'm pretty sure the app is not wrong. I have the 200MB plan, so I have to be very careful and it's incredibly frustrating to wake up and find 6MB gone when cellular data was turned off. Does anyone know what's going on?  I haven't bothered calling Apple or AT&T, I never get anywhere with either one.

    I'm not familiar with My Data Manager but from the name I would think it would tell you what app or apps have used the data and that might help narrow down the problem. If it doesn't have that information, you can go to Settings > Cellular > Use Cellular Data For and that shows usage by each app and if you click on System Services in that list it will also give details of that usage. The numbers are since you last reset the statistics (bottom of that screen). With a little time and detective work you may be able to identify the cause.
    Also, there have been many discussions on various internet forums of AT&T (and other) reporting of the time of data usage not matching the actual time of the use. The usage numbers over a number of days for example are accurate but usage reported at 2AM may actually be a summary of some types of use that happened the previous day.

  • Generic Extractor: enriching GL Data with Purchasing Data

    Experts,
    This is my first time with Generic Extractor.
    Requirement:
    We have a requirement to enrich GL data with Purchasing data via the Material Document Number.
    I need to provide this upto to the datawarehouse layer wherein another team will take over.
    Solution idea:
    Material Document is not part of the datasource 2LIS_02_SCL.
    a. Should I enhance this datasource to include material number  OR
    b. Develop a concept to create a generic delat enabled extractor that pulls data from EKBE, GR and IR information.
    In EKBE multiple material documents can exist per PO. The extractor returns 2 record per PO (before and after image) with the updated information.So if we have the first GR with Material document 901 and then a second GR with material doc 902 the extractor loads 3 records. New record, Before image and after image and the only one stored in BI is the after image. material doc would have value 902 if enhanced.
    For the generic extractor approach the  the ability to load deltas is crucial, since the EKBE table is very big. Maybe
    "CPUDT-Day On Which Accounting Document Was Entered" and "CPUTM-Time of Entry" can be leveraged as delta hook.
    Any ideas???
    Thanks,
    Jain

    No one answered

  • How to validate a date with time

    Hi All,
    How can I validate date with time?
    Here is my code:
    var tempDate:Date = new Date();
    if (tempDate < '09/18/2012 7:30:00 AM'){
         doSomething
    Thanks in advanced

    I think i got it to work.
    var tempDate:Date = new Date();
    var oldDate:Date = new Date('09/18/2012 7:30:00 AM');
    if ( Number(tempDate) < Number(oldDate) ){
         doSomething
    Best,

  • How to compare current date with past date

    Sample code for comparing current date with past date
    i dont want to Calender.set method to compare it.
    How can i do it?

    PLEASE stay with ONE thread:
    http://forum.java.sun.com/thread.jspa?threadID=5143991&tstart=0

  • In Numbers, how do I lock in the date and time data when an IF/THEN formula is used with the "NOW" function?

    In Numbers, how do I lock in the date and time data when an IF/THEN formula is used with the "NOW" function?
    =IF(I127,NOW()," ")
    I127 equals a check box. The formula retuns a value of the current date and time when a check is placed in the box. How does one lock that date and time so that it cannot be changed?

    I don't think it is possible to lock in the date and time using a formula. You could put NOW() in a cell, copy, and Edit Paste Formula Results where you want the result.
    Or if you are "time stamping" a lot, you may find this Automator Service (Dropbox download) helpful. It puts a "Today" function (actually it should be named "Now" because it includes both date and time) in your Services menu like this:
    Just doubleclick the .workflow package to install it. You may have to click "download anyway" in System Preferences > Privacy & Security.
    If you want you can assign the service a keyboard shortcut in System Preferences here:
    SG

  • How to include print date with time on SkillBuilders Schedule Plug In?

    Hi,
    Do you have an idea how to include and get the print date with time on the SkillBuilders Plug In? It shows me the date only, time not included. Have tried to put "HH24:MI", "HH24MI" or Tochar(HH24:MI)? No result??
    select p.fullname, sbip_schedule.start_date(e.event_schedule) start_date
    , sbip_schedule.end_date(e.event_schedule) end_date
    , sbip_schedule.duration_seconds(e.event_schedule) duration_seconds
    , sbip_schedule.calendar_summary(e.event_schedule) calendar_summary
    from app_events e
    Thanks!

    I forget to clarify I am looking for the answer is how to get the print of date with time, Start date with time and End Date with time.

Maybe you are looking for

  • Unable to create billing

    Dear All, I am creating a sales order and delivary,  the delivery document is created. Now with reference to the delivery document i am creating the billing doc. using vf01 T code.    while creating the billing i am getting an error "Express Document

  • Can I instaLL LIGHTROOM 32 BIT ON MY 64 BIT COMPUTER

    I have a new computer with windows 7. I reinstalled lightroom 2.6 but it is installing as 64 bit. I am having no luck with installing plug ins from my preivous computer. Nik sofware for one. They are not compatible with 64 bit yet, as far as I have r

  • How to consume an webservice in XI

    Hi,   I need to consume an webservice in XI, can any one please guide me in this. Regards, Lakshmi

  • Previous element in array list

    hello ppl.. i hope u guys can help me here.. i am developing a program that sort an amount of strings and output to a file..and i place them inside an array list..i use Collections.sort to sort it.. now the problem is..i want to handle duplicate stri

  • Constant Crashes with Specific FCP X Project.

    Hey all, I've just recently upgraded to a 27" iMac with 24 gigs of ram, 2 gigs of video ram, 3.2 GHz i5, 1 TB Fusion drive, and I'm editing in FCP X. I'm running the latest Mountain Lion. 10.8.3 I'm doing a project now and I'm getting towards the end