ADVANCED SQL*LOADER

제품 : ORACLE SERVER
작성날짜 : 2002-04-25
Advanced SQL*LOADER
====================
PURPOSE
Q&A를 통한 SQL*LOADER 사용 방법에 대해 알아보도록 한다.
Explanation
1) Carriage returns, linefeeds, EOL character를 load 하는 방법
2) Delimiter 를 사용한 경우 특정 field 를 skip 할수 있나?
3) "FIELD IN DATA FILE EXCEEDED MAXIMUM SPECIFIED LENGTH" 메세지
해결 방법
4) Blob 이나 raw data 는 어떻게 사용하나?
5) Error LDR-510은 어떻게 처리하나?
6) EBCDIC Characterset data file 은 어떻게 load 하나?
7) Control file 에 WE8EBCDIC500 characterset 을 사용하였는데도
SQL*Loader-266 가 발생하는 경우
8) Decimal data는 어떻게 load 하는가?
9) Trailing signs 이 있는 숫자는 어떻게 load 하는가?
10) Zoned number는 무엇인가?
11) Packed Decimal Number는 무엇인가?
12) NULLIF 는 어떻게 사용하나 ?
13) 한개의 single column을 위해 여러 개의 nullif는 사용가능한가?
14) SQL*Loader 가 NULL 로 여기는 column 을 blank space 로
여기도록 만들려면 ?
15) WHEN 절은 어떻게 사용하나?
16) WHEN 절에 OR 를 사용할수 있는가?
17) Delimiter 로 ','를 사용하였는데 data 에 ','가 포함된 경우는?
18) 어떻게 하면 commit 을 덜 사용할 수 있나?
1) carriage returns, linefeeds, EOL character를 load 하기
SQL*Loader 는 이들을 통해 서로 다른 physical record 로 인식한다.
이들을 load 하기 위해 사용되는 option 은
- concatenate
- continueif
- file processing option: FIX (PRE: 1012555.6 PRS: 2060647.6)
- file processing option: VAR (PRE: 1011372.6 PRS: 2059405.6)
예제1) concatenate 사용하기
Control File: test.ctl
load data
infile 'test.dat'
truncate
concatenate (2)
into table test
(col1 char(2000))
Data File: 'test.dat'
This is a test \n
this is the second Line.
This is a new record\n
this is the second line of the second record
결과:
SQL> select * from test;
COL1
This is a test \nthis is the second Line.
This is a new record\nthis is the second line of the second record
예제2) continueif 를 사용하기
Control File: test.ctl
load data
infile test.dat
truncate
continueif this (1) = '*'
into table test
(col1 char(64000))
Data File: 'test.dat'
*11111111111
*22222222222
*33333333333
*44444444444
*55555555555
66666666666
*77777777777
*88888888888
999999999999
*aaaaaaaaaaa
*bbbbbbbbbbb
cccccccccccc
*ddddddddddd
*eeeeeeeeeee
*fffffffffff
*ggggggggggg
*hhhhhhhhhhh
결과 :
SQL> select * from test;
COL1
11111111111222222222223333333333344444444444555555555556666666666
777777777778888888888899999999999
aaaaaaaaaaabbbbbbbbbbbccccccccccc
dddddddddddeeeeeeeeeeefffffffffffggggggggggghhhhhhhhhhh
2) delimiter 를 사용한 경우 특정 field 를 skip 할수 있나 ?
: 불가능하다 (RTSS Bulletin: 103235.426)
3): 모든 column 에 해당 column 에 해당하는 length 를 지정하였는데
다음과 같은 error message 를 접한 경우 :
"FIELD IN DATA FILE EXCEEDED MAXIMUM SPECIFIED LENGTH"
:255 자 이상의 char/varchar2/long field 를 load 하려한 경우
이 경우는 CHAR data type 의 buffer size 를 증가 시켜야 한다.
이의 default 는 255 이다.
예제)
load data
into table
(col1 char(64000))
이 경우 buffer 를 64K 로 증가시켜 col1 에 load 해야 한다.
<주의> 64K 는 sql*loader 에서 사용 가능한 maximum record length이다.
이는 1 record 를 여러개의 buffer 를 통해 load 하지 못하는 문제이다.
최대 buffer 는 64k 이다.
64 K 이상을 원하는 경우
a) 여러개의 작은 chunk 로 나누거나,
b) SQL*Loader 를 사용하지 못한다.
4) blob 이나 raw data 는 어떻게 사용하나 ?
: RAW datatype 을 사용하고 length를 부여한다.
예제)
LOAD DATA
INFILE xx.dat "VAR"
REPLACE
INtO TABLE test
(BLOB raw (32767) )
xx.dat 는 load 하고자 하는 전체 file 이다.
이는 bit mapped files 이나, 그외 file type 을 DB 에 load 시
사용 가능한 option 이다.
5) error LDR-510은 어떻게 처리한가 ?
: LDR-510은 data file 안의 physical record가 최대값인 64K 를
넘은 경우이다.
SQL*Loader 에서는 physical record 가 연속적이어야 하며, 이는
최대인 64k 를 넘지 못하는 제한이 있기 때문이다.
(여러 buffers 를 통해 load 불가능)
이는 위의 1번과 같으므로 physical record 를 여러 logical record 로
나누어야 한다.
6) EBCDIC Characterset data file 은 어떻게 load 하나 ?
: control file 에 characterset 을 명시한다.
많이 사용되는 EBCDIC character set 은 WE8EBCDIC500 이다.
예제)
load data
characterset we8ebcdic500
infile *
replace
into table for_load
(x)
begindata
B
Z
X
SQL> select * from for_load;
X
a
i
이는 ASCII 의 경우도 같다.
7) control file 에 WE8EBCDIC500 characterset 을 사용하였는데도
SQL*Loader-266 가 발생하는 경우
환경변수인 ORA_NLS 가 맞게 설정되었는지를 check 한다.
(PRE: 1012552.6 PRS: 2060644.6)
8) decimal data 는 어떻게 load 하는가?
: data 를 조작하는 방법밖에 없다.즉 decimal point 가 들어가게
data 를 조작한다.
예제)
load data
infile *
truncate
into table test
(col1 integer external(5) ":col1/100")
begindata
12345
10000
24983
SQL> select * from test;
COL1
123.45
100
249.83
9) trailing signs 이 있는 숫자는 어떻게 load 하는가?
예제)
load data
infile *
truncate
into table loadnums
(col1 position(1:5),
col2 position(7:16) "to_number(:col2,'99,999.99MI')")
begindata
abcde 1,234.99-
abcde 11,234.34+
abcde 45.23
abcde 99,234.38-
abcde 23,234.23+
abcde 98,234.23+
SQL> select * from loadnums;
COL1 COL2
abcde -1234.99
abcde 11234.34
abcde -99234.38
abcde 23234.23
abcde 98234.23
<주의> 이경우 log file 에 다음의 error message 를 볼수있다.
Record 3: Rejected - Error on table LOADNUMS, column COL2.
ORA-01722: invalid number
이 error message 는 당연한 것이다.
왜냐면 control file 에 number datatype 에 mask 를 주었기 때문에
모든 number 는 mask 를 가져야 한다.
이때 Record 3은 trailing sign 이 없기 때문에 reject 된 것이다.
10) zoned number는 무엇인가?
이는 decimal digit 의 string 으로 1byte 에 1 string 이 해당된며,
부호가 맨 마지막byte 에 포함되는 경우이다.
예제)
LOAD DATA
infile *
append
INTO TABLE test
(col1 position(1:3) zoned(3),
col2 position(4:6),
col3 position(7:8))
begindata
12J43323
43023423
SQL> select * from test;
COL1 COL2 COL3
-121 433 23
430 234 23
2 rows selected.
다음은 zoned values의 map 이다:
{ABCDEFGHI}JKLMNOPQR0123456789
++++++++++----------++++++++++
{ABCDEFGHI}JKLMNOPQR
01234567890123456789
11) Packed Decimal Number는 무엇인가 ?
: packed decimal format은 bytes 로 이루어진 1 string 의 모음인데
각각은 2 digit (2 nibbles) 을 가진다.
이중 마지막 byte 는 1 digit 와 sign 으로 이루어진다.
이 sign 은 보통 0x0a, 0x0b, ..., 0x0f: usually 0x0c/a/e/f for +ve,
0x0d/b for -ve 로 이루어져 있다.
예를 들어 +123 의 packed decimal 표현은 다음과 같다.
[12] [3C] 이고 이때 [12] 는 nibbles 0x01 and 0x02를 포함하는
byte 이다. [3C]의 경우도 같다.
The kernel 은 sing nibble 의 여부를 ttcp2n() 을 통해 check한다.
만일 0x0a, ..., 0x0f 중의 하나가 아니면 ORA-1488 error 를 발생시킨다.
<주의> BUG:296890:
이는 bug 는 아니며, SQL*Loader 는 COBOL 에서 발생시키는 UNSIGNED
packed decimal 을 support 하지 않는다.
즉 SQL*Loader 는 packed decimal을 load 시 마지막 byte 가 반드시
1 digit와 ,sign 이 포함되어지는지 check 한다.
12) NULLIF 는 어떻게 사용하나 ?
예제)
load data
infile *
truncate
into table test
fields terminated by ','
(col1 date "mm/dd/yy" nullif col1='0', col2)
begindata
0,12345
11/11/95,12345
0,12345
11/11/95,12345
SQL> select * from test;
COL1 COL2
12345
11-NOV-95 12345
12345
11-NOV-95 12345
13) 한개의 single column을 위해 여러 개의 nullif 는 사용가능한가 ?
: 불가능하다. 그러나 workaround 로는
예제)
load data
infile *
truncate
into table test
fields terminated by ',' optionally enclosed by '"'
(col1,col2 "decode(:col2,'X',NULL,'Y',NULL,'Z',NULL,:col2)",col3)
begindata
12345,"X",12345
12345,"A",12345
12345,"Y",12345
12345,"Z",12345
12345,"B",12345
SQLDBA> select * from test;
COL1 COL2 COL3
12345 12345
12345 A 12345
12345 12345
12345 12345
12345 B 12345
5 rows selected.
14) SQL*Loader 가 NULL 로 여기는 column 을 blank space 로 여기도록
만들려면 ?
: PRESERVE BLANKS를 사용하지 않으면 loader 는 blank 들을 null 로
인식한다.
이 경우 workaround 로는
예제)
load data
infile *
into table test
fields terminated by ','
(col1 position(1:5) integer external,
col2 position(15:20) char "nvl(:col2,' ')",
col3 position(25:30) integer external)
begindata
12345 rec1 12345
12345 23453
23333 rec3 29874
98273 98783
98723 rec5 234
SQL> select * from test yields;
COL1 COL2 COL3
12345 rec1 12345
12345 23453
23333 rec3 29874
98273 98783
98723 rec4 234
5 rows selected.
15) WHEN 절은 어떻게 사용한가 ?
예제)
load data
infile *
truncate
into table t1
when col1 = '12345'
(col1 position(1:5) integer external, col2 position(7:12) char)
into table t2
when col1 = '54321'
(col1 position(1:5) integer external, col2 position(7:12) char)
begindata
12345 table1
54321 table2
99999 no tab
12345 table2
54321 table2
SQL> select * from t1;
COL1 COL2
12345 table1
12345 table2
SQL> select * from t2;
COL1 COL2
54321 table2
54321 table2
16) WHEN 절에 OR 를 사용할수 있는가 ?
: 불가능하다 그러나 workaround 로는
예제) 만일 where (col1=12345 OR col1=54321) AND col2='rowena'경우에
data 를 insert 하고자 하면
load data
infile *
truncate
into table test
when col1 = '12345' and col2='rowena'
(col1 position(1:5) integer external, col2 position(7:12) char)
into table test
when col1 = '54321' and col2='rowena'
(col1 position(1:5) integer external, col2 position(7:12) char)
begindata
12345 rowena
43234 rowena
54321 rowena
(즉, OR를 갖지 못하나, 같은 table 에 두개의 when 은 가질수있다.)
SQLDBA> select * from test;
COL1 COL2
12345 rowena
54321 rowena
2 rows selected.
17) delimiter 로 ','를 사용하였는데 data 에 ','가 포함된 경우는 ?
: 두 번 지정한다.
예제)
load 할 data 가 col1, rowena, rowena, col3 이고
datafile 이 다음과 같은 경우
col1, rowena,, rowena, col3
select * from table:
COL1 COL2 COL3
col1 rowena, rowena col3
18) 어떻게 하면 commit 을 덜 사용할 수 있나 ?
: rows 나 bindsize를 사용한다.
그러나 bindsize 가 적은 경우 bindsize는 rows 를 많이 적재할 수
있으므로 항상 1 bindsize 에 몇 개의 rows 가 set 되었는지에 관계
없이 bindsize에 commit 이 수행된다.
Reference Document
------------------

