SQL Loader - howto load data including filename
Hello,
I need to load data from textfile. There are 5 columns and I want also filename as a 1st column.
Here is datafile sample:
B20AK11570A B20AK11570A 6594362054 0 6872
B20AK11570A B20AK11570A 6596312051 6 6878
B20AK11570A B20AK11570A 6596362043 33 17217
Here is table structure:
FILE_NAME VARCHAR2(20 CHAR),
PRODUCT_CODE VARCHAR2(20 CHAR),
PROGRAM_ID VARCHAR2(20 CHAR),
COMPONENT_ID VARCHAR2(20 CHAR),
BAD_PCS VARCHAR2(20 CHAR),
GOOD_PCS VARCHAR2(20 CHAR)
thanks for all suggestions
Can not be done unless you hard code it either into your control file or the file you are loading.
Similar Messages
-
Hello I had an iPhone 5 that i have now lost. I'd like to access the backup for that phone, particularly the notes data. Is it possible to access the backup data via my iPad air?
If not do i have to wait until i get my new iPhone then restore from the backup?
if someone could point me in the right direction ASAP?
many thanksHello Jim
just thought id let you know that i bought the iexplore software, downloaded it and solved my issues in less than 5 mins!
great tip, thanks for your help.
regards
Charles -
hi,
I want to insert 100,000 records daily in a table for the first month and then in next month these records are going to be replaced by new updated records.
there might be few addition and deletion in the previous records also.
actually its consumer data so there might be few consumer who have withdrawn the utility and there will be some more consumer added in the database.
but almost 99% of the previous month data have to be updated/replaced with the fresh month data.
For instance, what i have in my mind is that i will use sql loader to load data for the first month and then i will delete the previous data using sqlPlus and load the fresh month data using sql loader again.
1. Is this ok ? or there is some better solution to this.
2. I have heard of external files, are they feasible in my scenario?
3. I have planned that i will make scripts for sqlPlus and Loader and use them in batch files. (OS windows 2003 server, Oracle 9i database). is there some better choice to make all the procedure automatic?
looking for your suggestions
nadeem ameerI would suggest u use External tables since its more flexible then
sqlloader & is a better option.
For using external tables
1)u will have to create a directory first
2)Generally creation od directory is done by sys,hence after creating the directory
privileges read & write to be provided to user .
3)Creation of external tables.
4) Now use the table as a normal table to insert ,update delete in
ur table.
U can get more information from
http://www.oracle-base.com/articles/9i/SQLNewFeatures9i.php#ExternalTables
Create Directory <directory_name> as <Directory path where file be present>
Grant read,write on directory <directory_name> to <username>
CREATE TABLE <table_name>
(<column names>)
ORGANIZATION EXTERNAL
TYPE ORACLE_LOADER
DEFAULT DIRECTORY ,directory_name>
ACCESS PARAMETERS
RECORDS DELIMITED BY NEWLINE
FIELDS TERMINATED BY ','
LOCATION (<filename>)
PARALLEL 5
REJECT LIMIT 200;
Hope this helps. -
Loading leap year date using SQL*Loader
Hello,
I have a problem loading a date '29/02/2000' using SQL*Loader. This date is on a leap year. I'm getting an error message from SQL*Loader as 'ORA-01839: date not valid for month specified'. My colleague and I have tried using various date functions to convert the data into date, but no luck.
I would appreciate any helps,
BruceThanks for your help, I found the bug on my control file. I was using the RTRIM function to remove bad timestamp such as '29/02/2000 0:00:00'. So instead of using this statement:
LOG_DATE DATE "DD/MM/RRRR" "RTRIM(:LOG_DATE,'0:00:00')"
I was using the statement below with a space before the '0:00:00' string literal, with the intention to remove a space also:
LOG_DATE DATE "DD/MM/RRRR" "RTRIM(:LOG_DATE,' 0:00:00')"
Well, it turned out that if there was a space before the string literal, RTRIM function would trim the matching string plus any '0' characters from the right, including the '000' that belongs to '2000'. Thus, the error.
Thanks again,
Bruce -
SQL*LOADER how to load blanks when data is null
I need to load data which contains null values into a table which cannot contains nulls. How can I tell SQL*LOADER to load blanks in a column when the input data is nulls?
I think something like this in your control file should work:
col1 char(10) nvl(col1,' ') -
SQL Loader - Field in data file exceeds maximum length
Dear All,
I have a file which has more than 4000 characters in a field and I wish to load the data in a table with field length = 4000. but I receive error as
Field in data file exceeds maximum lengthThe below given are the scripts and ctl file
Table creation script:
CREATE TABLE "TEST_TAB"
"STR" VARCHAR2(4000 BYTE),
"STR2" VARCHAR2(4000 BYTE),
"STR3" VARCHAR2(4000 BYTE)
);Control file:
LOAD DATA
INFILE 'C:\table_export.txt'
APPEND INTO TABLE TEST_TAB
FIELDS TERMINATED BY '|'
TRAILING NULLCOLS
( STR CHAR(4000) "SUBSTR(:STR,1,4000)" ,
STR2 CHAR(4000) "SUBSTR(:STR2,1,4000)" ,
STR3 CHAR(4000) "SUBSTR(:STR3,1,4000)"
)Log:
SQL*Loader: Release 10.2.0.1.0 - Production on Mon Jul 26 16:06:25 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Control File: C:\TEST_TAB.CTL
Data File: C:\table_export.txt
Bad File: C:\TEST_TAB.BAD
Discard File: none specified
(Allow all discards)
Number to load: ALL
Number to skip: 0
Errors allowed: 0
Bind array: 64 rows, maximum of 256000 bytes
Continuation: none specified
Path used: Conventional
Table TEST_TAB, 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
STR FIRST 4000 | CHARACTER
SQL string for column : "SUBSTR(:STR,1,4000)"
STR2 NEXT 4000 | CHARACTER
SQL string for column : "SUBSTR(:STR2,1,4000)"
STR3 NEXT 4000 | CHARACTER
SQL string for column : "SUBSTR(:STR3,1,4000)"
value used for ROWS parameter changed from 64 to 21
Record 1: Rejected - Error on table TEST_TAB, column STR.
Field in data file exceeds maximum length
MAXIMUM ERROR COUNT EXCEEDED - Above statistics reflect partial run.
Table TEST_TAB:
0 Rows successfully loaded.
1 Row not loaded due to data errors.
0 Rows not loaded because all WHEN clauses were failed.
0 Rows not loaded because all fields were null.
Space allocated for bind array: 252126 bytes(21 rows)
Read buffer bytes: 1048576
Total logical records skipped: 0
Total logical records read: 1
Total logical records rejected: 1
Total logical records discarded: 0
Run began on Mon Jul 26 16:06:25 2010
Run ended on Mon Jul 26 16:06:25 2010
Elapsed time was: 00:00:00.22
CPU time was: 00:00:00.15Please suggest a way to get it done.
Thanks for reading the post!
*009*Hi Toni,
Thanks for the reply.
Do you mean this?
CREATE TABLE "TEST"."TEST_TAB"
"STR" VARCHAR2(4001),
"STR2" VARCHAR2(4001),
"STR3" VARCHAR2(4001)
);However this does not work as the error would be:
Error at Command Line:8 Column:20
Error report:
SQL Error: ORA-00910: specified length too long for its datatype
00910. 00000 - "specified length too long for its datatype"
*Cause: for datatypes CHAR and RAW, the length specified was > 2000;
otherwise, the length specified was > 4000.
*Action: use a shorter length or switch to a datatype permitting a
longer length such as a VARCHAR2, LONG CHAR, or LONG RAW*009*
Edited by: 009 on Jul 28, 2010 6:15 AM -
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.
SravanHi,
>>(RECORDED_DATE "TO_DATE(:RECORDED_DATE,'mm/dd/yyyy')"
*Change this line to*
(RECORDED_DATE "TO_DATE(:RECORDED_DATE,'yyyymmdd')"Regards, -
ORACLE 8I SQL*LOADER DATAFILE의 특정 FIELD DATA를 SKIP하고 LOADING하는 방법
제품 : ORACLE SERVER
작성날짜 : 2002-04-09
ORACLE 8I SQL*LOADER DATAFILE의 특정 FIELD DATA를 SKIP하고 LOADING하는 방법
===========================================================================
아래의 예제와 같이 가변 길이의 filed들이 ',', '|' 와 같은 구분자로
구분이 되고 있는 경우 oracle 8i부터 제공되는 'FILLER'라고 하는 필드
구분자를 사용하여 상태인식자로 표시하여 insert시 skip할 수 있다.
<Example>
TABLE : skiptab
===========================
col1 varchar2(20)
col2 varchar2(20)
col3 varchar2(20)
CONTROLFIEL : skip.ctl
load data
infile skip.dat
into table skiptab
fields terminated by ","
(col1 char,
col2 filler char,
col3 char)
DATAFILE : skip.dat
SMITH, DALLAS, RESEARCH
ALLEN, CHICAGO, SALES
WARD, CHICAGO, SALES
data loading :
$sqlldr scott/tiger control=skip.ctl
결과 :
COL1 COL3
SMITH RESEARCH
ALLEN SALES
WARD SALES -
SQL Loader and formatting dates
I've got dates formatted like so: 2012-05-10T17:04:51-08:00
How can I get SQL Loader to load these into a Date column??
ThanksThanks for the reply-
SQL Loader is running on Win, Oracle 11 on Linux
The format is standard UTC
YYYY-MM-DDTHH24:MI:SS±HH:MM Where the ±HH:MM refers to time zone offset from GMT. The "T" is just a separator between date and time (and is always "T").
I looked at your references, and tried a few dozen variants without success.
Most of my attempts have been using something similar to this
"YYYY-MM-DDTHH24:MI:SSTZH:TZM"
or this:
"YYYY-MM-DD'T'HH24:MI:SSTZH:TZM"
or this:
'YYYY-MM-DD"T"HH24:MI:SSTZH:TZM'
Thanks -
According to sql loaders log file, I was successful in loading my data into a table. However the table does not show any values loaded - all empy.
Here's my table:
SQL> desc patients
Name Null? Type
PATIENT_ID NOT NULL NUMBER(38)
MEDSUBSCRIBERID VARCHAR2(200)
MEDMEMBERID VARCHAR2(50)
MEDDEPSEQDESC VARCHAR2(50)
MEDMEMBERGENDER VARCHAR2(50)
MEDMEMBERDOB DATE
MEDDEPSEQCODE VARCHAR2(50)
NETWORKID NUMBER(38)
NETWORKCODE VARCHAR2(50)
PATIENTAGE NUMBER(38)
PATIENTNAME VARCHAR2(50)
PATIENTLASTNAME VARCHAR2(50)
PATIENTSEX VARCHAR2(50)
PATIENTSSN VARCHAR2(50)
INTMEDSUBSCRIBERID VARCHAR2(50)
DATE_VALUE_ID NUMBER(38)
DOB VARCHAR2(50)
AGE_GROUP_ID NUMBER(38)
ORGANIZATIONNETWORK_ID NUMBER(38)
ORGANIZATION_ID NUMBER(38)
ORGANIZATIONCODE VARCHAR2(50)
NETWORKID_HOLD NUMBER(38)
PATIENTRELATION VARCHAR2(50)
Here's my SQL Loader Control File:
LOAD DATA
INFILE 'patients.dat'
APPEND
INTO TABLE PATIENTS
FIELDS TERMINATED BY '|'
TRAILING NULLCOLS
PATIENT_ID INTEGER(8) NULLIF(PATIENT_ID=BLANKS)
, MEDSUBSCRIBERID CHAR NULLIF(MEDSUBSCRIBERID=BLANKS)
, MEDMEMBERID CHAR NULLIF(MEDMEMBERID=BLANKS)
, MEDDEPSEQDESC CHAR NULLIF(MEDDEPSEQDESC=BLANKS)
, MEDMEMBERGENDER CHAR NULLIF(MEDMEMBERGENDER=BLANKS)
, MEDMEMBERDOB DATE "YYYY-MM-DD HH24:MI:SS" NULLIF(MEDMEMBERDOB=BLANKS)
, MEDDEPSEQCODE CHAR NULLIF(MEDDEPSEQCODE=BLANKS)
, NETWORKID INTEGER(8) NULLIF(NETWORKID=BLANKS)
, NETWORKCODE CHAR NULLIF(NETWORKCODE=BLANKS)
, PATIENTAGE INTEGER(8) NULLIF(PATIENTAGE=BLANKS)
, PATIENTNAME CHAR NULLIF(PATIENTNAME=BLANKS)
, PATIENTLASTNAME CHAR NULLIF(PATIENTLASTNAME=BLANKS)
, PATIENTSEX CHAR NULLIF(PATIENTSEX=BLANKS)
, PATIENTSSN CHAR NULLIF(PATIENTSSN=BLANKS)
, INTMEDSUBSCRIBERID CHAR NULLIF(INTMEDSUBSCRIBERID=BLANKS)
, DATE_VALUE_ID INTEGER(8) NULLIF(DATE_VALUE_ID=BLANKS)
, DOB CHAR NULLIF(DOB=BLANKS)
, AGE_GROUP_ID INTEGER(8) NULLIF(AGE_GROUP_ID=BLANKS)
, ORGANIZATIONNETWORK_ID INTEGER(8) NULLIF(ORGANIZATIONNETWORK_ID=BLANKS)
, ORGANIZATION_ID INTEGER(8) NULLIF(ORGANIZATION_ID=BLANKS)
, ORGANIZATIONCODE CHAR NULLIF(ORGANIZATIONCODE=BLANKS)
, NETWORKID_HOLD INTEGER(8) NULLIF(NETWORKID_HOLD=BLANKS)
, PATIENTRELATION CHAR NULLIF(PATIENTRELATION=BLANKS)
Here's data file that I'm trying to load:
2|001321666|00132156801||M|1944-01-22 00:00:00||42|7215||Donald|Duck||||52616|19440666|4|42|2|WELLS|42|E
3|001321999|00132156802||F|1951-09-01 00:00:00||42|7215||Mickey|Mouse||||55395|19510999|3|42|2|WELLS|42|W
4|001363888|00136366201||M|1955-05-22 00:00:00||42|7215||Daffy|Duck||||56754|19550777|3|42|2|WELLS|42|E
And, my log file after executing sql loader successfully but the data does not load:
Table PATIENTS:
3 Rows successfully loaded.
0 Rows not loaded due to data errors.
0 Rows not loaded because all WHEN clauses were failed.
0 Rows not loaded because all fields were null.
Space allocated for bind array: 251776 bytes(64 rows)
Read buffer bytes: 1048576
Total logical records skipped: 0
Total logical records read: 3
Total logical records rejected: 0
Total logical records discarded: 0
Run began on Wed Aug 20 11:51:51 2008
Run ended on Wed Aug 20 11:51:57 2008
Elapsed time was: 00:00:05.47
CPU time was: 00:00:00.02Very strange.
Did you connect as the same user as SQL*Loader when you checked the table?
Is it possible that someone else deleted the data? -
Hi All,
I want to load MS word data using SQL Loader into my tables. It loads fine except for certain features like bullets and numbering gets loaded as junk characters.
My sql loader version is Release 8.0.6.3.0.
Please help. Hope I am clear. If not please let me knowMy DB is Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
My OS is AIX 3
My sql loader version is Release 8.0.6.3.0.
Table
CREATE TABLE DUMPTABLE
Case_ID VARCHAR2(30) NOT NULL,
A_Status VARCHAR2(30) ,
Emp_Name VARCHAR2(100) ,
Emp_no VARCHAR2(30) ,
Counter_sign_mgr_comments VARCHAR2(1000) ,
C_KPI1_Name VARCHAR2(1000)
Sample data
79717^ST 1 PEND EMP 1^Test1^1025^Risk Management ^Account Monitoring • Proactively monitor • Early identification • Write Call Memos
79718^ST 1 PEND EMP 2^Test2^1026^Leading Courageously ^Account Monitoring • Need To Improve • ensure compliance • Write Call Memos
Control file
OPTIONS (BINDSIZE=160782, SKIP=1)
LOAD DATA
INFILE '/home/apsprod/DUMP.txt'
BADFILE '/home/apsprod/REJECTEDRECORDS.txt'
REPLACE
INTO TABLE DUMPTABLE WHEN (Case_ID != '99')
fields terminated by "^" optionally enclosed by '"' trailing nullcols
Case_ID,
A_Status,
Emp_Name,
Emp_no,
Counter_sign_mgr_comments char(1000),
KPI1_Name char(1000)
With the above, the data gets loaded but when I select from the table, all the characters are loaded fine but all the bullets in the data is as some junk character
I also tried giving CHARACTERSET as WE8ISO8859P1 and also as UTF8 in the control file
Please help. Hope I am clear. If not please let me know -
How can we load a LOBS data usng Sql loader?
How can we load a LOBS data usng Sql loader?
Did you go through SQL Loader documentation?
http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14215/ldr_loading.htm#i1006803 -
Hyperion11.1.2.2 Sql Server and Essbase data load error
Gentlemen,
i have issue on loading data in Essbase via sql server , while loading data it was fine and all of sudden i see that i get network error 10054
network error 10054 failed to recive data / send data
unexpected essbase error 1042013
even when i try to load manully it says Data Load Fails error Data load buffer [9999] does not exist Unexpected Essbase error 1270040
and in logs
Received client request: MaxL: Execute (from user [admin@Native Directory
*Error writing to server*
Also tried with maxll its the same issue
is .esm is loacked?
any issue with ODBC?
or any orphan link which is connected to sql and hyperion unable to process another ?
let me know your thoughts
thanks.Can you try limiting the query to return some records? Try adding a where clause and see whether that works?
Regards
Celvin
http://www.orahyplabs.com -
Loading data including Smart Lists data using ODI Planning KM
Hi all,
a question regarding ODI loading Smart Lists Data...
Can somebody confirm if we can load data from a source file which has the smart lists labels, instead of the smart list values id (ex: YES instead of 1)? i suppose Planning will do the conversion when loading to essbase
By the way, is Outline load utility working in the same way?
Thanks in advanceHi John,
not because your site was blocked by the customer's firewall :-(
by the way I was referring to loading data containing smart lists accounts. In any case, I have seend that you have other blog entry where you were loading data using labels instead of keys
http://john-goodwin.blogspot.com/2009/05/odi-series-loading-smart-list-data-into.html
This is what I was looking for.
Another question, in outline load we have the chance of putting driver members in the source file which makes the process more flexible. Think if our driver members (Accounts) change dynamically.
Wuold it be any customization possible to add the same functionality to the ODI Planning KM?
We are not likely to use Essbase KM and joins with Plannign repository tables as our source data has dates, free text, figures,smarlists accounts, etc.
Thanks! -
Load rows with date fileds include time
Hi, I need to load rows with SQLLoader. The data has am field with date and time but using mask don4t load the time, only date. How do I load date and time?
Thanks...The following should work to load both the date and time (as long as it is not rejected for some reason)date_cancel date "YYYY/MM/DD HH24:MI:SS"To display the date and time after it has been loaded, you will have to use on of the following:ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY HH:MI:SS AM';
or
SELECT to_char(<column_name,'DD-MON-YYYY HH:MI:SS AM') from <table_name>;
Maybe you are looking for
-
Cleaning ou tmy registry recently, I discovered that photoshop is leaving entries in the registry for every file I edit. These are "recent" file entires, but instead of deleting any more than ten, it is keeping them all!!! It does it every time you e
-
I was about to get hold of imovie 6 as I can am getting nowhere making my imovie 5 work but i notice the specs are for a Power Mac G5 (dual 2.0GHz or faster), or an iMac G5 (1.9GHz or faster; Is anyone running this on a G4 1.25 Ghz imac? Would I be b
-
Help required in endeca java application
Hi, I am creating a java application of the endeca wine application. I am able to display the results but facing issue in creating the product links for individual products which we redirect me to the product detail page. How will the string query cr
-
Best Effort (BE) Quality Service in JDBC & Mail Sender Adapter
Hi Experts, I have confusion for Mail & JDBC Sender adapters. Why BE QoS is provided in the sender JDBC & Mail Adapters. Can anybody explain me with how will be Synchronous JDBC or Mail scenario. Thanks in advance. Abdur
-
How do I make a music link that plays on the open page?
I want to display a image of a violin and have a on-off and slider bar underneath that shows playing progress for a short violin tune. As it is, I have a link to the mp3 file which, when clicked, opens another page and shows the slider bar and start/