SQL LDR Control file date format

Hi All
I need to Insert date with time using sqlldr.
In my data file am getting date value as 20110103 10:27:44.
In control file am doing like this
creation_date "decode(:creation_date, 'null', null, 0,null,to_date(:creation_date, 'YYYYMMDD HH24:MI:SS'))
This is inserting only date Ex: 1/3/2011 but I need to insert date with time ex:1/3/2011 10:27:44 AM
Please advice
Thanks
Raj
Edited by: user632682 on Feb 15, 2011 10:37 AM

Raj,
Doesn't make any sense to have date as 0, so either you should use null or sysdate. You can write a function and use it in your sqlldr control file. This is just an example and you can write this anyway
# sqlldr control file
Creation_date DATE 'YYYYMMDD HH24.MI.SS'  "format_date(:creation_date)"
CREATE OR REPLACE FUNCTION format_date(i_date in DATE)
RETURN DATE
IS
BEGIN
if (i_date is NULL or i_date = 0 ) then
i_date := sysdate;
end if;
return i_date;
END format_date;Regards

Similar Messages

  • How to Use Sequence created in Oracle Database in SQL Ldr Control file

    Hi,
    I created a sequence in oracle database. How will use the sequence in SQL loader Control file.
    Thanks in advance

    Hi,
    You might get a good response to your post in the forum dedicated to data movement , including SQL*Loader . You can find it here Export/Import/SQL Loader & External Tables
    Regards,

  • Sql Ldr control file

    Hi, Any one of you suggest me to take a data file and enter the result in
    to different tables by using control file.
    We have created 3 diferent empty tables of same structure and we have
    to load data based on DEPTNO to the respective tables.
    the code which I have provided is inserting in to the first table but
    not in to the other 2
    I had written a code which is here Could you please help me
    out...........as early as possible
    load data
    infile 'c:\mlt.dat'
    truncate
    into table emp_10
    when deptno="10"
    fields terminated by ','
    ( empno
    ,deptno
    ,dname
    ,ename
    ,sal
    ,loc)
    into table emp_20
    when deptno="20"
    fields terminated by ','
    ( empno
    ,deptno
    ,dname
    ,ename
    ,sal
    ,loc)
    into table emp_30
    when deptno="30"
    fields terminated by ','
    ( empno
    ,deptno
    ,dname
    ,ename
    ,sal
    ,loc)

    why would you want to create different tables for each department. This will be horror for any application accessing the data.

  • Problem with SQL*Loader and different date formats in the same file

    DB: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    System: AIX 5.3.0.0
    Hello,
    I'm using SQL*Loader to import semi-colon separated values into a table. The files are delivered to us by a data provider who concatenates data from different sources and this results in us having different date formats within the same file. For example:
    ...;2010-12-31;22/11/1932;...
    I load this data using the following lines in the control file:
    EXECUTIONDATE1     TIMESTAMP     NULLIF EXECUTIONDATE1=BLANKS     "TO_DATE(:EXECUTIONDATE1, 'YYYY-MM-DD')",
    DELDOB          TIMESTAMP     NULLIF DELDOB=BLANKS          "TO_DATE(:DELDOB, 'DD/MM/YYYY')",
    The relevant NLS parameters:
    NLS_LANGUAGE=FRENCH
    NLS_DATE_FORMAT=DD/MM/RR
    NLS_DATE_LANGUAGE=FRENCH
    If I load this file as is the values loaded into the table are 31 dec 2010 and 22 nov *2032*, aven though the years are on 4 digits. If I change the NLS_DATE_FORMAT to DD/MM/YYYY then the second date value will be loaded correctly, but the first value will be loaded as 31 dec *2020* !!
    How can I get both date values to load correctly?
    Thanks!
    Sylvain

    This is very strange, after running a few tests I realized that if the year is 19XX then it will get loaded as 2019, and if it is 20XX then it will be 2020. I'm guessing it may have something to do with certain env variables that aren't set up properly because I'm fairly sure my SQL*Loader control file is correct... I'll run more tests :-(

  • Parameters / Variables in SQL Loader Control File

    Here's my problem, I have created SQL Loader control file (ctl) to load a file of employees. This loader program is registered in Oracle Applications. What I want is to pass a parameter derived from the profile like the user name of the one who executed the loader program and pass it to the loader program so that the user name info is included in the loading
    example
    input data
    123456,John,Smith
    654321,Jane,Doe
    loaded data
    123456,John,Smith,03-JUL-2009,USER13
    654321,Jane,Doe,03-JUL-2009,USER13
    the sysdate is easy because it can be defined in the column but what I really want to achieve is a parameter passed to the ctl file.
    Thanks in advance.

    Dear user!
    Please have a look at this thread.
    {thread:id=915277}
    In the last three posts I explain how to use a shellscript with AWK and SED to pass parameters to a controlfile.
    Please feel free to post again if you have some questions regarding my explanatory notes.
    Yours sincerely
    Florian W.

  • Define variable in SQL Loader Control File

    Hi,
    I have an input file where the first line is the header record, followed by the detail records. For the processing, I do not need to store the fields of the header record but I need a date field from this header record and store in as part of the detail record in an oracle record row.
    Is it possible to define a variable within the sql loader control file to store the value that I need in memory then use it when I do the sql insert by the sql loader?
    Thanks for any advice.

    Not sure that you can. But if your on unix/linux/mac its easy enough to write a shell script to populates the variables in a template file that you can then use as the ctl file. The perl template toolkit could be an option for that as well

  • Add "Trailing Nullcolls" to sql loader control files generated by OWB

    Hi gurus,
    I've got a problem loading data with SQL Loader. I need to add the parameter "trailing nullcols" into the SQL Loader control file generated by OWB. I don't want to do this by saving the skript on my hard disk and run it manually, so any ideas where I can put this parameter? I am using OWB 10.1 on a windows 2000 machine.
    Thanks
    Stephan

    Hi,
    I found the solution to problem.
    1; Select the mapping where you map your source flat file to a table.
    2; Right click on the mapping and select "configure"
    3; Go Sources and Targets -> YOUR_TABLE_NAME -> SQL*Loader Parameters
    4; Set Trailing Nullcols = true :-)
    Thank you to anyone looking at this problem.
    Greetings
    Stephan

  • Controlling the data formatting in excel using jsp.

    Hi,
    How to controlling the data formatting in excel using jsp with out using external jar files such as "jexcel" and "POI". And one more limitation is that it should be compatible with java 1.2.1

    dineshniot wrote:
    Hi - Is there any possibility to automatically display the chart for the logged datas using write to measurement file or write to data file? Please let me know as soon as possible.
    Thanks and Regards,
    Dinesh
    As an aside, "data" is already a plural.  The singular is "datum."
    Bill
    (Mid-Level minion.)
    My support system ensures that I don't look totally incompetent.
    Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.

  • Summary SQL*LDR log file

    Hi,
    I need to get only a summary log file that show me records by error. for example if the log file has 5000 error for datatype and 300 for PK violation and 2000 for not null value, the problem that the log will show me this error row by row. can I get it summary like this
    -5000 rows rejected due to error for datatype
    -300 rows rejected due to PK violation
    -2000 rows rejected due to not null value
    Database: 9i
    O/S: Windows 2000 Server

    eng. Habeeli wrote:
    schavali wrote:
    Pl see your duplicate post here - big SQL*LDR log file
    Pl post what you have found in the documentation so far. AFAIK, there is no way to get a summary log file.
    Sriniits not duplicate ,I change to this form that specialized in sql loadre.
    I don't found any thing about summary log in the documnetPl post a link to the document you read. Did you see my comment above ?
    HTH
    Srini

  • Java.sql.SQLException:ORA-01801:date format is too long for internal buffer

    Hi,
    I am getting the following exception when i trying to insert data in to a table through a stored procedure.
    oracle.apps.fnd.framework.OAException: java.sql.SQLException: ORA-01801: date format is too long for internal buffer
    when execute this stored procedure from ana anonymous block , it gets executed successfully, but i use a OracleCallableStatement to execute the procedure i am getting this error.
    Please let me know how to resolve this error.
    Is this error something to do with the Database Configuration ?
    Thanks & Regards
    Meenal

    I don't know if this will help, but we were getting this error in several of the standard OA framework pages and after much pain and aggravation it was determined that visiting the Sourcing Home Page was changing the timezone. For most pages this just changed the timezone that dates were displayed in, but some had this ORA-01801 error and some others had an ORA-01830 error (date format picture ends before converting entire input string). Unfortunately, if you are not using Sourcing at your site, this probably won't help, but if you are, have a look at patch # 4519817.
    Note that to get the same error, try the following query (I got this error in 9.2.0.5 and 10.1.0.3):
    select to_date('10-Mar-2006', 'DD-Mon-YYYY________________________________________________HH24:MI:SS') from dual;
    It appears that you can't have a date format that is longer than 68 characters.

  • Importing already-made SQL*Loader control files in OWB 10g

    Hi all,
    Suppose that I have a certain amount of already hand-made SQL*Loader control files, say 50 or so.
    Each of these control files have a variable quantity of fields.
    I feel really lazy, so I would like to know if it is possible to import directly these control files instead of re-typing them in the design center. That would save me a lot of time.
    Thanks !
    Burgy

    Hi Burgy
    One option is to use the sqlloader option to generate an external table from the SQLLoader control file (search for generate_only in the sqlloader documentation). If you define the external table in the database you can reverse engineer this into OWB.
    Cheers
    David

  • URGENT: XML-SQL: Error parsing different date formats in the same XML file.

    Hi Everyone,
    I have a big problem while using the XML-SQL utility. I have a XML file with different date formats. I get exception like the one below.
    "oracle.xml.sql.OracleXMLSQLException: 'java.text.ParseException: Unparseable date:"
    And the XML file is :
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <Info Key="ID">
         <Insert>
              <ID>1</ID>
              <BookingDate>10.12.2001</BookingDate>
              <OpeningTime>19:16</OpeningTime>
         </Insert>
    </Info>
    I have tried using different setDateFormat which is contrary.
    sav.setDateFormat("d.M.y");
    sav.setDateFormat("H:m:s");
    Can someone help me on the same.
    Thanks in advance.
    Subramanian.

    You might have to describe the columns as varchar then modify the table to the right format.

  • Sql loader error with date format

    Hi everyone,
    I have table and have a data in one coulmn RECORDED_DATE like '20090224' and my client is asking me to load this coulmn data in 'yyyymmdd' format.I am strucked up with my ideas.I used to_date('20090124','yyyymmdd') in control file.but it is also not working Here it is my control file
    LOAD DATA
    INFILE 'C:\xxxx\SQLLDR\HE data\HE_data_Feb.txt'
    BADFILE 'C:\xxxx\SQLLDR\HE data.bad'
    DISCARDFILE 'C:\xxxx\SQLLDR\HE data.dsc'
    INTO TABLE LSCCMGR.FASTPAY_HE_DATA
    REPLACE
    fields terminated by X'09'
    TRAILING NULLCOLS
    (RECORDED_DATE "TO_DATE(:RECORDED_DATE,'mm/dd/yyyy')"
    AGENT_ID
    MEASURE
    TRANSACTIONS
    FEES
    If i excute like this i am getting the error like
    Record 1: Rejected - Error on table LSCCMGR.FASTPAY_HE_DATA, column RECORDED_DATE.
    ORA-01843: not a valid month
    Getting for all records,what i need o change to get the RECORDED_DATE as dateformat.Ple any one help me in this issue to resolve
    How can we perform this using sql loader pls let me know,Thanks in advance.
    Sravan

    Hi,
    &gt;&gt;(RECORDED_DATE "TO_DATE(:RECORDED_DATE,'mm/dd/yyyy')"
    *Change this line to*
    (RECORDED_DATE "TO_DATE(:RECORDED_DATE,'yyyymmdd')"Regards,

  • SQL Loader Problem with Date Format

    Dear all,
    I am dealing with a problem in loading data with SQL Loader. The problem is in the date format.
    More specifically, I created the following Control File:
    file.ctl
    LOAD DATA
    INFILE 'D:\gbal\chatium.log'
    APPEND INTO TABLE CHAT_SL
    FIELDS TERMINATED BY WHITESPACE
    TRAILING NULLCOLS
    (SL1 DATE "Mon DD, YYYY HH:MI:SS FF3AM",
    SL2 char,
    SL3 DATE "Mon DD, YYYY HH:MI:SS FF3AM",
    SL4 char,
    SL5 char,
    SL6 char,
    SL7 char,
    SL8 char,
    SL9 char,
    SL10 char,
    SL11 char,
    SL12 char,
    SL13 char,
    SL14 char,
    SL15 char)
    The data we want to load are in the following file:
    Apr 29, 2007 12:05:49 AM 1060615 Apr 29, 2007 12:05:35 AM 306978537730 24026384 chatium.user.userinfo WAP 0
    Apr 29, 2007 12:12:51 AM 1061251 Apr 29, 2007 12:12:27 AM 306978537730 24026384 chatium.channel.list WAP 0
    Apr 29, 2007 12:12:51 AM 1061264 Apr 29, 2007 12:12:32 AM 306978537730 24026384 chatium.channel.listdetail WAP 0
    Apr 29, 2007 12:13:51 AM 1061321 Apr 29, 2007 12:13:31 AM 306978537730 24026384 chatium.user.search WAP 0
    Apr 29, 2007 12:13:51 AM 1061330 Apr 29, 2007 12:13:37 AM 306978537730 24026384 chatium.user.userinfo WAP 0
    The error log file is the following:
    SQL*Loader: Release 9.2.0.1.0 - Production on Mon Apr 30 11:29:16 2007
    Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
    Control File: file.ctl
    Data File: D:\gbal\chatium.log
    Bad File: chatium.bad
    Discard File: none specified
    (Allow all discards)
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 50
    Bind array: 64 rows, maximum of 256000 bytes
    Continuation: none specified
    Path used: Conventional
    Table CHAT_SL, loaded from every logical record.
    Insert option in effect for this table: APPEND
    TRAILING NULLCOLS option in effect
    Column Name Position Len Term Encl Datatype
    SL1 FIRST * WHT DATE MonDD,YYYYHH:MI:SS
    SL2 NEXT * WHT CHARACTER
    SL3 NEXT * WHT CHARACTER
    SL4 NEXT * WHT CHARACTER
    SL5 NEXT * WHT CHARACTER
    SL6 NEXT * WHT CHARACTER
    SL7 NEXT * WHT CHARACTER
    SL8 NEXT * WHT CHARACTER
    SL9 NEXT * WHT CHARACTER
    SL10 NEXT * WHT CHARACTER
    SL11 NEXT * WHT CHARACTER
    SL12 NEXT * WHT CHARACTER
    SL13 NEXT * WHT CHARACTER
    SL14 NEXT * WHT CHARACTER
    SL15 NEXT * WHT CHARACTER
    Record 1: Rejected - Error on table CHAT_SL, column SL1.
    ORA-01840: input value not long enough for date format
    Record 2: Rejected - Error on table CHAT_SL, column SL1.
    ORA-01840: input value not long enough for date format
    Record 3: Rejected - Error on table CHAT_SL, column SL1.
    ORA-01840: input value not long enough for date format
    Record 4: Rejected - Error on table CHAT_SL, column SL1.
    ORA-01840: input value not long enough for date format
    I wonder if you could help me.
    Thank you very much in advance.
    Giorgos Baliotis

    SQL> select to_date('Apr 29, 2007 12:05:49 AM','Mon DD, YYYY HH:MI:SS FF3AM') from dual;
    select to_date('Apr 29, 2007 12:05:49 AM','Mon DD, YYYY HH:MI:SS FF3AM') from dual
    ERROR at line 1:
    ORA-01821: date format not recognized
    SQL> ed
    Wrote file afiedt.buf
      1* select to_date('Apr 29, 2007 12:05:49 AM','Mon DD, YYYY HH:MI:SS AM') from dual
    SQL> /
    TO_DATE(
    29/04/07
    SQL> Then, you defined blank space as separator, but there is spaces in your date inside your file. So, you should add double-quotes around the date field like below, and add optionally enclosed by '"' into your ctlfile.
    "Apr 29, 2007 12:05:49 AM" 1060615 "Apr 29, 2007 12:05:35 AM" 306978537730 24026384 chatium.user.userinfo WAP 0
    "Apr 29, 2007 12:12:51 AM" 1061251 "Apr 29, 2007 12:12:27 AM" 306978537730 24026384 chatium.channel.list WAP 0
    "Apr 29, 2007 12:12:51 AM" 1061264 "Apr 29, 2007 12:12:32 AM" 306978537730 24026384 chatium.channel.listdetail WAP 0
    "Apr 29, 2007 12:13:51 AM" 1061321 "Apr 29, 2007 12:13:31 AM" 306978537730 24026384 chatium.user.search WAP 0
    "Apr 29, 2007 12:13:51 AM" 1061330 "Apr 29, 2007 12:13:37 AM" 306978537730 24026384 chatium.user.userinfo WAP 0Example :
    http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14215/ldr_concepts.htm#sthref477
    Nicolas.

  • SQL-Loader Control file for Tab-delimited fields

    i want to import a text-file with TAB-DELIMITED fields and a line-break + return at the end of each record.
    a want to do this by sql-loader and a control file.
    please, can someone give me the statement:
    e.g.
    load data
    infile 'exaple.txt' .......
    (...field1, field2,....)
    thank you very much

    Case Study 3: Loading a Delimited, Free-Format File
    http://otn.oracle.com/pls/db92/db92.to_URL?urlname=http:%2F%2Fdownload-west.oracle.com%2Fdocs%2Fcd%2FB10501_01%2Fserver.920%2Fa96652%2Fch10.htm%231006907
    Modify the example and use 'terminated by whitespace' instead
    For more information on TERMINATED Fields see
    http://otn.oracle.com/pls/db92/db92.to_URL?remark=drilldown&urlname=http:%2F%2Fdownload-west.oracle.com%2Fdocs%2Fcd%2FB10501_01%2Fserver.920%2Fa96652%2Fch06.htm%231013838

Maybe you are looking for

  • Desktop lock-up

    Recently my dock (and desktop) has been locking up. The dock freezes and I can not operate any of the applications. It won't allow me to restart, shutdown or log off. I am forced to give it a "hard reboot" (POWER off). When it reboots, it's fine for

  • How to Close Mass Open Sales Orders (Partially / not executed ) at one go

    Dear All We are having lots of  OPEN SALES ORDERS , few are COMPLETELY OPEN and rest are PARTIALLY used .Now my requirement is to CLOSE all such Sales Order at one go ie. MASS CLOSING OF OPEN SALES ORDER . Please Guide. Regards Animesh Chakroborty

  • T440s Mini Displaypor​t - Audio

    Hi everyone, If I wanted to connect my T440s to my Sony HDTV I realize I'll need an HDMI converter to push video to the TV. What if I wanted to also output audio to the TV? Does the Mini DisplayPort on the T440s allow for audio throughput? Thanks!

  • Process chain and Abap

    I have an ABAP Report which does following: 1. Create Selection via parameters - in table lt_sel. 2. Delete CUBE 3. Own implemantation using lt_sel and fill cube. 4. Compress Cube. Now point 2. and 4. should work in a process chain. How can i deliver

  • Backend connection Steps to be done  to  recieve idocs? i.e XI to R3(IDOC)

    Hi all, what are the backend connection need to be done to Receive IDoc from XI i.e From XI to R3( IDOC)