hi,
pls take a look at this document
http://www.petefinnigan.com/weblog/archives/00000020.htm
regards,

Similar Messages

  • Need help regarding sql loader

    Hi ,
    I am executing following command
    sqlldr admin_user@ces CONTROL=D:\sample_control.ctl log=D:\sample_log.log bad=D:\Sample_bad.bad
    In case of valid data it is inserting the data properly into the table. While invalid records added into the bad file.
    Now I want rollback valid data whenever count of bad file greater than equal to 10.
    In short whenever file has more than 10 invalid records , I don't want to insert any record from that file.
    Please provide me the solution.Thanks in advance.

    SQL*Loader Command-Line Reference
    DISCARDMAX(integer)
    Regards
    Etbin

  • SQL Loader Inserts chr(13) and chr(10) in the first column of every row.

    Hi,
    I have exported a data in a pipe delimited file using TOAD in one database. Now I want to load the data in my local database using SQL Loader. However every time I try to load the data a double quote followed by a new line is entered for the first column of each row. Unfortunately the delimited file is very big and hence can't be posted here. However I tried the same with a customized table and its data and found the same problem. Below are the table structures and control file that I used.
    create table test_sql
    a varchar2(30),
    b date
    insert into test_sql values('51146263',sysdate-3);
    insert into test_sql values('51146261,sysdate-1);
    EXPORTED PIPE DELIMITED FILE_
    A|B|!##!
    51146261|04/14/13 4:55:18 PM|!##!
    51146263|04/12/13 4:55:32 PM|!##!
    create table test_sql1 as select * from test_sql where 1=2;
    CONTROL FILE_
    OPTIONS(SKIP=1)
    LOAD DATA
    INFILE 'C:\Users\Prithwish\Desktop\Test.txt' "str '!##!'"
    PRESERVE BLANKS
    INTO TABLE TEST_SQL1
    FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    A CHAR(2000),
    B DATE "MM/DD/YYYY HH12:MI:SS AM"
    select * from TEST_SQL1;
    After this when I paste it in notepad I get the following result
    A B
    51146261"     14-APR-0013 16:55:18
    51146263"     12-APR-0013 16:55:32.
    I have no idea how the quotes or the newline appear. Is this a Toad bug? Any help would be greatly appreciated. Really urgent.
    Thanks in advance
    Regards

    Hi Harry,
    I actually thought that the str !##! was causing the problem. Actually my original export has some new lines in some specific columns so I can't keep the new line as my line terminator and hence I kept the !##! as my terminator.
    When I put the same data in a notepad and load it there is no problem at all. For e.g I just typed the following in a notepad and the data loaded just fine.
    A|B|!##!
    51146261|01-01-01 10:10:10 AM|!##!
    51146263|01-01-01 11:11:11 AM|!##!
    Its just when I load the exported file there the problem arises though I have verified the file using UNIX as well using octal dump and found no hidden characters.
    Regards,
    Prithwish

  • How do I skip footer records in Data file through control file of sql*loade

    hi,
    I am using sql*loader to load data from data file and i have written control file for it. How do i skip last '5' records of data file or the footer records to be skiped to read.
    For first '5' records to be skiped we can use "skip" to achieve it but how do i acheive for last '5' records.
    2)
    Can I mention two data files in one control file if so what is the syntax(like we give INFILE Where we mention the path of data file can i mention two data file in same control file)
    3)
    If i have datafile with variable length (ie 1st record with 200 charcter, 2nd with 150 character and 3rd with 180 character) then how do i load data into table, i mean what will be the syntax for it in control file.
    4)if i want to insert sysdate into table through control file how do i do it.
    5) If i have variable length records in data file and i have first name then white space between then and then last name, how do i insert this value which includes first name and last name into single column of the table.( i mean how do you handle the white space in between first name and last name in data file)
    Thanks in advance
    ram

    You should read the documentation about SQL*Loader.

  • Loading the data from a packed decimal format file using a sql*loader.

    Hi ,
    In one of the project i'm working here i have to load the data into oracle table from a file using a Sql*loader but the problem is the data file is in the packed decimal format so please let me know if there is any way to do this....I search a lot regarding this ..If anybody faced such type of problem ,then let me the steps to solve this.
    Thanks in advance ,
    Narasingarao.

    declare
    f utl_file.file_type;
    s1 varchar2(200);
    s2 varchar2(200);
    s3 varchar2(200);
    c number := 0;
    begin
    f := utl_file.fopen('TRY','sample1.txt','R');
    utl_file.get_line(f,s1);
    utl_file.get_line(f,s2);
    utl_file.get_line(f,s3);
    insert into sampletable (a,b,c) values (s1,s2,s3);
    c := c + 1;
    utl_file.fclose(f);
    exception
    when NO_DATA_FOUND then
    if utl_file.is_open(f) then utl_file.fclose(f); ens if;
    dbms_output.put_line('No. of rows inserted : ' || c);
    end;SY.

  • How to Load Arabic Data from flat file using SQL Loader ?

    Hi All,
    We need to load Arabic data from an xls file to Oracle database, Request you to provide a very good note/step to achieve the same.
    Below are the database parameters used
    NLS_CHARACTERSET AR8ISO8859P6
    nls_language american
    DB version:-10g release 2
    OS: rhel 5
    Thanks in advance,
    Satish

    Try to save your XLS file into CSV format and set either NLS_LANG to the right value or use SQL*Loader control file parameter CHARACTERSET.
    See http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/ldr_control_file.htm#i1005287

  • SQL Loader-704: Internal error: Maximum record length must be = [10000000]

    Hi,
    running SQL*Loader (Release 8.1.7.2.1) causes an error "SQL*Loader-704: Internal error: Maximum record length must be <= [10000000]". This error occurs when SQLLoader is trying to load several thousand records into a database table. Each record is less than 250 bytes in length.
    Any idea what could cause the problem?
    Thanks in advance!
    Ingo
    And here's an extract from the log file generated by SQLLoader :
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 50
    Bind array: 1360 rows, maximum of 10485760 bytes
    Continuation: none specified
    Path used: Conventional
    Table "SYSTEM"."BASICPROFILE$1", 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
    UUID FIRST * O(X07) CHARACTER
    DOMAINID NEXT * O(X07) CHARACTER
    LASTMODIFIED NEXT * O(X07) DATE DD/MM/YYYY HH24:MI:SS
    ANNIVERSARY NEXT * O(X07) CHARACTER
    BIRTHDAY NEXT * O(X07) CHARACTER
    COMPANYNAME NEXT * O(X07) CHARACTER
    DESCRIPTION NEXT * O(X07) CHARACTER
    FIRSTNAME NEXT * O(X07) CHARACTER
    COMPANYNAMETRANSCRIPTION NEXT * O(X07) CHARACTER
    FIRSTNAMETRANSCRIPTION NEXT * O(X07) CHARACTER
    GENDER NEXT * O(X07) CHARACTER
    HOBBIES NEXT * O(X07) CHARACTER
    HONORIFIC NEXT * O(X07) CHARACTER
    JOBTITLE NEXT * O(X07) CHARACTER
    KEYWORDS NEXT * O(X07) CHARACTER
    LASTNAME NEXT * O(X07) CHARACTER
    LASTNAMETRANSCRIPTION NEXT * O(X07) CHARACTER
    NICKNAME NEXT * O(X07) CHARACTER
    PREFERREDLOCALE NEXT * O(X07) CHARACTER
    PREFERREDCURRENCY NEXT * O(X07) CHARACTER
    PROFESSION NEXT * O(X07) CHARACTER
    SECONDLASTNAME NEXT * O(X07) CHARACTER
    SECONDNAME NEXT * O(X07) CHARACTER
    SUFFIX NEXT * O(X07) CHARACTER
    TITLE NEXT * O(X07) CHARACTER
    CONFIRMATION NEXT * O(X07) CHARACTER
    DEFAULTADDRESSID NEXT * O(X07) CHARACTER
    BUSINESSPARTNERNO NEXT * O(X07) CHARACTER
    TYPECODE NEXT * O(X07) CHARACTER
    OCA NEXT * O(X07) CHARACTER
    SQL*Loader-704: Internal error: Maximum record length must be <= [10000000]

    As a second guess, the terminator changes or goes missing at some point in the data file. If you are running on *NIX, try wc -l data_file_name.  This will give a count of the number of lines (delimited by CHR(10) ) that are in the file.  If this is not close to the number you expected, then that is your problem.
    You could also try gradually working through the data file loading 100 records, then 200, then 300 etc. to see where it starts to fail.
    HTH
    John

  • SQL loader : how to populate a calculated feild of a table?

    Hi All,
    I have a table which has total 92 columns, among them 6 feilds are calculated using few other fields of the same table.
    i have a csv file , which has only 86 feilds .
    during upload data using sql loader, is it possible to calculate other 6 feilds and upload them along with 86 fields ?
    Or any other method to populate the calculated values?
    Thanks in advance,
    Archana

    Hi Archana,
    You can have a script file with the required update commands and execute that script after the Loader loads the data to have them updated.
    But it is not a good practice to store the calculated values in the fields.
    Whenever required you can have them as a calculation in your select statements instead of storing them in the table.
    Unfortunately if the base values get changed you would be forced to recalculate and store them if you have them in the table.
    Regards,
    S.Muthukumar.

  • Substitution variable in sql load rules file

    Okay gurus,
    I need a little guidance, I have to replace the value of 201020 and 2008 from substitution variables. I have created the variables and set them up globally on the essbase server.
    201020 = FW00
    2008 = FY00
    WHERE ACT.FISCAL_WEEK_ID <= 201020
    AND ACT.FISCAL_YEAR_ID > 2008
    AND RTDIV.DIV IN (1,2,3,4,5,6,7,8,9,99) (This is the query with hard coded values of week and year)
    When i m trying to put sub variables there , its throwing the error. please find below the way i was trying to do it.
    WHERE ACT.FISCAL_WEEK_ID = '&FW00'
    AND ACT.FISCAL_YEAR_ID = '&FY00'
    But unfortunately, its throwing error Error: 1021001 Failed to Establish Connection With SQL Database Server. See log for more information
    I know that this is the generic error because if i put the hard coded value in sql load rules it works fine.
    Is it the right way to out sub var in sql load rules???
    Please advice and thanks in advance.

    Hi Genn,
    I tried to see the app log for sql but i m afraid that there is nothing in there, the only error message which I am getting in app log is this:
    Failed to Establish Connection With SQL Database Server. See log for more information
    Its an ASO cube and initially i was using the variable as FY00 AS "2008" it did not work and than i tried without quotes in variable but is still not working.
    Any idea..thanks in advance.

  • Sql Loader and carriage returns

    I am currently trying to use sql loader to load data from flat files that was extracted from sybase using bcp and delimited with pipes. There are text and varchar columns that contain carriage return line feeds. I want to preserve these, but I can not load them into Oracle 8.05 using sql loader as it interprets them as end of record indicators. Does anyone have a way to solve this problem? Any assistance would be appreciated.
    Thanks in advance,
    Jignesh

    External tables are accessible from SQL, which generally simplifies life if the data files are physically located on the database server since you don't have to coordinate a call to an external SQL*Loader script with other PL/SQL processing. Under the covers, external tables are normally just invoking SQL*Loader.
    SQL*Loader is more appropriate if the data files are on a different server or if it is easier to call an executable rather than calling PL/SQL (i.e. if you have a batch file that runs on a server other than the database server that wants to FTP a data file from a FTP server and then load the data into Oracle).
    Justin

  • SQL Loader and Floating Point Numbers

    Hi
    I have a problem loading floating point numbers using SQL Loader. If the number has more than 8 significant digits SQL Loader rounds the number i.e. 1100000.69 becomes 1100000.7. The CTL file looks as follows
    LOAD DATA
    INFILE '../data/test.csv' "str X'0A'"
    BADFILE '../bad/test.bad'
    APPEND
    INTO TABLE test
    FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"'
    Amount CHAR
    and the data file as follows
    "100.15 "
    "100100.57 "
    "1100000.69 "
    "-2000000.33"
    "-100000.43 "
    the table defined as follows
    CREATE TABLE test
    Amount number(15,4)
    ) TABLESPACE NNUT050M1;
    after loading a select returns the following
    100.15
    100100.57
    1100000.7
    -2000000
    -100000.4
    Thanks in advance
    Russell

    Actually if you format the field to display as (say) 999,999,999.99, you will see the correct numbers loaded via SQL Loader.
    null

  • SQL   Loader and Error ORA-01847/ORA-01839

    Hi,
    While using the direct loading in SQL-LOADER when we get the ORA-01847/ORA-01839 all the other records are getting errorred out. It goes fine with the conventional loading.
    Should I use some parameters or anything to make sure that all the other records are not rejected when we get the ORA-01847/ORA-01839 error while going with the DIRECT loading.
    Thanks
    Jibin

    In internet I found this short message:
    “AL32UTF8 is a multi-byte characterset,that means some characters are stored in more than 1 character, that's true for these special characters.
    If you have same table definitions in both databases you likely face error ORA-12899.
    This metalink note discusses this problem, it's also applicable to sqlloader:
    Import reports "ORA-12899: Value too large for column" when using BYTE semantic
    Doc ID: Note:563893.1”
    By metalink, I can see the Note linked to a one Oracle Internal Bug for Oracle 11g.....
    I'm waiting you suggestion... thanks very much in advance.
    Regards.
    Giovanni

  • Calling Sql Loader In Apex

    Hi All,
    Is there any way to call the sql loader in Apex to load the table with csv data.
    Thanks in advance
    Dhan

    Do you need the application to load data for users as a function or are you just trying to load some data. Application Express has loading/unloading utilities from the main workspace menu that you can use for one time loads.

  • SQL Loader (how to cut data header)

    Hi there,
    [oracle 11g]
    I got the following text file:
    mod; DD.MM.YYYY; HH:MM:SS; aligned
    src; "ptv "; "15.04.2012"; "10:47:49"
    chs; "ISO8859-1"
    ver; "V1.0"
    ifv; "V1.0"
    dve; "V1.0"
    fft; "LIO"
    tbl; MENGE_FGR
    atr; BASIS_VERSION; FGR_NR; FGR_TEXT
    frm; num[9.0]; num[5.0]; char[40]
    rec;        122;     8; "VVZ"   
    rec;        123;     18; "VHZ"
    rec;        124;     13; "VTZ"    Now I am interested in the column TBL and ATR and follwing rawdata
    Do you see a way to automatically create the table MENGE_FR with columns BASIS_VERSION; FGR_NR;FGR_TEST and column types num, num, char and insert the raw data below?
    PS:OK, this is mysql ...so I need to convert this first to sql. So you should see num as number.
    Thx in advance Thorsten
    Edited by: Thorsten on 16.05.2013 07:30
    Edited by: Thorsten on 16.05.2013 07:32

    There are various ways that you could do this. I have demonstrated one method below. I created a table with two columns, then used SQL*Loader to load the data from the text file into those two columns. Skipping the header rows is optional. You could also use an external table instead, if the text file is on your server, not your client. I then used some PL/SQL to create and execute "create table" and "insert" statements. This is just some starter code. You will need to make modifications to handle other data types and such that were not in the example that you provided, but it should give you the general idea.
    SCOTT@orcl_11gR2> host type text_file.dat
    mod; DD.MM.YYYY; HH:MM:SS; aligned
    src; "ptv "; "15.04.2012"; "10:47:49"
    chs; "ISO8859-1"
    ver; "V1.0"
    ifv; "V1.0"
    dve; "V1.0"
    fft; "LIO"
    tbl; MENGE_FGR
    atr; BASIS_VERSION; FGR_NR; FGR_TEXT
    frm; num[9.0]; num[5.0]; char[40]
    rec;        122;     8; "VVZ"
    rec;        123;     18; "VHZ"
    rec;        124;     13; "VTZ"
    SCOTT@orcl_11gR2> host type test.ctl
    options(skip=7)
    load data
    infile text_file.dat
    into table tbl
    (col1 terminated by ';',
    col2 terminated by x'0a')
    SCOTT@orcl_11gR2> create table tbl
      2    (col1  varchar2(4),
      3     col2  varchar2(60))
      4  /
    Table created.
    SCOTT@orcl_11gR2> host sqlldr scott/tiger control=test.ctl log=test.log
    SQL*Loader: Release 11.2.0.1.0 - Production on Thu May 16 13:44:24 2013
    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
    Commit point reached - logical record count 6
    SCOTT@orcl_11gR2> select * from tbl
      2  /
    COL1 COL2
    tbl   MENGE_FGR
    atr   BASIS_VERSION; FGR_NR; FGR_TEXT
    frm   num[9.0]; num[5.0]; char[40]
    rec          122;     8; "VVZ"
    rec          123;     18; "VHZ"
    rec          124;     13; "VTZ"
    6 rows selected.
    SCOTT@orcl_11gR2> declare
      2    v_tab   varchar2(30);
      3    v_atr   varchar2(32767);
      4    v_frm   varchar2(32767);
      5    v_sql   varchar2(32767);
      6    v_cols  number;
      7    v_next  varchar2(32767);
      8  begin
      9    select col2 into v_tab from tbl where col1 = 'tbl';
    10    select col2 || ';' into v_atr from tbl where col1 = 'atr';
    11    select col2 || ';' into v_frm from tbl where col1 = 'frm';
    12    v_sql := 'CREATE TABLE ' || v_tab || ' (';
    13    select regexp_count (col2, ';') + 1 into v_cols from tbl where col1 = 'atr';
    14    for i in 1 .. v_cols loop
    15      v_sql := v_sql || substr (v_atr, 1, instr (v_atr, ';') - 1) || ' ';
    16      v_next := substr (v_frm, 1, instr (v_frm, ';') - 1);
    17      v_next := replace (v_next, '[', '(');
    18      v_next := replace (v_next, ']', ')');
    19      v_next := replace (v_next, '.', ',');
    20      v_next := replace (v_next, 'num', 'number');
    21      v_next := replace (v_next, 'char', 'varchar2');
    22      v_sql := v_sql || v_next || ',';
    23      v_atr := substr (v_atr, instr (v_atr, ';') + 1);
    24      v_frm := substr (v_frm, instr (v_frm, ';') + 1);
    25    end loop;
    26    v_sql := rtrim (v_sql, ',') || ')';
    27    dbms_output.put_line (v_sql);
    28    execute immediate v_sql;
    29    for r in (select col2 from tbl where col1 = 'rec') loop
    30      v_sql := 'INSERT INTO ' || v_tab || ' VALUES (''';
    31      v_sql := v_sql || replace (replace (r.col2, ';', ''','''), '"', '');
    32      v_sql := v_sql || ''')';
    33      dbms_output.put_line (v_sql);
    34      execute immediate v_sql;
    35    end loop;
    36  end;
    37  /
    CREATE TABLE  MENGE_FGR ( BASIS_VERSION  number(9,0), FGR_NR  number(5,0),
    FGR_TEXT  varchar2(40))
    INSERT INTO  MENGE_FGR VALUES ('        122','     8',' VVZ')
    INSERT INTO  MENGE_FGR VALUES ('        123','     18',' VHZ')
    INSERT INTO  MENGE_FGR VALUES ('        124','     13',' VTZ')
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> describe menge_fgr
    Name                                      Null?    Type
    BASIS_VERSION                                      NUMBER(9)
    FGR_NR                                             NUMBER(5)
    FGR_TEXT                                           VARCHAR2(40)
    SCOTT@orcl_11gR2> select * from menge_fgr
      2  /
    BASIS_VERSION     FGR_NR FGR_TEXT
              122          8  VVZ
              123         18  VHZ
              124         13  VTZ
    3 rows selected.

  • Need to Skip the fields duaring the data upload by SQL*Loader.

    Hi all,
    I am not able to get how to skip some fileds in the file while uploading it thru SQL*Loader. Let us have a look the below scenario.
    The table has 4 columns. but in the input file came up with 6 fields. Let us assume the four fields came as first in the order. Then, we can populate the data into the 4 columns of the table. At the same time we want to skip the remaining fields. Even those fields/columns are no longer available in the database table.
    For example:
    create table data_temp(sno number,name varchar2(10 char),sex char(1),loc varchar2(20 char));
    Data file
    sno,name,sex,loc,organization,contact
    1,ram,M,India,HP,998976789
    2,Shesha,M,India,IBM,7890808098
    Control_file
    OPTIONS(SKIP=1)
    LOAD DATA
    INFILE *
    APPEND INTO TABLE data_temp
    FIELDS TERMINATED BY ',' optionally enclosed by '"'
    TRAILING NULLCOLS
    sno "trim(:sno)",
    name "SUBSTR(trim(:name),1,20)" ,
    sex "SUBSTR(trim(:sex),1,1)",
    loc "SUBSTR(trim(:loc),1,20)" ,
    Please suggest me how to implement the above scenario in the control file.
    Thanks in Advance!!
    Regards,
    Vissu.....

    Use FILLER. Control file:
    OPTIONS(SKIP=1)
    LOAD DATA
    INFILE *
    APPEND INTO TABLE data_temp
    FIELDS TERMINATED BY ',' optionally enclosed by '"'
    TRAILING NULLCOLS
    sno "trim(:sno)",
    name "SUBSTR(trim(:name),1,20)" ,
    sex "SUBSTR(trim(:sex),1,1)",
    loc "SUBSTR(trim(:loc),1,20)" ,
    organization filler,
    contact filler
    begindata
    sno,name,***,loc,organization,contact
    1,ram,M,India,HP,998976789
    2,Shesha,M,India,IBM,7890808098
    {code}
    Now:
    {code}
    SQL> create table data_temp(sno number,name varchar2(10 char),sex char(1),loc varchar2(20 char));
    Table created.
    SQL> host sqlldr scott/tiger control=c:\temp\vissu.ctl log=c:\temp\vissu.log
    SQL> select * from data_temp
      2  /
           SNO NAME       S LOC
             1 ram        M India
             2 Shesha     M India
    SQL>
    {code}
    SY.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for

  • New Mail Message Won't Let Me Delete Attachment

    MacBook Pro (Retina, 15-inch, Mid 2014) 10.10.2 (14C109) 2.8 GHz Intel Core i7 16 GB 1600 MHz DDR3 500 GB SSD NVIDIA GeForce GT 750M 2048 MB Now some fun with emails. I composed a lengthy, carefully thought out, email to my CPA.  Then, without thinki

  • Installing Windows Vista Ultimate 64 bit on Bootcamp issue

    Hi I'm a newbie, I would like to install Windows Vista Ultimate 64 bit using boot camp. I went into boot camp to partition and split the 1 terabyte hardrive. half is for Leopard, the other half is for Windows Vista. I followed the steps and popped in

  • Foreign currency valuation(f.05) reversal is not getting posted automatically.

    Hi All, i performed foreign currency valuation using F.05 with evaluation key date as 31/05/2014. i checked the check boxes  'create postings' and 'reverse postings' for G/L account balance valuation and haven't entered any date for reversal 'posting

  • Pages won't open doc or docx documents

    I am a professor and my students upload papers to a LMS either as a doc or docx. I then download them and open them in Pages. Suddenly I am no longer able to open any documents in Pages. Can someone please

  • Best Practices for Remote Data Communication?

    Hello all I am developing a full-fledged website in Flex 3.4 and Zend Framework, PHP. I am using the Zend_AMF class in Zend framework for communicating the data to remote server. I will be communicating to database in the following way... get data fr