How to load selected column with sql loader
Hi all
I want to load only few columns from a datafile not all columns and i don't know how to do from SQL LDR.
I know we can use position but the data is not fixed length.
I'm working with Oracle 11g and Linux OS.
Here is an example of my data file and table.
Data file is and the field is separated by | :
3418483|VOU|20120609090114|555208363|0|2858185502059|1000|0||
3418484|SR|20120609090124|551261956|0|4146314127759|200000|0||
SQL> desc TBL1
Name Null? Type
CTYPE VARCHAR2(5)
BDATE DATE
PARTNUM VARCHAR2(60)
SERIALNO NUMBER
FVALUE NUMBER
I want to have:
SQL> select * from TBL1
CTYPE BDATE PARTNUM SERIALNO FVALUE
VOU 09/06/2012 555208363 2858185502059 1000
SR 09/06/2012 551261956 4146314127759 200000Thank you.
look at FILLER
http://www.orafaq.com/wiki/SQL*Loader_FAQ#Can_one_skip_certain_columns_while_loading_data.3F
--add sample
num1 FILLER,
ctype,
bdate "to_date(:bdate, 'YYYYMMDDHH24MISS')",
PARTNUM,
num2 FILLER,
SERIALNO,
FVALUE,
num3 FILLER
)Edited by: AlexAnd on Jun 9, 2012 4:29 AM
Similar Messages
-
How to load date column using sql loader
Hi,
I am trying to load a file using sql loader. my date value in the file is '2/24/2009 8:23:05 pm',
In control file for this column i specified like this
rec_date date ''mm/dd/yyyy hh:mi:ss pm"
But i am getting following error
not avalid month.
Thanks
sudheerHi,
Use this example as reference:
CTL file:
LOAD DATA
INFILE 'test.txt'
BADFILE 'test.bad'
truncate INTO TABLE T3
FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '|' TRAILING NULLCOLS
dt_date DATE "mm/dd/yyyy hh:mi:ss pm")DAT file:
2/24/2009 8:23:05 pm
C:\ext_files>sqlldr hr/hr control=test.ctl
SQL*Loader: Release 10.2.0.1.0 - Production on Wed Jul 1 20:35:35 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Commit point reached - logical record count 1
Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
Connected as hr
SQL> desc t3;
Name Type Nullable Default Comments
DT_DATE DATE Y
SQL> select to_char(dt_date, 'mm/dd/yyyy hh24:mi:ss') from t3;
TO_CHAR(DT_DATE,'MM/DD/YYYYHH2
02/24/2009 20:23:05
SQL> Regards,
Edited by: Walter Fernández on Jul 1, 2009 8:35 PM - Adding example...
Edited by: Walter Fernández on Jul 1, 2009 8:38 PM
Edited by: Walter Fernández on Jul 1, 2009 8:41 PM - Fixing some information... -
How can I load this XML with sql loader ?
Hi,
Im try to load a XML file into a XML table:
Create table TEST of XMLTYPE;
XML file is something like this:
<!DOCTYPE list SYSTEM "myfile.dtd">
<list>
<item id = 1> lot of tags an info here </item>
<item id = 9000> lot of tags an info here </item>
</list>
I dont know how to exactly create an appropriate control file to my XML. All examples I saw in documentation are similar to this one:
this is an example control file
LOAD DATA
INFILE *
INTO TABLE test
APPEND
XMLTYPE (xmldata)
FIELDS
I dont know how to complete this control file. Can anyone help me ?
thank you!
Message was edited by:
pollopoleaWell I found this working code
LOAD DATA
INFILE *
INTO TABLE test APPEND
xmltype(xmldata)
FIELDS
ext_fname filler char(30),
xmldata LOBFILE (ext_fname) TERMINATED BY EOF
BEGINDATA
mifile.xml
mifile2.xml
mifile3.xml
the main diference I found is that when i use:
Insert into test values (XMLType(bfilename('XMLDIR', 'swd_uC000025127.xml'),nls_charset_id('AL32UTF8')));
tag <!DOCTYPE list SYSTEM "myfile.dtd"> is expanded
(I explain at DTD insertion and errors with long DTD entities
Now using sql loader the tag is not modified.
I dont know if is there any difference, between each case. did I lost performance?
Message was edited by:
pollopolea -
Loading multiple files with SQL Loader
Hello.
I will appreciate your recommendation about the way to load multiple files (to multiple tables) using SQL Loader with only one Control file.
file1 to load to Table1, file2 to load to Table2 etc.
How the Control file should look like?
I was looking on Web, but didn't find exactly what I need.
Thanks!Ctl File : myctl.ctl
---------- Start ---------
LOAD DATA
INFILE 'F:\sqlldr\abc1.dat'
INFILE 'F:\sqlldr\abc2.dat'
INTO TABLE hdfc1
(TRANS_DATE CHAR,
NARRATION CHAR,
VALUE_DATE CHAR,
DEBIT_AMOUNT INTEGER,
CREDIT_AMOUNT INTEGER,
CHQ_REF_NUMBER CHAR,
CLOSING_BALANCE CHAR)
INTO TABLE hdfc2
(TRANS_DATE CHAR,
NARRATION CHAR,
VALUE_DATE CHAR,
DEBIT_AMOUNT INTEGER,
CREDIT_AMOUNT INTEGER,
CHQ_REF_NUMBER CHAR,
CLOSING_BALANCE CHAR)
-----------End-----------
Sqlldr Command
sqlldr scott/tiger@dbtalk control=F:\sqlldr\myctl.ctl log=F:\sqlldr\ddl_file1.txt
Regards,
Abu -
Loading multiple tables with SQL Loader
Hi,
I want to load multiple tables from a single data file using SQL Loader.
Here's the basic idea of what I want. Let's say I have two tables, table =T1
and table T2:
SQL> desc T1;
COL1 VARCHAR2(20)
COL2 VARCHAR2(20)
SQL> desc T2;
COL1 VARCHAR2(20)
COL2 VARCHAR2(20)
COL3 VARCHAR2(20)
My data file, test.dat, looks like this:
AAA|KBA
BBR|BBCC|CCC
NNN|BBBN|NNA
I want to load the first record into T1, and the second and third record load into T2. How do I set up my control file to do that?
Thank!Tough Job
LOAD DATA
truncate
INTO table t1
when col3 = 'dummy'
FIELDS TERMINATED BY '|'
TRAILING NULLCOLS
(col1,col2,col3 filler char nullif col3='dummy')
INTO table t2
when col3 != 'dummy'
FIELDS TERMINATED BY '|'
(col1,col2,col3 nullif col3='dummy')
This will load t2 tbl but not t1.
T1 Filler col3 is not accepting nullif. Its diff to compare columns have null using when condition. If i find something i will let you know.
Can you seperate records into 2 file. Will a UNIX command work for you which will seperate 2col and 3col record types for you. and then you can execute 2 controlfiles on it.
Thanks,
http://www.askyogesh.com -
Loading VARRAY's with SQL loader, direct path in 9i?
Isn't it possible to load VARRAY's with SQLloader and direct path in a Oracle 9i database?
/Magnus Hornstrom
mailto:[email protected]Daniel,
I appreciate your response alot.
Now a follow on. You say that SQL*Loader is the fastest way to get data into Oracle Spatial even though the conventional path. How does SQL*Loader do this? Doesn't it use OCI?
I just can't help but think that coverting my data to SQL*Loader format, and then having it parse it and send it to the database in some form must be slower than me just sending whatever SQL Loader sends to the DB myself using OCI. Am I missing something?
The SQL Loader documentation seems to suggest that SQL*Loader just turns the input into alot of INSERT stateemnts. If so, can't I just do this?
My performance with OCI and INSERT statements isn't very good, but I believe I am doing one transaction per insert. Might I be as well off to concentrate on fine tuning my OCI based code using INSERTs?
I will actually do some time tests myself, but I would appreciate your opinion.
Once again thanks for the great info you have provided. -
Loading huge file with Sql-Loader from Java
Hi,
I have a csv file with aprox. 3 and a half million records.
I load this data with sqlldr from within java like this:
String command = "sqlldr userid=" + user + "/" + pass
+ "@" + service + " control='" + ctlFile + "'";
System.out.println(command);
if (System.getProperty("os.name").contains("Windows")) {
p = Runtime.getRuntime().exec("cmd /C " + command);
} else {
p = Runtime.getRuntime().exec("sh -c " + command);
}it does what I want to, load the data to a certain table, BUT it takes too much time, Is there a faster way to load data to an oracle db from within java?
Thanks, any advice is very welcomeHave your DBA work on this issue - they can monitor and check performance of SQL*Loader
SQL*Loader performance tips [Document 28631.1]
SQL*LOADER SLOW PERFORMANCE [Document 1026145.6]
Master Note for SQL*Loader [Document 1264730.1]
HTH
Srini -
Loading Nested table with SQL Loader
We have 15 nested tables in an table. Need help in creating a contol file. Tried with the syntax of object collection and didn't work. Can any none share the syntax please.
-- Thanks,
Phani AdusumilliThanks Srini and Zoltan.
I am able to figure out, here is the example with one nested table.
CREATE OR REPLACE TYPE feature_count_type AS OBJECT (
feature_type VARCHAR2(60),
occurs INTEGER
CREATE OR REPLACE TYPE feature_count_ntbl
AS TABLE OF feature_count_type;
CREATE TABLE PHANI_ADUSUMILLI(
state VARCHAR2(2),
county VARCHAR2(20),
feature_count feature_count_ntbl
) NESTED TABLE feature_count
STORE AS nested_feature_count_table;
LOAD DATA
INFILE *
TRUNCATE INTO TABLE PHANI_ADUSUMILLI
county CHAR TERMINATED BY ',' ENCLOSED BY '"',
element_count FILLER INTEGER EXTERNAL TERMINATED BY ',',
feature_count NESTED TABLE COUNT(element_count)
dummy_name COLUMN OBJECT
feature_type CHAR TERMINATED BY ',',
occurs INTEGER EXTERNAL TERMINATED BY ','
state CHAR TERMINATED BY ','
BEGINDATA
"Alger",5,lake,213,stream,88,falls,18,bay,11,island,5,MI
"Marquette",6,lake,293,stream,145,falls,5,bay,8,island,5,summit,23,MI
"Keweenaw",3,lake,86,falls,1,summit,16,MI -
Urgent= How to Group selected columns in sql query
Hi,
I need some urgent help on the following sql query. I 'm sure there is an easy way to do this but I'm stacked!Any help will be much appreciated!!
I have a query to retrieve the following columns:
I want the first 9 columns to be grouped together (not to be repeated) for any occurence of the last 3 columns (abs.ABSENCE_START_DATE,abs.ABSENCE_END_DATE, abs.DAYS_TAKEN DAYS_TAKEN_analysis)
SELECT DISTINCT
sum.employee_number ,
sum.EMPLOYEE_NAME,
sum.EMAIL_ADDRESS,
sum.ORGANIZATION ,
sum.BCEBF ,
sum.ALDE ,
sum.CURYRREMDAYS ,
sum.DAYS_TAKEN ,
sum.REMBCE ,
abs.ABSENCE_START_DATE
abs.ABSENCE_END_DATE,
abs.DAYS_TAKEN DAYS_TAKEN_analysis
--TO_CHAR(TO_CHAR(abs.ABSENCE_START_DATE)||' '||TO_CHAR(abs.ABSENCE_END_DATE)||' '||TO_CHAR(abs.DAYS_TAKEN)) DAYS_TAKEN_ANAL
FROM
HB_V_ANNUAL_LEAVE_SUMMARY_REP SUM,
HB_V_AN_LEAV_DAYS_TAKEN_REP ABS
WHERE
sum.employee_number = abs.EMPLOYEE_NUMBER
ORDER BY
sum.employee_number ,
sum.EMPLOYEE_NAME,
sum.EMAIL_ADDRESS,
sum.ORGANIZATION ,
sum.BCEBF ,
sum.ALDE ,
sum.CURYRREMDAYS ,
sum.DAYS_TAKEN ,
sum.REMBCE
Any feedback/help on how to do this will be highly appreciated.
Thanks a lot
ElenaPlease help!!
I used the break command to group columns that I do not want to repeat in my query output. When I run the query without formatting is working. But when I put all formatting to produce the required output I dont get the result I want.
Below is the exact sql query I use:
<<
SET TERMOUT OFF
SET ECHO OFF
SET ARRAY 35
SET HEA OFF
SET FEEDBACK OFF
SET PAGES 2000
col beginLINE format A100
col winsecidLINE format A100
col placeLINE format A100
COL LINEempty1 format A100
COL LINEempty2 format A100
COL LINEempty3 format A100
COL LINEempty4 format A100
COL LINEempty5 format A100
COL LINEempty6 format A100
COL LINEempty7 format A100
COL LINEempty8 format A100
COL LINEempty9 format A100
COL LINEempty10 format A100
col LINECOLempty format A100
col receiverLINE FORMAT A100
COL EMP_EMAIL_ADDRESS FORMAT A100
COL LINEHEADER FORMAT A100
COL unitsLINE FORMAT A100
COL lmLINE FORMAT A100
COL INTITLE FORMAT A100
COL LINECOL1 FORMAT A100
COL CIF FORMAT A100
COL EMPLOYEE_NAME FORMAT A100
COL ORGANIZATION FORMAT A100
COL LINECOL2 FORMAT A100
COL ALHEADER FORMAT A100
col LINECOL3 FORMAT A100
col BCEBF FORMAT A100
col ALDE FORMAT A100
COL CURYRREMDAYS FORMAT A100
COL DAYS_TAKEN FORMAT A100
col LINECOL4 FORMAT A100
COL REMBCE FORMAT A100
col LINECOL5 FORMAT A100
col LINECOL6 FORMAT A100
col ALHEADER2 FORMAT A100
col LINECOL7 FORMAT A100
col endLINE FORMAT A100
break on beginLINE on winsecidLINE on placeLINE on LINEempty1 ON LINEempty2 ON LINEempty3 ON LINEempty4 ON LINEempty5 ON LINEempty6 ON LINEempty7 ON LINEempty8 ON LINEempty9 ON LINEempty10 on receiverLINE on EMP_EMAIL_ADDRESS on LINEHEADER on unitsLINE on lmLINE on INTITLE on LINECOL1 on CIF on EMPLOYEE_NAME on ORGANIZATION on LINECOL2 on ALHEADER on LINECOL3 on BCEBF on ALDE on CURYRREMDAYS on DAYS_TAKEN on LINECOL4 on REMBCE on LINECOL5 on LINECOL6 on ALHEADER2 on LINECOL7 ON LINEempty11 ON endREPORT on endLINE
SPOOL C:\FORMATout.txt
SELECT
'{{begin}} '||chr(10) beginLINE,
'{{winsecid 999999}} '||chr(10) winsecidLINE,
'{{place rbsemail.tif 0 0}} '||chr(10) placeLINE,
' '||chr(10) LINEempty1,
' '||chr(10) LINEempty2,
' '||chr(10) LINEempty3,
' '||chr(10) LINEempty4,
' '||chr(10) LINEempty5,
' '||chr(10) LINEempty6,
' '||chr(10) LINEempty7,
' '||chr(10) LINEempty8,
' '||chr(10) LINEempty9,
' '||chr(10) LINEempty10,
'{{from [email protected]}} '||chr(10) receiverLINE,
'{{fax '|| EMAIL_ADDRESS||' }} '||chr(10) EMP_EMAIL_ADDRESS,
'{{Subject Annual Leave Summary Report as at '||sysdate||' }} '||chr(10) LINEHEADER,
'{{units cm}} '||chr(10) unitsLINE,
'{{lm 2.0}} '||chr(10) lmLINE,
'ANNUAL LEAVE SUMMARY REPORT AS AT '||sysdate INTITLE,
'---------------------------------------------------------------------' LINECOL1,
'CIF: '||CIF CIF,
'EMPLOYEE NAME: '||EMPLOYEE_NAME EMPLOYEE_NAME,
'DEPARTMENT DETAILS: '||ORGANIZATION ORGANIZATION,
'---------------------------------------------------------------------' LINECOL2,
'ANNUAL LEAVE DETAILS:' ALHEADER,
'---------------------------------------------------------------------' LINECOL3,
'BALANCE B/F FROM PREVIOUS YEAR: '||BCEBF BCEBF,
'DAYS ENTITLED FOR THE CURRENT YEAR: '||ALDE ALDE,
'CURRENT YEAR REMAINING DAYS: '||CURYRREMDAYS CURYRREMDAYS,
'DAYS TAKEN FOR THE CURRENT YEAR: '||DAYS_TAKEN DAYS_TAKEN,
'---------------------------------------------------------------------' LINECOL4,
'REMAINING BALANCE: '||REMBCE REMBCE,
'---------------------------------------------------------------------' LINECOL5,
'---------------------------------------------------------------------' LINECOL6,
'ANNUAL LEAVE DAYS TAKEN ANALYSIS FOR THE CURRENT YEAR:' ALHEADER2,
'---------------------------------------------------------------------' LINECOL7,
TO_CHAR('START DATE: '||ABSENCE_START_DATE||' '||'END DATE: '||ABSENCE_END_DATE||' '||'DAYS TAKEN : '||DAYS_TAKEN_ANAL) AL_DAYS_ANAL,
' '||chr(10) LINEempty11,
'-- End of Report -- '||chr(10) endREPORT,
'{{end}} '||chr(10) endLINE
FROM HB_V_AN_LEAV_SUM_DAYSTAKEN_REP
WHERE CIF IN ('098033','098024')
ORDER BY
beginLINE ,
winsecidLINE,
placeLINE ,
LINEempty1,
LINEempty2,
LINEempty3,
LINEempty4,
LINEempty5,
LINEempty6,
LINEempty7,
LINEempty8,
LINEempty9,
LINEempty10,
receiverLINE,
EMP_EMAIL_ADDRESS,
LINEHEADER ,
unitsLINE ,
lmLINE ,
INTITLE ,
LINECOL1,
CIF ,
EMPLOYEE_NAME ,
ORGANIZATION ,
LINECOL2 ,
ALHEADER ,
LINECOL3,
BCEBF ,
ALDE ,
CURYRREMDAYS ,
DAYS_TAKEN ,
LINECOL4 ,
REMBCE ,
LINECOL5 ,
LINECOL6 ,
ALHEADER2 ,
LINECOL7 ,
LINEempty11,
endREPORT,
endLINE
spool off
>>
The required output I want to get is:
<<
{{begin}}
{{winsecid 750612}}
{{place rbsemail.tif 0 0}}
{{from [email protected]}}
{{fax [email protected] }}
{{Subject Annual Leave Summary Report as at 04-APR-08 }}
{{units cm}}
{{lm 2.0}}
ANNUAL LEAVE SUMMARY REPORT AS AT 04-APR-08
CIF: 098024
EMPLOYEE NAME: Christou Christos Panteli
DEPARTMENT DETAILS: 003-031-010-314-03140-Special Projects
ANNUAL LEAVE DETAILS:
BALANCE B/F FROM PREVIOUS YEAR: 9
DAYS ENTITLED FOR THE CURRENT YEAR: 27
CURRENT YEAR REMAINING DAYS: 24
DAYS TAKEN FOR THE CURRENT YEAR: -3
REMAINING BALANCE: 33
ANNUAL LEAVE DAYS TAKEN ANALYSIS FOR THE CURRENT YEAR:
START DATE: 04-JAN-08 END DATE: 04-JAN-08 DAYS TAKEN : 1
START DATE: 24-JAN-08 END DATE: 24-JAN-08 DAYS TAKEN : 1
START DATE: 20-FEB-08 END DATE: 20-FEB-08 DAYS TAKEN : 1
-- End of Report --
{{end}}
{{begin}}
{{winsecid 750612}}
{{place rbsemail.tif 0 0}}
{{from [email protected]}}
{{fax [email protected]}}
{{Subject Annual Leave Summary Report as at 04-APR-08 }}
{{units cm}}
{{lm 2.0}}
ANNUAL LEAVE SUMMARY REPORT AS AT 04-APR-08
CIF: 098033
EMPLOYEE NAME: Demetriou Elena Steliou
DEPARTMENT DETAILS: 003-031-010-314-03140-Special Projects
ANNUAL LEAVE DETAILS:
BALANCE B/F FROM PREVIOUS YEAR: 15
DAYS ENTITLED FOR THE CURRENT YEAR: 27
CURRENT YEAR REMAINING DAYS: 25
DAYS TAKEN FOR THE CURRENT YEAR: -2
REMAINING BALANCE: 40
ANNUAL LEAVE DAYS TAKEN ANALYSIS FOR THE CURRENT YEAR:
START DATE: 15-JAN-08 END DATE: 15-JAN-08 DAYS TAKEN : 1
START DATE: 24-MAR-08 END DATE: 24-MAR-08 DAYS TAKEN : 1
-- End of Report --
{{end}}
>>
However the actual output we get from the above query is as follows:
<<
{{begin}}
{{winsecid 750612}}
{{place rbsemail.tif 0 0}}
{{from [email protected]}}
{{fax [email protected] }}
{{Subject Annual Leave Summary Report as at 04-APR-08 }}
{{units cm}}
{{lm 2.0}}
ANNUAL LEAVE SUMMARY REPORT AS AT 04-APR-08
CIF: 098024
EMPLOYEE NAME: Christou Christos Panteli
DEPARTMENT DETAILS: 003-031-010-314-03140-Special Projects
ANNUAL LEAVE DETAILS:
BALANCE B/F FROM PREVIOUS YEAR: 9
DAYS ENTITLED FOR THE CURRENT YEAR: 27
CURRENT YEAR REMAINING DAYS: 24
DAYS TAKEN FOR THE CURRENT YEAR: -3
REMAINING BALANCE: 33
ANNUAL LEAVE DAYS TAKEN ANALYSIS FOR THE CURRENT YEAR:
START DATE: 04-JAN-08 END DATE: 04-JAN-08 DAYS TAKEN : 1
-- End of Report --
{{end}}
START DATE: 24-JAN-08 END DATE: 24-JAN-08 DAYS TAKEN : 1
START DATE: 20-FEB-08 END DATE: 20-FEB-08 DAYS TAKEN : 1
{{fax [email protected] }}
{{Subject Annual Leave Summary Report as at 04-APR-08 }}
{{units cm}}
{{lm 2.0}}
ANNUAL LEAVE SUMMARY REPORT AS AT 04-APR-08
CIF: 098033
EMPLOYEE NAME: Demetriou Elena Steliou
DEPARTMENT DETAILS: 003-031-010-314-03140-Special Projects
ANNUAL LEAVE DETAILS:
BALANCE B/F FROM PREVIOUS YEAR: 15
DAYS ENTITLED FOR THE CURRENT YEAR: 27
CURRENT YEAR REMAINING DAYS: 25
DAYS TAKEN FOR THE CURRENT YEAR: -2
REMAINING BALANCE: 40
ANNUAL LEAVE DAYS TAKEN ANALYSIS FOR THE CURRENT YEAR:
START DATE: 15-JAN-08 END DATE: 15-JAN-08 DAYS TAKEN : 1
-- End of Report --
{{end}}
START DATE: 24-MAR-08 END DATE: 24-MAR-08 DAYS TAKEN : 1
>>
IF ANYONE CAN HELP ON THIS I WOULD REALLY APPRECIATE IT!
THANKS A LOT!
Best regards,
Elena -
Error loading large field with sql loader for 8i
I want to load a large field (30K) to a database, where I use "long" datatype for it. But I can't because it loads hexadecimal characters, or it get stuck in a loop and does not load anything. I have tried using clob and long in the database and using char(40000), char, and log varraw in the control file. Any idea or suggestion?
Thanks a lot.Hi,
from what I see you are running sqllldr in Windows and your database server is on AIX. Is it a remote server or a local network server?
The ORA-12170 error can be raised for many reasons: firewall issue, database down, listener down, bad sqlnet.ora parm, network trouble, etc
If your network is slow maybe that is the reason. You may post also SQLNET.ORa configuration and try to reconfigure parameters SQLNET.INBOUND_CONNECT_TIMEOUT, SQLNET.SEND_TIMEOUT, SQLNET.RECV_TIMEOUT in sqlnet.ora to larger values.
If your problem is not solved, please post your SQLNET.ORA configuration.
You can check here for details about setting it: Profile Parameters.
Regards.
Al -
Ignoring constraints with SQL*Loader & triggers
When I load a table with SQL*Loader that has foreign key constraints and a before insert trigger, my foreign key constraints are ignored. The end result is a detail table that contains invalid rows (where some column values do not exist in the master table). If I drop the trigger and just load with SQL*Loader, the foreign key constraints are recognized. Any ideas why this is happening? The trigger simply populates the last updated date and user columns.
I found this from Asktom very nice. It will help u a lot.
http://asktom.oracle.com/pls/ask/f?p=4950:9:1988009758486146475::NO:9:F4950_P9_DISPLAYID:8806498660292 -
Problem with loading file with SQL loader
i am getting a problem with loading a file with SQL loader. The loading is getting
terminated after around 2000 rows whereas there are around 2700000 rows in the file.
The file is like
919879086475,11/17/2004,11/20/2004
919879698625,11/17/2004,11/17/2004
919879698628,11/17/2004,11/17/2004
the control file, i am using is like:-
load data
infile 'c:\ran\temp\pps_fc.txt'
into table bm_05oct06
fields terminated by ","
(mobile_no, fcal, frdate )
I hope, my question is clear. Please help, in solving the doubt.
regards.So which thread is telling the truth?
Doubt with SQL loader file wih spaces
Are the fields delimited with spaces or with commas?
Perhaps they are a mixture of delimiters and that is where the error is coming in? -
How to have more than one condition on same column --- using SQL Loader
Hi All,
I am stuck with SQL Loader..
How do I filter records before loading in the table using when clause..
i should load data only when
field1 = 'AC' or 'VC'
field2 is NULL
i used various combinations in when clause like
a) when field1='AC' or field1='VC' and field2 = BLANKS
b) when (field1='AC') and (field2 = BLANKS )
& similar...
In all the cases I tried I could not implement OR condition with field1 and null condition with field2
but my main concern is can we use OR or IS NULL things in when clause of SQL Loader..
is it possible to check this anywhere??
any alternate solution u could suggest??
Thanks
DikshitOk I'll try that, although I did try it earlier when I had iTunes 5.xx loaded, I think.
As to size of playlists, I have a master (900 songs) that defines what will fit onto the ipod , I then generate all the others as subsets of the master (not of the library)- hence I know they will all fit
Can you also clarify something for me: the dialogue box we are discussing is intended, I think, so that one can set the automatic synching of certain playlists between the PC & the ipod. Is that the only way one can select other playlists to go to the ipod - i.e. as static once-offs, not synchronised ?
Apple' docs, I think, are poor in this regard - they assume most ipods are bigger then the users song library and they gloss over the details of this alternate mode of playlist synching.
Thanks - Nick -
How can I load data into table with SQL*LOADER
how can I load data into table with SQL*LOADER
when column data length more than 255 bytes?
when column exceed 255 ,data can not be insert into table by SQL*LOADER
CREATE TABLE A (
A VARCHAR2 ( 10 ) ,
B VARCHAR2 ( 10 ) ,
C VARCHAR2 ( 10 ) ,
E VARCHAR2 ( 2000 ) );
control file:
load data
append into table A
fields terminated by X'09'
(A , B , C , E )
SQL*LOADER command:
sqlldr test/test control=A_ctl.txt data=A.xls log=b.log
datafile:
column E is more than 255bytes
1 1 1 1234567------(more than 255bytes)
1 1 1 1234567------(more than 255bytes)
1 1 1 1234567------(more than 255bytes)
1 1 1 1234567------(more than 255bytes)
1 1 1 1234567------(more than 255bytes)
1 1 1 1234567------(more than 255bytes)
1 1 1 1234567------(more than 255bytes)
1 1 1 1234567------(more than 255bytes)Check this out.
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96652/ch06.htm#1006961 -
Load image file into a LONG RAW column via SQL*Loader
Does anyone know how to load a image file into a LONG RAW column via SQL*Loader?
Thanks
-Hsing-Hua-Are you trying to import the image on the client into Oracle lite, or from the server end into the main oracle database for download to the client?
On our system images are loaded into the the oracle lite database (10g R1 at the moment) on the client (DELL X50 PDA's) into a BLOB (Not LONG RAW) column using Java (relatively standard functionality in Java) as this is what our application software is written in.
From the server end, we do not at the moment load images as such, but we do load the application software into the database for deployment of new versions to the clients (the DMC/DMS updates we have found very unreliable), and the technique should be the same for images. Again the file is imported into a BLOB column.
NOTE a column defined as BLOB on the main Oracle database appears as a LONG VARBINARY on the client Oracle lite database, but the synchronisation process handles the conversion with no problem.
To import into a BLOB column on the server try the following
1) you will need to create a DIRECTORY (CREATE DIRECTORY command) within the database, pointing at a directory on the database server (or accessible from it). This is needed for the file location.
CREATE OR REPLACE DIRECTORY PDA_FILE_UPLOAD AS '/pdaapps/jar/'
NOTE create directory needs to be run as SYSTEM
2) define your table to hold the image and other data. Our tables is
SQL> desc pda_applications
Name Null? Type
ID NOT NULL NUMBER(12)
PDAAT_CODE NOT NULL VARCHAR2(10)
VERSION NOT NULL NUMBER(5,2)
PART_NO NOT NULL NUMBER(3)
FILE_OBJECT BLOB
DEPLOY_APPLICATION_YN NOT NULL VARCHAR2(1)
3) copy the image (or in our case a .jar file) to the database server directory specified in step 1
4) the actual import is done using a DBMB_LOB procedure
PROCEDURE pr_load_file
Module Name : pr_load_file
Description : Main call. Create a new pda_applications record, and import the specified file into it
Version History:
Vers. Author Date Reason
1.0 G Wilkinson 03/02/2006 Initial Version.
(PA_VERSION IN NUMBER
,PA_FILENAME IN VARCHAR2
,PA_PDAAT_CODE IN VARCHAR2
,PA_PART_NO IN NUMBER DEFAULT 1
,PA_DEPLOY IN VARCHAR2 DEFAULT 'Y')
IS
l_FileLocator BFILE;
l_blobLocator BLOB;
l_seq NUMBER;
l_location VARCHAR2(20);
no_params EXCEPTION;
call_fail EXCEPTION;
BEGIN
-- Throw error if required details not present
IF pa_version IS NULL
OR pa_filename IS NULL
OR pa_pdaat_code IS NULL THEN
RAISE no_params;
END IF;
-- Initialize the BLOB locator for writing. Note that we have
-- to import a blob into a table as part of a SELECT FOR UPDATE. This locks the row,
-- and is a requirement for LOADFROMFILE.
SELECT pdaa_id_seq.nextval
INTO l_seq
FROM dual;
-- First create the application record (file is imported by update, not insert
INSERT INTO pda_applications
(ID,PDAAT_CODE,VERSION,PART_NO,FILE_OBJECT,DEPLOY_APPLICATION_YN)
VALUES (l_seq,pa_pdaat_code,pa_version,pa_part_no,EMPTY_BLOB(),pa_deploy);
-- Lock record for update to import the file
SELECT file_object INTO l_blobLocator
FROM pda_applications
WHERE id=l_seq
FOR UPDATE;
-- Initialize the BFILE locator for reading.
l_FileLocator := BFILENAME('PDA_FILE_UPLOAD', pa_filename);
DBMS_LOB.FILEOPEN(l_FileLocator, DBMS_LOB.FILE_READONLY);
-- Load the entire file into the character LOB.
-- This is necessary so that we have the data in
-- character rather than RAW variables.
DBMS_LOB.LOADFROMFILE(l_blobLocator, l_FileLocator
,DBMS_LOB.GETLENGTH(l_FileLocator)
,src_offset => 1);
-- Clean up.
DBMS_LOB.FILECLOSE(l_FileLocator);
-- Create download records for each user associated with the application for sending to the PDA's
-- to install the software
IF pa_deploy = 'Y' then
IF fn_deploy (pa_pdaa_id => l_seq
,pa_pdaat_code => pa_pdaat_code) != 'SUCCESS' THEN
RAISE call_fail;
END IF;
END IF;
EXCEPTION
WHEN no_params THEN
pkg_appm.pr_log_message( pa_mdl_name => g_module_name
, pa_mdl_version => fn_get_body_version
, pa_error_code => SQLCODE
, pa_location => l_location
, pa_text => 'Missing parameters'
, pa_severity => 'E'
WHEN OTHERS THEN
DBMS_LOB.FILECLOSE(l_FileLocator);
pkg_appm.pr_log_message( pa_mdl_name => g_module_name
, pa_mdl_version => fn_get_body_version
, pa_error_code => SQLCODE
, pa_location => l_location
, pa_text => SQLERRM
, pa_severity => 'E'
END pr_load_file;
I hope this may be of some help
Maybe you are looking for
-
Can i restore deleted message explain it to me please
Hi there the question i would like answered can i restore a deleted message on my iphone could some one take me through it thank you
-
Hello, Has anyone installed and configured Oracle with Veritas Cluster Server? Could you please share the knowledge or point me to the right documentation? thanks,
-
Capture the Invoice Split Reason and update it in the invoice header text
Hi All, We have a requirement where we need to capture the invoice split reason and update the reason in the one of the invoice header text. Problem is the routine where the split criteria is being determined is called a number of times, so how will
-
I'M new in EP. I try to intall kmc,but failed in the phase deploy KMC. the error message in sapinst.log as follow <b>INFO 2006-01-18 14:18:55 Execution of the command "F:\usr\sap/OP1/JC01/j2ee/os_libs/jcmon.exe 'pf=F:\usr\sap\OP1\SYS\profile/OP1_JC01
-
HT4061 my i-pad is frozen I can't get the serial number
I am in the process of download the updated software to my i-pad and it froze... the screen reads "iTunes". I cannot get my serial number.