SQL*Loader Ref Column

Hallo,
I have the following problem. I have 2 tables which I created the following way:
CREATE TYPE gemark_schluessel_t AS OBJECT(
gemark_id NUMBER(8),
gemark_schl NUMBER(4),
gemark_name VARCHAR2(45)
CREATE TABLE gemark_schluessel_tab OF gemark_schluessel_t(
constraint pk_gemark PRIMARY KEY(gemark_id)
CREATE TYPE flurstueck_t AS OBJECT(
flst_id NUMBER(8),
flst_nr_zaehler NUMBER(4),
flst_nr_nenner NUMBER(4),
zusatz VARCHAR2(2),
flur_nr NUMBER(2),
gemark_schluessel REF gemark_schluessel_t,
flaeche SDO_GEOMETRY
CREATE TABLE flurstuecke_tab OF flurstueck_t(
constraint pk_flst PRIMARY KEY(flst_id),
constraint uq_flst UNIQUE(flst_nr_zaehler,flst_nr_nenner,zusatz,flur_nr),
flst_nr_zaehler NOT NULL,
flur_nr NOT NULL,
gemark_schluessel REFERENCES gemark_schluessel_tab
Now I have data in the gemark_schluessel_tab which looks like this (a sample):
1 101 Borna
2 102 Draisdorf
Now I wanna load data in my flurstuecke_tab with SQL*Loader and there I have problems with my ref column gemark_schluessel.
One data record looks like this in my file (it is without geometry)
1|97|7||1|1|
If I wanna load my data record, it does not work. The reference (the system generated OID) should be taken from gemark_schluessel_tab.
LOAD DATA
INFILE *
TRUNCATE
CONTINUEIF NEXT(1:1) = '#'
INTO TABLE FLURSTUECKE_TAB
FIELDS TERMINATED BY '|'
TRAILING NULLCOLS (
flst_id,
flst_nr_zaehler,
flst_nr_nenner,
zusatz,
flur_nr,
gemark_schluessel REF(CONSTANT 'GEMARK_SCHLUESSEL_TAB',GEMARK_ID),
gemark_id FILLER
BEGINDATA
1|97|7||1|1|
Is there a error I made?
Thanks in advance
Tig

I am sure, on rereading the OPs email, you will see a disconnect between what was written and your response.
The maximum size of a VARCHAR2 columns is always 4000 bytes. The maximum size of a VARCHAR2 PL/SQL variable is always 32K bytes.
If someone is trying to load the text from an email that may exceed 4K into a table they must use a CLOB column if they wish it to be searchable as text.

Similar Messages

  • Error: SQL Loader-466 column not exist ???

    dear all.
    i have a problem with sql loader.
    The error is:
    SQL*Loader-466: Column NUM_PAQ does not exist in table PLANELEC.file
    i saw desc table:
    SQL> DESC PLANELEC.file
    Nombre ¿Nulo? Tipo
    num_paq NOT NULL CHAR(8)
    formulario NOT NULL CHAR(4)
    norden NOT NULL NUMBER(38)
    cod_docide_dec NOT NULL NUMBER(38)
    num_docide_dec NOT NULL VARCHAR2(11)
    num_correl_a NOT NULL NUMBER(38)
    cod_docide_aseg NOT NULL NUMBER(38)
    num_docide_aseg NOT NULL VARCHAR2(15)
    cod_cat_tra NOT NULL NUMBER(38)
    cod_tipo NOT NULL NUMBER(38)
    fec_ini_perlab NOT NULL DATE
    fec_fin_perlab DATE
    cod_extincion CHAR(2)
    ind_envio NUMBER(38)
    fec_envio DATE
    num_ctl CHAR(6)
    my ctl file is:
    Load DATA
    INFILE file.UNL
    INSERT
    INTO TABLE PLANELEC.file
    fields terminated by '|'
    TRAILING NULLCOLS
    NUM_PAQ,FORMULARIO,NORDEN,COD_DOCIDE_DEC,NUM_DOCIDE_DEC,NUM_CORREL_A,COD_DOCIDE_ASEG,
    NUM_DOCIDE_ASEG,COD_CAT_TRA,COD_TIPO,FEC_INI_PERLAB,FEC_FIN_PERLAB,COD_EXTINCION,
    IND_ENVIO,FEC_ENVIO,NUM_CTL
    and the first line of the file.unl is:
    00000000|0601|2000043|6|20100066603|1|1|90000001|1|20|01/02/2002|||0||613954|
    what could be the problem with that?
    thanks a lot !
    cesar
    ORACLE 10GR2
    RHEL AS V4.0

    Hi ThinkingEye,
    Please check the definition of the control file. Did you for instance inclose the file name in quotes?
    That's usually the reason for the 466 error with SQL*Loader.
    Also check column definitions and column formats that are in the definition.
    Cheers, Patrick
    ps Is this thread related to the other 2 you have with the same target table STG_GEM_EVENT_ITS?

  • SQL Loader: refer datafile name in the control file

    Hi All:
    Database: 10GR2
    I have a table as following:
    test (
    filename varchar2(100),
    mydata varchar2(1000)
    I am using sql loader to populate data for this table. I also need store the datafile name to column test.filename as part of dataload. How to refer datafile name in the control file?
    Again, I am processing multiple files in a batch mode. I need store datafile name in filename column so that I can know which "mydata" come from which datafile.
    Thanks in advance!
    Kevin

    As Bravid says, you can't do that from within SQL*Loader, unless the control files are dynamically generated by a script and the filename included as the default value for that particular column as a hardcoded literal.
    It's easier if you use external tables as the table definition contains the "location" which is the list of filenames it is accessing, and the value can be queried as well as being dynamically changed (though if you're dynamically changing it, then you'll programatically know the filename anyway. hint hint!)
    ;)

  • SQL*Loader - Skipping columns in the source file.

    Hi
    I have a comma delimted source file with 4 columns. I however only want to load columns 2 and 3 into my table using SQL*Loader. This seems like something that should be fairly simple but I can't seem to find any doc or examples of this.
    Any guidance would be appreciated.
    Thanks
    Dave

    Hello Dave,
    Here is a sample of what you'll need to have in your control fileLOAD DATA
    APPEND
    INTO TABLE <target_table>
    FIELDS TERMINATED BY ','
    ( column_1  FILLER
    , column_2
    , column_3
    , column_4  FILLER
    )Hope this helps,
    Luke

  • SQL Loader - adding column values

    Hi everybody,
    Is it possible to have a column value in SQL Loader control file that is a function of two other columns. For example I have table of 3 columns c1, c2, c3
    and data file is having c1, c2 and I want to specify c3 as c1+c2 in the control file, so that it's populated in the table while loading data file. I tried this on date column but it gave me error ora-00981.
    Can you tell me exact sysntax if possible.

    LOAD DATA
    INFILE 'C:\SQLLOADER\AREA.TXT'
    APPEND INTO TABLE AREA
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
    (c1,
    c2,
    c3 ":c2+:c1"
    kuljeet pal singh

  • More examples for loading ref column

    Hallo,
    I have a problem with loading data to a table with ref column. I don't really come along with the example in the documentation. Are there other examples where the tables are described a little bit more in detail?
    thanks in advance
    tig

    Hallo,
    I didn't know this document so thanks a lot but it seems that I can not load my ref column without additional work.
    Thanks Tig

  • SQL Loader, concatenating columns

    Is it possible to concatenate several columns in a comma-delimited input file into one column in the database.
    For example:
    INPUT FILE:
    1234,Description 1,Description2
    DATABASE FILE (has 2 columns)
    1.
    Product Number (to be populated from '1234' in the input file)
    2.
    Description (to be populated from 'Description 1 Description 2' in the input file)
    Please let me know how to do this. I was trying column object but it doesn't work.

    reference23      position(183:183) CHAR,
    SOURCE           position(183:194) CHAR NULLIF SOURCE=BLANKS,If you see the position for source column it should be 184 and not 183. I think it is a typo or you missed to spot it or I could be wrong. Just a thought
    Regards
    Raj
    Message was edited by:
    s.rajaram

  • Sql loader using sql statement

    Hi All ,
    May i know any way used sql loader refer sql statement e.g "select a from test"
    import data into other table ?
    if you have any sample or link , please let me know , thanks a lot

    If you are using the database steps, the answer is yes. I've done it by creating a data source that uses the Microsoft Text Driver in the ODBC administrator. The Open Database step is then configured like any other ODBC database. In the .csv file, I have the first line define the column names (i.e. column1, column2) and the SQL statement I use is "SELECT * FROM junk.txt". I haven't tried anything with a WHERE clause but that should work as well.

  • 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

  • Error while loading data using SQL*Loader

    Hi All,
    I am now in process of loading data from MS SQL to Oracle Database.
    I am getting the data in excel format and i will convert them into csv.
    Upto converting everything is working fine.
    In MS SQL, table columns are case sensitive.
    So i created those tables in oracle db as same.
    There is one column "MaxNumber" which is of type float(49).
    The column is case sensitive.
    in the control file first i given as
    "MaxNumber" "TO_NUMBER(:MaxNumber,'99,999.99')"
    After executing the SQL*Loader i am getting the error
    SQL*Loader-466: Column MAXNUMBER does not exist in table TABLEONE.
    I changed the control file entry as
    "MaxNumber" "TO_NUMBER(:"MaxNumber",'99,999.99')"
    After the execution i got the error
    SQL*Loader-350: Syntax error at line 13.
    Expecting "," or ")", found "MaxDiscount".
    "MaxNumber" "TO_NUMBER(:"MaxNumber",'99,999.99')"
    Please Guide me in this issue.
    Regards
    Salih KM

    What I'm saying is, verify the column name. Dont post if not possible.
    Example follows, with one table intentionally "hidden".
    SQL> create table "tEsT" ("MaxNumber" float, "MaxnumbeR" number);
    SQL> select table_name,column_name from user_tab_columns where table_name like 't%';
    TABLE_NAME                     COLUMN_NAME
    tEsT                           MaxNumber
    tEsT                           MaxnumbeR
    teST                           iD
    teST                           MaxNumberHth,
    Fredrik

  • 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,

  • HELP: SQL*LOADER AND Ref Column

    Hallo,
    I have already posted and I really need help and don't come further with this
    I have the following problem. I have 2 tables which I created the following way:
    CREATE TYPE gemark_schluessel_t AS OBJECT(
    gemark_id NUMBER(8),
    gemark_schl NUMBER(4),
    gemark_name VARCHAR2(45)
    CREATE TABLE gemark_schluessel_tab OF gemark_schluessel_t(
    constraint pk_gemark PRIMARY KEY(gemark_id)
    CREATE TYPE flurstueck_t AS OBJECT(
    flst_id NUMBER(8),
    flst_nr_zaehler NUMBER(4),
    flst_nr_nenner NUMBER(4),
    zusatz VARCHAR2(2),
    flur_nr NUMBER(2),
    gemark_schluessel REF gemark_schluessel_t,
    flaeche SDO_GEOMETRY
    CREATE TABLE flurstuecke_tab OF flurstueck_t(
    constraint pk_flst PRIMARY KEY(flst_id),
    constraint uq_flst UNIQUE(flst_nr_zaehler,flst_nr_nenner,zusatz,flur_nr),
    flst_nr_zaehler NOT NULL,
    flur_nr NOT NULL,
    gemark_schluessel REFERENCES gemark_schluessel_tab
    Now I have data in the gemark_schluessel_tab which looks like this (a sample):
    1 101 Borna
    2 102 Draisdorf
    Now I wanna load data in my flurstuecke_tab with SQL*Loader and there I have problems with my ref column gemark_schluessel.
    One data record looks like this in my file (it is without geometry)
    1|97|7||1|1|
    If I wanna load my data record, it does not work. The reference (the system generated OID) should be taken from gemark_schluessel_tab.
    LOAD DATA
    INFILE *
    TRUNCATE
    CONTINUEIF NEXT(1:1) = '#'
    INTO TABLE FLURSTUECKE_TAB
    FIELDS TERMINATED BY '|'
    TRAILING NULLCOLS (
    flst_id,
    flst_nr_zaehler,
    flst_nr_nenner,
    zusatz,
    flur_nr,
    gemark_schluessel REF(CONSTANT 'GEMARK_SCHLUESSEL_TAB',GEMARK_ID),
    gemark_id FILLER
    BEGINDATA
    1|97|7||1|1|
    Is there a error I made?
    Thanks in advance
    Tig

    multiple duplicate threads:
    to call an oracle procedure and sql loader in an unix script
    Re: Can some one help he sql loader issue.

  • SQL*Loader: How to use Sequence and REF together?

    Hi,
    I'm getting the following error:
    SQL*Loader-418: Bad datafile datatype for column AREA_ID.
    I attempt to upload one datafile into 4 different tables.
    When executing sqlldr scott/tiger control=sqlldr_aj_new.ctl
    1) Here is my Control file (sqlldr_aj_new.ctl):
    load data
    infile 'TST_MAIN_NEW.csv'
    -- Loads table "TST_AREAS"
    into table TST_AREAS
    REPLACE
    FIELDS TERMINATED by ','
    (AREA_ID SEQUENCE,
    AREA_NAME,
    PRODUCT_ID,
    PRIORITY_ID,
    PLAN_ID,
    CREATED_BY_ID,
    AREA_DESC)
    -- Loads table "TST_TEMPLATE_SCENS"
    into table TST_TEMPLATE_SCENS
    REPLACE
    FIELDS TERMINATED by ','
    (TEMPLATE_SCEN_ID SEQUENCE,
    SCENARIO_NAME,
    MODIFIED_BY_ID,
    SCEN_TYPE_ID,
    OWNER_ID,
    PRIORITY_ID,
    SCOPE_ID,
    SCENARIO_DESC,
    AREA_ID REF(CONSTANT 'TST_AREAS', AREA_ID))
    2) Here is my data file(TST_MAIN_NEW.csv)
    B/S,105,1,plan_id_1,2222,area_desc1,CCEMC_PR_001,1111,1,2222,2,1,scenario_desc_1
    B/S,105,1,plan_id_2,2222,area_desc2,CCEMC_PR_002,1111,2,2222,2,2,scenario_desc_2
    3) Here are the tables:
    TST_AREAS
    Name Null? Type
    AREA_ID NOT NULL NUMBER(35)
    AREA_NAME CHAR(64)
    PRODUCT_ID NUMBER(35)
    PRIORITY_ID NUMBER(35)
    PLAN_ID NUMBER(35)
    CREATED_BY_ID NUMBER(35)
    AREA_DESC CHAR(1000)
    TST_TEMPLATE_SCENS
    Name Null? Type
    TEMPLATE_SCEN_ID NOT NULL NUMBER(35)
    SCENARIO_NAME CHAR(500)
    MODIFIED_BY_ID NUMBER(35)
    SCEN_TYPE_ID NUMBER(35)
    OWNER_ID NUMBER(35)
    PRIORITY_ID NUMBER(35)
    SCOPE_ID NUMBER(35)
    SCENARIO_DESC CHAR(1000)
    AREA_ID NOT NULL NUMBER(35)
    Please advise what is the reason for an error.
    Thank you very much!
    Andrey

    I don't think so.
    SQL> create table t (
      2  rowid number);
    rowid number)
    ERROR at line 2:
    ORA-00904: : invalid identifierPlease post your version number and the DDL for the table.
    Best practice in Oracle is to NEVER, EVER, store a ROWID: They can change.
    After you have solved the first problem, that you've never actually built the table, the solution to the sequence use is to make the call in your DML.
    INSERT INTO t (testcol) VALUES (<sequence_name>.NEXTVAL);

  • SQL*LOADER example not working for REF

    I was working on the Oracle bulk load scripts using SQL*LOADER utility .
    I have encountered an error while using the REF column option to resolve the parent-child referential integrity .
    The example given in the URL http://www.csee.umbc.edu/help/oracle8/server.815/a67792/ch05.htm Example 5-9 Loading Primary Key REF Columns
    does not work . and generates errors : 'SQL*Loader-418: Bad datafile datatype for column DEPT_MGR'
    example :
    Control File
    LOAD DATA
    INFILE `sample.dat'
    INTO TABLE departments_alt
    FIELDS TERMINATED BY `,' OPTIONALLY ENCLOSED BY `"'
    (dept_no CHAR(5),
    dept_name CHAR(30),
    dept_mgr REF(CONSTANT `EMPLOYEES', emp_id),
    emp_id FILLER CHAR(32))
    Data file (sample.dat)
    22345, QuestWorld, 007,
    23423, Geography, 000,
    Could you please suggest any solutions for this ?

    Some of the quotes are wrong
    Try the sample from the 10.2 documentation
    LOAD DATA
    INFILE 'sample.dat'
    INTO TABLE departments_alt
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
    (dept_no       CHAR(5),
    dept_name      CHAR(30),
    dept_mgr       REF(CONSTANT 'EMPLOYEES', emp_id),
    emp_id         FILLER CHAR(32))

  • How to load a default value in to a column when using sql loader

    Im trying to load from a flat file using sql loader.
    for 1 column i need to update using a default value
    how to go about this?

    Hi!
    try this code --
    LOAD DATA
       INFILE 'sample.dat'
       REPLACE
       INTO TABLE emp
       empno   POSITION(01:04) INTEGER EXTERNAL NULLIF empno=BLANKS,
       ename   POSITION(06:15)  CHAR,
       job         POSITION(17:25)  CHAR,
       mgr       POSITION(27:30)  INTEGER EXTERNAL NULLIF mgr=BLANKS,
       sal        POSITION(32:39)  DECIMAL EXTERNAL NULLIF sal=BLANKS,
       comm   POSITION(41:48)  DECIMAL EXTERNAL DEFAULTIF comm = 100,
       deptno  POSITION(50:51)  INTEGER EXTERNAL NULLIF deptno=BLANKS,
       hiredate POSITION(52:62) CONSTANT SYSDATE
      )-hope this will solve ur purpose.
    Regards.
    Satyaki De.

Maybe you are looking for

  • Exchange Server 2010 SP3 Databases are not mounting after the recovery process

    Hi, We are using Exchange server 2010 SP3 in our office. Databases are stored in an ISCSI drive mapped with the exchange. We are taking daily full backup of my Exchange server using Symantec Backup exe 2012. As a testing purpose I created a test envi

  • Top level navigation appearing below the content area

    Hi ,   I have modified the standard look and feel of the portal . We have our own masthead now and a custom footer as well . The problem is the top level navigation is appearing below the content area . I presume that there is a possibility of arrang

  • I'm gonna throw it against the wall!!

    I've only had my ipod for about two weeks, and already, it's messed up. (It's the newest iPod video, the black 30gb) It was working fine, and I hooked it up to my computer to add some more music files. My screen saves went on, and actually went to th

  • TS1424 Cannot connect to iTunes - fromhome

    I have an iPad 3 and a 4S iPhone but i am unable to connect the iPad to iTunes at home via btinternet wifi (the message is 'Cannot connect to iTunes Store'). It works fine in the Apple store so they cant help! My iPhone connects with no problem and m

  • Apps won't start after iOS5 upgrade for ipad2

    Hi, after upgrading my ipad with the latest iOS. when you clck on any apps..it starts and then minimize..when you double click on the home buttom..you will see the apps there. Please advice.