SQL LOADER LPAD CONTROL FILE QUESTION
Hi, inthe flat file
company_cd is "1" or "01"
and center_cd is 3 digits... ex: "493"
in the table the userid coulmn should be 6 digits
currently i am getting this as userid in the table
"010493" is right, because company_cd is "01"
"10493" is not right, because company_cd is "1"
if company_cd is 2 digits(01) i am getting 6 digits userid which is OK
but when company_cd is singile digit(1) i am getting 5 digits userid
I NEED TO LPAD with 0 in the front when company_cd is "1"any suggetions ???????
***********This is the code i am using currently in the CTL file for userid**********
,USERID "CONCAT(substr(trim(:company_cd),1,2),lpad(trim(:center_cd),4,0))"
.......Thank You..........
Edited by: phani_Marella on Aug 28, 2012 11:12 AM
Now where does company 'coz' come from all of a sudden?
I'm sure you read {message:id=9360002} , hence my confusion.
Anyway, the SQL*Loader forum is @ Export/Import/SQL Loader & External Tables
Similar Messages
-
SQL Loader and control file changes for different users
In the front end of my application I can select a data file and a control file, and load data to the table mentioned in .ctl file. Every user who logs in uses the same .ctl file and so loads onto the same table. Now I want the user to load data onto the table in his own schema. I can get the username of the user currently logged in and i want to insert it into that username.table. So can i copy the contents of the .ctl file into a variable, modify it into username.table in that string and pass that variable as a parameter to the sqlldr command instead of the .ctl file.
Or is there a better way how I can modify the same control file everytime to change tablename to username.tablename in .ctl file and pass to sqlldr to load data to table in local user schema table.
Thanks and RegardsThanks for the reply .. user do have their user credentials but only for the application ... but all users use a common loader and control file once they log into the application. So irrespective of which user is logged in he selects the same control file and loads to the same table mentioned in the control file .. i instead want user to be able to load to the table in control file but into his schema like username.tablename instead of just the tablename mentioned in .ctl file.
-
SQL Loader and control files with WHEN clauses
Hi All :)
Want to load data into 3 tables that are defined like so:
SQL> desc PARENT
Name NULL? Type
PKey.........NOT NULL....Number
Blah_One.................VARHCAR2(50)
Blah_Two.................VARHCAR2(50)
SQL> desc CHILD_ONE
Name NULL? Type
PKey.........NOT NULL....Number
FKey.....................Number -- this is used as a Foriegn key to PARNET
Bleep_One................VARHCAR2(50)
SQL> desc CHILD_TWO
Name NULL? Type
PKey.........NOT NULL....Number
FKey.....................Number -- this is used as a Foriegn key to PARNET
Bleep_Two................VARHCAR2(50)
I have a flat file that looks like this
PARENT|BLAHBLAH|Blahba|
ONE|BLEEP-IT|
ONE|BLEEP-BLOP|
TWO|TWOBLEEP|
TWO|OR NOT TO|
TWO|BLEEP
PARENT|AbbaDabaDooo|whaaaaa|
TWO|waka=waka|
.... so I worte a control file that looks like this ....
LOAD DATA
APPEND
INTO PARENT
WHEN (tableName='PARENT')
FIELDS TERMINATED BY '|' TRAILING NULLCOLS
tableName FILLER,
BLAH_ONE,
BLAH_TWO,
PKey "PARENT_SEQ.nextval"
INTO CHILD_ONE
WHEN (tableName='ONE')
FIELDS TERMINATED BY '|' TRAILING NULLCOLS
tableName FILLER,
BLEEP_ONE,
PKey "CHILD_ONE_SEQ.nextval",
FKey "PARENT_SEQ.currval"
INTO CHILD_TWO
WHEN (tableName='TWO')
FIELDS TERMINATED BY '|' TRAILING NULLCOLS
tableName FILLER,
BLEEP_TWO,
PKey "CHILD_TWO_SEQ.nextval",
FKey "PARENT_SEQ.currval"
where PARENT_SEQ, CHILD_ONE, and CHILD_TWO
are SEQUENCES.
The probelm I am having is that the Fkeys and PKeys
don't match up????
Am I mis-using SEQUENCES?
Should I be using a trigger?
I am very confused!
Thankshttp://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:6020061915147
answers this question perfectly -
I know I've done this before but, I don't use SQL Loader often and I'm having issues getting a file to load.
The table has 6 columns in it - one of which is a timestamp.
I was having issues loading it initially with date format issues. I ruled out any issues with the timestamp format by simply loading a dummy table with some timestamp based data and had no issue.
So - I think the issue is around the fact that the table I'm loading's first column being a value I'm attempting to default with a sequence when loading and - that I'm screwing up something there.
Table is as such:
CREATE TABLE ACS_IPS
(seq_ips NUMBER,
col2 VARCHAR2(100),
col3 VARCHAR2(100),
col4 VARCHAR2(100),
col5 TIMESTAMP,
col6 VARCHAR2(100),
col7 VARCHAR2(100),
col8 DATE DEFAULT SYSDATE NOT NULL,
col9 VARCHAR2(30) DEFAULT USER);The control file is:
load data
truncate
into table acs_ips
fields terminated by ","
trailing nullcols
seq_ips "seq_ips.nextval",
col2,
col3,
col4,
col5 TIMESTAMP "YYYY-MM-DD HH24:MI:SS.FF9",
col6,
col7
)The sequence column isn't in the file being loaded... and - there are additional columns that are defaulted on the table that aren't in the control file.
Any help is appreciated... The error I'm getting is:
Rejected - Error on table CAMS.ACS_IPS, column ACTION_START.
ORA-01841: (full) year must be between -4713 and +9999, and not be 0Yeah - not sure that clears it up...
The sequence in my table is the first column - and - I think that's the problem... the sequence is being loaded as the first column in the control file but - it's not in the file being loaded so - it's skewing (again - I think??) the data being read in - which is why I'm getting the timestamp issues on the one column (it's actually reading the next column in the file vs. the actual timestamp one).
If that's the issue - I'm not sure how to avoid it without restructuring the table to stick the sequence physically at the end. I'm certain that's not necessary and - I'm overlooking something that's otherwise simple but evading me. -
Problem import csv file with SQL*loader and control file
I have a *csv file looking like this:
E0100070;EKKJ 1X10/10 1 KV;1;2003-06-16;01C;75
E0100075;EKKJ 1X10/10 1 KV;500;2003-06-16;01C;67
E0100440;EKKJ 2X2,5/2,5 1 KV;1;2003-06-16;01C;37,2
E0100445;EKKJ 2X2,5/2,5 1 KV;500;2003-06-16;01C;33,2
E0100450;EKKJ 2X4/4 1 KV;1;2003-06-16;01C;53
E0100455;EKKJ 2X4/4 1 KV;500;2003-06-16;01C;47,1
I want to import this csv file to this table:
create table artikel (artnr varchar2(10), namn varchar2(25), fp_storlek number, datum date, mtrlid varchar2(5), pris number);
My controlfile looks like this:
LOAD DATA
INFILE 'e:\test.csv'
INSERT
INTO TABLE ARTIKEL
FIELDS TERMINATED BY ';'
TRAILING NULLCOLS
(ARTNR, NAMN, FP_STORLEK char "to_number(:fp_storlek,'99999')", DATUM date 'yyyy-mm-dd', MTRLID, pris char "to_number(:pris,'999999D99')")
I cant get sql*loader to import the last column(pris) as I want. It ignore my decimal point which in this case is "," and not "." maybe this is the problem. If the decimal point is the problem how can I get oracle to recognize "," as a decimal point??
the result from the import now, is that a decimal number (37,2) becomes 372 in the tableSet NLS_NUMERIC_CHARACTERS environment variable at OS level, before running SqlLoader :
$ cat test.csv
E0100070;EKKJ 1X10/10 1 KV;1;2003-06-16;01C;75
E0100075;EKKJ 1X10/10 1 KV;500;2003-06-16;01C;67
E0100440;EKKJ 2X2,5/2,5 1 KV;1;2003-06-16;01C;37,2
E0100445;EKKJ 2X2,5/2,5 1 KV;500;2003-06-16;01C;33,2
E0100450;EKKJ 2X4/4 1 KV;1;2003-06-16;01C;53
E0100455;EKKJ 2X4/4 1 KV;500;2003-06-16;01C;47,1
$ cat artikel.ctl
LOAD DATA
INFILE 'test.csv'
replace
INTO TABLE ARTIKEL
FIELDS TERMINATED BY ';'
TRAILING NULLCOLS
(ARTNR, NAMN, FP_STORLEK char "to_number(:fp_storlek,'99999')", DATUM date 'yyyy-mm-dd', MTRLID, pris char "to_number(:pris,'999999D99')")
$ sqlldr scott/tiger control=artikel
SQL*Loader: Release 10.1.0.3.0 - Production on Sat Nov 12 15:10:01 2005
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Commit point reached - logical record count 6
$ sqlplus scott/tiger
SQL*Plus: Release 10.1.0.3.0 - Production on Sat Nov 12 15:10:11 2005
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select * from artikel;
ARTNR NAMN FP_STORLEK DATUM MTRLI PRIS
E0100070 EKKJ 1X10/10 1 KV 1 16/06/2003 01C 75
E0100075 EKKJ 1X10/10 1 KV 500 16/06/2003 01C 67
E0100440 EKKJ 2X2,5/2,5 1 KV 1 16/06/2003 01C 372
E0100445 EKKJ 2X2,5/2,5 1 KV 500 16/06/2003 01C 332
E0100450 EKKJ 2X4/4 1 KV 1 16/06/2003 01C 53
E0100455 EKKJ 2X4/4 1 KV 500 16/06/2003 01C 471
6 rows selected.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
$ export NLS_NUMERIC_CHARACTERS=',.'
$ sqlldr scott/tiger control=artikel
SQL*Loader: Release 10.1.0.3.0 - Production on Sat Nov 12 15:10:41 2005
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Commit point reached - logical record count 6
$ sqlplus scott/tiger
SQL*Plus: Release 10.1.0.3.0 - Production on Sat Nov 12 15:10:45 2005
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select * from artikel;
ARTNR NAMN FP_STORLEK DATUM MTRLI PRIS
E0100070 EKKJ 1X10/10 1 KV 1 16/06/2003 01C 75
E0100075 EKKJ 1X10/10 1 KV 500 16/06/2003 01C 67
E0100440 EKKJ 2X2,5/2,5 1 KV 1 16/06/2003 01C 37,2
E0100445 EKKJ 2X2,5/2,5 1 KV 500 16/06/2003 01C 33,2
E0100450 EKKJ 2X4/4 1 KV 1 16/06/2003 01C 53
E0100455 EKKJ 2X4/4 1 KV 500 16/06/2003 01C 47,1
6 rows selected.
SQL> Control file is exactly as yours, I just put replace instead of insert. -
Unable to load Site Control File
Hello,
The background :
I am in the process of learning how to create a Management Pack for a distributed application in SCOM 2012 R2.</p><p>For this, I picked our SCCM Site server to use as an example. So, in short, am writing a management pack for SCCM 2007 Discovery.
I know a management pack might already exist. I am trying to learn by using an architecture I'm familiar with so I need to create this from scratch.
In order to discover SCCM Site installed on a server, I decided to use the SMS WMI namespace. By reading the
SMS_ProviderLocation Instance, I am able to detect if the server has SCCM Site installed on it.
My next step was to find out where the SMS database is hosted. I found
ROOT\SMS\site_ABC\ namespace contains an instance of SMS_SCI_SiteDefinition where I can find the database name and server name which I can use to discover the other components of a distributed application.
The problem :
When I run the query Select * from SMS_SCI_SiteDefinition I get a generic error 0x80041001.
More Information reveals the following:
error description : " Unable to load site control file "
error code : " 2160198400 (0x80c20300) "
file name : " c:\qfe\nts_sms_fre\sms\siteserver\sdk_provider\smsprov\sspsitecontrolextractor.cpp "
Now, I cannot find the QFE folder anywhere. The SCCM Site is working fine and the site_control_manager component has no errors. I can launch the SCCM console on that server without any errors and the site status messages do not contain any errors.
Can someone please help me out with "detecting" an installed instance of SCCM site server using WMI? Is the above error cause for worry for the SCCM part of my brain?
Thanks in advance for your guidance!Thanks for your response Don!
The SMS_Site instance does not provide information of the database server and database name.
The funny thing is when I browse use wbemtest to connect to root\SMS\site_XXX and enumerate classes, i do not find
the SMS_SCI_SiteDefinition.
I find it when i enumerate recursively and can browse into the values. I'm not sure how could build a query against this now.
Can anybody with a test instance of SCCM 2007 check this and let me know please?
Everything you are looking for exist within WMI. You can use the documentation script as an example to get what you are looking for.
http://www.enhansoft.com/pages/downloads.aspx
Garth Jones | My blogs: Enhansoft and
Old Blog site | Twitter:
@GarthMJ -
SQL*Loader Sequential Data File Record Processing?
If I use the conventional path will SQL*Loader process a data file sequentially from top to bottom? I have a file comprised of header and detail records with no value found in the detail records that can be used to relate to the header records. The only option is to derive a header value via a sequence (nextval) and then populate the detail records with the same value pulled from the same sequence (currval). But for this to work SQL*Loader must process the file in the exact same sequence that the data has been written to the data file. I've read through the 11g Oracle® Database Utilities SQL*Loader sections looking for proof that this is what will happen but haven't found this information and I don't want to assume that SQL*Loader will always process the data file records sequentially.
Thank youOracle Support responded with the following statement.
"Yes, SQL*LOADER process data file from top to bottom.
This was touched in the note below:
SQL*Loader - How to Load a Single Logical Record from Physical Records which Include Linefeeds (Doc ID 160093.1)"
Jason -
Sql loader control file question.
I have a text file (t.txt) which contains a record types AAA and AAB to input fixed width data into a table (t) AAA_NO, AAA_TYPE, AAB_DESC.
Control file (control_t) contents:
load data infile '/path/t.txt'
insert into table t
when ((1:3) = 'AAA' )
AAA_NO position (4:14) CHAR,
AAA_TYPE postion (15:27) CHAR
Works prefectly, but I need to add another set of data from the same t.txt file with record type AAB. I attempted to add this into the same control file:
into table t
when (1:3) = 'AAB'
AAB_DESC position (28:128) CHAR
It fails naturally. How would I include the addtional record type data into the same table after AAA_NO and AAA_TYPE have already been inserted? Do I need to include the AAA_NO in the second insert (AAB_DESC)? Should I create another temp table to store only the AAA_NO and AAB_DESC and then insert that data into table t after the loader is done? Or can this be completed in the same control file?Thanks again for the assistance, this is a tough one to fix. I am new to sqlloader.
The temp table creation is causing some serious errors, so I am back to trying to fix sqlloader to get the job done. the apt.txt file contains records that each row of a new record starts with either 'APT' or 'ATT'. Here is the details of what I am trying to do.
crtl file:
load data
infile '/path/apt.txt
insert
into table t_hld
when ((1:3) = 'APT')
apt_no position (4:14) CHAR,
apt_type position (15:27) CHAR,
apt_id position (28:31) CHAR
The next section is the problem where I am inserting apt_sked into the same table t_hld as above because it has a different record qualifier its ATT and not APT.
insert
into table t_hld
when (1:3) = 'ATT'
apt_no position (4:14) CHAR,
apt_sked position (16:126) CHAR
The positions of the data using fixed is working, I can insert the apt_sked data into another temp table instead of t_hld and it works. It's just when I attempt to place the ATT apt_sked data into the t_hld table after the APT data has been loaded into the t_hld table....I tried APPEND instead of INSERT, but that does not work.
The APT_NO's of the data are all the same- it is the qualifier for the records (Primary Key attribute- however I do not have it established since it is a temp table concept).
I am stuck trying to get the data in the t_hld table, everything works when I do not try to put the ATT apt_sked data into t_hld- everything is valid. And placing the ATT apt_sked data into a different temp table works perfectly- but I can't find a way to create an update to t_hld from this temp table without errors. So I am trying to go back to sqlloader to get this done- any thoughts or questions?
Thanks a billion!
Shawn -
SQL loader and stream files with new line '
I have been trying unsuccessfully to load EDI files using SQL loader. The problem
is that the lines are terminated by ' and when I use the stream file option it does
not recognise the line terminator given. As I understand it from the documentation
this should work - but it does not. I have also used the Hex option with no better
result. Does anyone have any ideas ?
I can and have used tr "[']" "[\n]" in Unix to convert the ' to newlines - I just
wonder am I missing something in SQL loader which will allow me to do this ?
This is the sql loader control file
LOAD DATA
INFILE 'WS860685.MFD' "Str ''' "
BADFILE 'WS860685.bad'
DISCARDFILE 'WS860685.dsc'
INTO TABLE "DUND1"."EDI_LOADED_TEMP"
REPLACE
FIELDS TERMINATED BY '+'
TRAILING NULLCOLS
(L1,
L2,
L3,
L4,
L5,
L6,
L7,
L8,
L9,
L10,
L11,
L12,
L13,
L14,
L15,
L16,
L17,
L18,
L19,
L20,
L21,
L22,
L23,
L24,
L25,
L26,
L27,
L28,
L29,
L30,
L31,
L32,
L33,
L34,
L35,
L36,
L37,
L38,
L39,
L40,
LNO)
Heres a sample of the data
UNB+UNOA:2+5398888501357+5398888501838+080306:0737+395+ DESADV+++1'UNH+0001+DESADV:D:93A:UN:EAN004'http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:6020061915147
answers this question perfectly -
Flat File and Control Files Questions
Greetings,
I've worked with Oracle for about 10 years, but have little experience with using sql-loader.
I have data from Visual FoxPro tables going into Oracle 10g via a Perl script. I am having issues and therefore have a couple questions.
1) If the data from my foxpro table is basically everything in the table as in 'Select * from table-name', does the control file have to list every column that is in the FoxPro table?
-- I have a case where a FoxPro table has 15 columns but we are trying to upload only 10 columns. The script is dynamic. It selects * from each FoxPro table and creates a Flat File for each on the fly. Then sql-loader uploads the data to Oracle. The Flat File for this one table has data from all 15 columns, but the Control File only lists 10 of the columns to be uploaded into Oracle.
2) Do the column names in the control file 'have' to match both the column names in the FoxPro table and the Oracle table, or only the Oracle table?YankeeFan wrote:
Greetings,
I've worked with Oracle for about 10 years, but have little experience with using sql-loader.
I have data from Visual FoxPro tables going into Oracle 10g via a Perl script. I am having issues and therefore have a couple questions.
1) If the data from my foxpro table is basically everything in the table as in 'Select * from table-name', does the control file have to list every column that is in the FoxPro table?
-- I have a case where a FoxPro table has 15 columns but we are trying to upload only 10 columns. The script is dynamic. It selects * from each FoxPro table and creates a Flat File for each on the fly. Then sql-loader uploads the data to Oracle. The Flat File for this one table has data from all 15 columns, but the Control File only lists 10 of the columns to be uploaded into Oracle.
Yes - use the FILLER spec to ignore columns you do not care about - http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/ldr_field_list.htm#sthref946
2) Do the column names in the control file 'have' to match both the column names in the FoxPro table and the Oracle table, or only the Oracle table?Only the Oracle table.
HTH
Srini -
Sql loader maximum data file size..?
Hi - I wrote sql loader script runs through shell script which will import data into table from CSV file. CSV file size is around 700MB. I am using Oracle 10g with Sun Solaris 5 environment.
My question is, is there any maximum data file size. The following code from my shell script.
SQLLDR=
DB_USER=
DB_PASS=
DB_SID=
controlFile=
dataFile=
logFileName=
badFile=
${SQLLDR} userid=$DB_USER"/"$DB_PASS"@"$DB_SID \
control=$controlFile \
data=$dataFile \
log=$logFileName \
bad=$badFile \
direct=true \
silent=all \
errors=5000Here is my control file code
LOAD DATA
APPEND
INTO TABLE KEY_HISTORY_TBL
WHEN OLD_KEY <> ''
AND NEW_KEY <> ''
FIELDS TERMINATED BY ','
TRAILING NULLCOLS
OLD_KEY "LTRIM(RTRIM(:OLD_KEY))",
NEW_KEY "LTRIM(RTRIM(:NEW_KEY))",
SYS_DATE "SYSTIMESTAMP",
STATUS CONSTANT 'C'
)Thanks,
-Soma
Edited by: user4587490 on Jun 15, 2011 10:17 AM
Edited by: user4587490 on Jun 15, 2011 11:16 AMHello Soma.
How many records exist in your 700 MB CSV file? How many do you expect to process in 10 minutes? You may want to consider performing a set of simple unit tests with 1) 1 record, 2) 1,000 records, 3) 100 MB filesize, etc. to #1 validate that your shell script and control file syntax function as expected (including the writing of log files, etc.), and #2 gauge how long the processing will take for the full file.
Hope this helps,
Luke
Please mark the answer as helpful or answered if it is so. If not, provide additional details.
Always try to provide actual or sample statements and the full text of errors along with error code to help the forum members help you better. -
SQL*Loader and multiple files
Hello, am tasked with loading tables with 21+ million rows. Will SQL*Loader perform better with one large file or many smaller files? Is there any ideal file size for optimal performance? Thank you
DavidDon, when I tried to loada 21M row table using direct, I get the following messages:
Record 2373: Rejected - Error on table STAGE_CUSTOMER.
ORA-03113: end-of-file on communication channel
SQL*Loader-926: OCI error while uldlfca:OCIDirPathColArrayLoadStream for table STAGE_CUSTOMER
SQL*Loader-2026: the load was aborted because SQL Loader cannot continue.
SQL*Loader-925: Error while uldlgs: OCIStmtExecute (ptc_hp)
ORA-03114: not connected to ORACLE
SQL*Loader-925: Error while uldlgs: OCIStmtFetch (ptc_hp)
ORA-24338: statement handle not executed
Here is the SQL*Loader log:
SQL*Loader: Release 9.2.0.1.0 - Production on Thu Apr 26 15:38:29 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Control File: stage_customer.ctl
Character Set UTF8 specified for all input.
First primary datafile stage_Customer_20070301.csv has a
utf8 byte order mark in it.
Data File: stage_Customer_20070301.csv
Bad File: stage_Customer_20070301.bad
Discard File: none specified
(Allow all discards)
Number to load: ALL
Number to skip: 0
Errors allowed: 1000
Continuation: none specified
Path used: Direct
Silent options: FEEDBACK
Table STAGE_CUSTOMER, 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
ROW_ID SEQUENCE (MAX, 1)
CUSTOMER_ACCT_NUM FIRST * , O(") CHARACTER
IS_DELETED NEXT * , O(") CHARACTER
SQL string for column : "CASE WHEN UPPER(:Is_Deleted) IN ('FALSE','0') THEN 0 ELSE 1 END"
NAME_PREFIX NEXT * , O(") CHARACTER
FIRST_NAME NEXT * , O(") CHARACTER
MIDDLE_NAME NEXT * , O(") CHARACTER
LAST_NAME NEXT * , O(") CHARACTER
NAME_SUFFIX NEXT * , O(") CHARACTER
NICK_NAME NEXT * , O(") CHARACTER
ALT_FIRST_NAME NEXT * , O(") CHARACTER
ALT_LAST_NAME NEXT * , O(") CHARACTER
MARKETING_SOURCE_ID NEXT * , O(") CHARACTER
HOME_PHONE NEXT * , O(") CHARACTER
WORK_PHONE NEXT * , O(") CHARACTER
MOBILE_PHONE NEXT * , O(") CHARACTER
ALTERNATE_PHONE NEXT * , O(") CHARACTER
EMAIL_ADDR NEXT * , O(") CHARACTER
ALT_EMAIL_ADDR NEXT * , O(") CHARACTER
BIRTH_DATE NEXT * , O(") CHARACTER
SQL string for column : "TRUNC(TO_DATE(:Birth_Date, 'MM/DD/YYYY HH24:MI:SS'))"
SALES_CHANNEL_ID NEXT * , O(") CHARACTER
SQL string for column : "decode(:Sales_Channel_id,NULL,NULL,NULL)"
ASSOCIATE_NUMBER NEXT * , O(") CHARACTER
ALT_ASSOCIATE_NUMBER NEXT * , O(") CHARACTER
UPDATE_LOCATION_CD NEXT * , O(") CHARACTER
UPDATE_DATE NEXT * , O(") CHARACTER
SQL string for column : "TRUNC(TO_DATE(:Update_Date, 'MM/DD/YYYY HH24:MI:SS'))"
CUSTOMER_LOGIN_NAME NEXT * , O(") CHARACTER
DISCOUNT_CD NEXT * , O(") CHARACTER
DISCOUNT_PERCENT NEXT * , O(") CHARACTER
BUSINESS_NAME NEXT * , O(") CHARACTER
POS_TAX_FLAG NEXT * , O(") CHARACTER
POS_TAX_PROMPT NEXT * , O(") CHARACTER
SQL string for column : "CASE WHEN UPPER(:POS_TAX_PROMPT) IN ('FALSE','0') THEN 0 ELSE 1 END"
POS_DEFAULT_TAX_ID NEXT * , O(") CHARACTER
POS_TAX_ID_EXPIRATION_DATE NEXT * , O(") CHARACTER
POS_AUTHORIZED_USER_FLAG NEXT * , O(") CHARACTER
SQL string for column : "CASE WHEN UPPER(:POS_AUTHORIZED_USER_FLAG) IN ('FALSE','0') THEN 0 ELSE 1 END"
POS_ALLOW_PURCHASE_ORDER_FLAG NEXT * , O(") CHARACTER
SQL string for column : "CASE WHEN UPPER(:POS_ALLOW_PURCHASE_ORDER_FLAG) IN ('FALSE','0') THEN 0 ELSE 1 END"
ADDRESS1 NEXT * , O(") CHARACTER
ADDRESS2 NEXT * , O(") CHARACTER
ADDRESS3 NEXT * , O(") CHARACTER
CITY NEXT * , O(") CHARACTER
STATE_CD NEXT * , O(") CHARACTER
POSTAL_CD NEXT * , O(") CHARACTER
COUNTRY_CD NEXT * , O(") CHARACTER
ALLOW_UPDATE NEXT * , O(") CHARACTER
SQL string for column : "CASE WHEN UPPER(:ALLOW_UPDATE) IN ('FALSE','0') THEN 0 ELSE 1 END"
ACTION_CODE NEXT * , O(") CHARACTER
SQL string for column : "CASE WHEN UPPER(:action_code) IN ('FALSE','0') THEN 0 ELSE 1 END"
ACCOUNT_TYPE_ID NEXT * , O(") CHARACTER
LOCALE_CD NEXT * , O(") CHARACTER
SQL string for column : "CASE WHEN :Locale_CD IS NOT NULL AND :Locale_CD LIKE '__-__' THEN :Locale_CD ELSE 'en-US' END"
IS_READY_FOR_PROCESSING CONSTANT
Value is '1'
IS_BUSINESS CONSTANT
Value is '0'
HAD_ERRORS CONSTANT
Value is '0'
Record 2373: Rejected - Error on table STAGE_CUSTOMER.
ORA-03113: end-of-file on communication channel
SQL*Loader-926: OCI error while uldlfca:OCIDirPathColArrayLoadStream for table STAGE_CUSTOMER
SQL*Loader-2026: the load was aborted because SQL Loader cannot continue.
SQL*Loader-925: Error while uldlgs: OCIStmtExecute (ptc_hp)
ORA-03114: not connected to ORACLE
SQL*Loader-925: Error while uldlgs: OCIStmtFetch (ptc_hp)
ORA-24338: statement handle not executed
Table STAGE_CUSTOMER:
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.
Bind array size not used in direct path.
Column array rows : 5000
Stream buffer bytes: 256000
Read buffer bytes: 1048576
Total logical records skipped: 0
Total logical records read: 3469
Total logical records rejected: 1
Total logical records discarded: 0
Direct path multithreading optimization is disabled
Run began on Thu Apr 26 15:38:29 2007
Run ended on Thu Apr 26 15:38:30 2007
Elapsed time was: 00:00:01.18
CPU time was: 00:00:00.32 -
SQL*Loader with multiple files
Gurus,
I search the documentation and this forum and haven't found a solution to my issue yet...
I am not expert of SQL*Loader. I have used SQL*Loader to copy from one file to a table many times. But I have not copied multiple files into one table especially with different names.
More specifically....
I need to load data from multiple files into a table. But the file names will be different each time. A file will be created every hour. The file name will consist of the root file name appended by a time stamp. For example, a file created on 10/07/2010 at 2:15 P.M. would be filea100720101415.txt while a file created on 10/08/2010 at 8:15 A.M. would be filea100820100815.txt. All the files will be in one directory.How can I load the data from the files using SQL*Loader?
My database: Oracle 10g Release 2
Operating System: Windows 2003 Server
Please assist.
Robertsect55 wrote:
Gurus,
I search the documentation and this forum and haven't found a solution to my issue yet...
I am not expert of SQL*Loader. I have used SQL*Loader to copy from one file to a table many times. But I have not copied multiple files into one table especially with different names.
More specifically....
I need to load data from multiple files into a table. But the file names will be different each time. A file will be created every hour. The file name will consist of the root file name appended by a time stamp. For example, a file created on 10/07/2010 at 2:15 P.M. would be filea100720101415.txt while a file created on 10/08/2010 at 8:15 A.M. would be filea100820100815.txt. All the files will be in one directory.How can I load the data from the files using SQL*Loader?
My database: Oracle 10g Release 2
Operating System: Windows 2003 Server
Please assist.
RobertToo bad this isn't in *nix, where you get a powerful shell scripting capability.
That said, here is the core of the solution .... you will also need a way to identify files that have been processed vs. new ones. Maybe rename them, maybe move them. But with this sample you can see the basics. From there it is really an issue of DOS scripting, which would better be found by googling around a bit.
cd c:\loadfiles
FOR %%datfile IN (*.txt) DO SQLLDR CONTROL=sample.ctl, LOG=sample.log, BAD=baz.bad, DATA=%%datfileTry googling "dos scripting language". You'll find lots of tutorials and ideas on "advanced" (well, as advanced as DOS gets) techniques to solve your problem.
Edited by: EdStevens on Dec 1, 2010 5:03 PM -
Calling SQL Loader with Dynamic file names
HI all
I woul like to know if I can call sql loader as below
$ sqlldr userid=uname/pwd control=new.ctl, data=$1
I have to schedule my loader 3 times a day and each time my file names are different(AAA_BBB_timestamp)
ThanksI have found a solution myself and if any one is interested its like this
for file in `ls -1 /opt/user/from/`
do
sqlldr userid=user/pwd@connect_string control=control_file.ctl data="/opt/user/from//$file"
done
Ramu -
SQL Loader reads Data file Sequentially or Randomly?
Will SQL Loader loads the data read from file Sequentially or Randomly?
I have the data file like the below
one
two
three
four
and my control file is
LOAD DATA
INFILE *
TRUNCATE
INTO TABLE T TRAILING NULLCOLS
x RECNUM,
y POSITION (1:4000)
so my table will be polulated like
X Y
1 one
2 Two
3 Three
4 Four
Will this happend sequentially even for the large data sets? say i have from one to one million datas in my data files.
Please clarify.
Thanks,
Rajesh.SQL Loader may read the file sequentially, but you should not rely on the physical ordering of the rows in the table.
It looks like that's what you were hinting at.
Maybe you are looking for
-
Retrieving values from a table in ADF
Hi All, Can any one give me the code or an example as how to retrieve the values associated with the table in jspx page. I am working in ADF10.1.3. Thanks,
-
I have an ipod 8generation and i deleted all of my things to download a few shows then deleted them to get my things back but it wont let me it says i have no space. Why?
-
Performance problem with java stored procedure
hi, i developped a java class, then I stored it in Oracle 8.1.7. This class contains several import of other classes stored in the database. It works, but the execution perfomances are disappointing. It's very long. I guess, that's because of the gre
-
Can I turn off automatic playback when charging??
Hi folks, I have a charger that has speakers with it. Every time I begin to charge the phone the same music begins to play on the speakers. Not a good thing when I'm charging and my wife is asleep! How can I disable the music from starting upon a cha
-
What is the maximum number of levels available in SAP?