dbTalk Databases Forums  

help regarding sql loader

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss help regarding sql loader in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
amitabh.mehra@gmail.com
 
Posts: n/a

Default help regarding sql loader - 01-16-2008 , 10:36 PM






Hi

I have a table Test:
id number default -999
occ varchar2(25) default 'student'
addr varchar2(25)
qual varchar2(100)
secid varchar2(25) default 'h-000'

primary key: id, occ, secid

I am using sql loader to load data into the table. The ctrl file is :
LOAD DATA
INFILE 'C:/record_dir/log/bad/out/test.dat'
APPEND INTO TABLE Test
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '|'
TRAILING NULLCOLS
(ID CHAR( 40 ),OCC, ADDR, QUAL, SECID CHAR(25))

My test input is something like:
1,asst,abc,xyz,,
2,asst,abc,xyz,,
,,klm,abc,xyz,,


The problem is that sql loader throws error in log file:
Record 1: Rejected - Error on table TEST, column SECID .
ORA-01400: cannot insert NULL into ("TEST"."SECID ")

Its just not putting default values for the null values. Is there some
way this can be done? Please dont ask me to change the model. Its what
I have to work with

Thanks
Amitabh

Reply With Quote
  #2  
Old   
fitzjarrell@cox.net
 
Posts: n/a

Default Re: help regarding sql loader - 01-17-2008 , 10:24 AM






Comments embedded.
On Jan 16, 10:36*pm, amitabh.me... (AT) gmail (DOT) com wrote:
Quote:
Hi

I have a table Test:
* * * id * * * number * * default -999
* * * occ varchar2(25) default 'student'
* * * addr varchar2(25)
* * * qual * varchar2(100)
* * * secid *varchar2(25) default 'h-000'

This is fine.

Quote:
primary key: id, occ, secid
This is your first problem. Since all columns in the primary key are
NOT NULL you'll never get default values to populate them.

Quote:
I am using sql loader to load data into the table. The ctrl file is :
LOAD DATA
INFILE 'C:/record_dir/log/bad/out/test.dat'
APPEND INTO TABLE Test
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '|'
TRAILING NULLCOLS
(ID CHAR( 40 ),OCC, ADDR, QUAL, SECID CHAR(25))

My test input is something like:
1,asst,abc,xyz,,
2,asst,abc,xyz,,
,,klm,abc,xyz,,

The problem is that sql loader throws error in log file:
Record 1: Rejected - Error on table TEST, column SECID .
ORA-01400: cannot insert NULL into ("TEST"."SECID ")
Because of your primary key definition.

Quote:
Its just not putting default values for the null values.
'It' can't, as you cannot submit NULL values for insert into primary
key columns.

Quote:
Is there some
way this can be done?
Not with the primary key declared as it is.

Quote:
Please dont ask me to change the model. Its what
I have to work with
Then your default value assignments for those columns are worthless,
as they will never be used.

Quote:
Thanks
Amitabh

David Fitzjarrell


Reply With Quote
  #3  
Old   
fitzjarrell@cox.net
 
Posts: n/a

Default Re: help regarding sql loader - 01-17-2008 , 10:24 AM



Comments embedded.
On Jan 16, 10:36*pm, amitabh.me... (AT) gmail (DOT) com wrote:
Quote:
Hi

I have a table Test:
* * * id * * * number * * default -999
* * * occ varchar2(25) default 'student'
* * * addr varchar2(25)
* * * qual * varchar2(100)
* * * secid *varchar2(25) default 'h-000'

This is fine.

Quote:
primary key: id, occ, secid
This is your first problem. Since all columns in the primary key are
NOT NULL you'll never get default values to populate them.

Quote:
I am using sql loader to load data into the table. The ctrl file is :
LOAD DATA
INFILE 'C:/record_dir/log/bad/out/test.dat'
APPEND INTO TABLE Test
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '|'
TRAILING NULLCOLS
(ID CHAR( 40 ),OCC, ADDR, QUAL, SECID CHAR(25))

My test input is something like:
1,asst,abc,xyz,,
2,asst,abc,xyz,,
,,klm,abc,xyz,,

The problem is that sql loader throws error in log file:
Record 1: Rejected - Error on table TEST, column SECID .
ORA-01400: cannot insert NULL into ("TEST"."SECID ")
Because of your primary key definition.

Quote:
Its just not putting default values for the null values.
'It' can't, as you cannot submit NULL values for insert into primary
key columns.

Quote:
Is there some
way this can be done?
Not with the primary key declared as it is.

Quote:
Please dont ask me to change the model. Its what
I have to work with
Then your default value assignments for those columns are worthless,
as they will never be used.

Quote:
Thanks
Amitabh

David Fitzjarrell


Reply With Quote
  #4  
Old   
fitzjarrell@cox.net
 
Posts: n/a

Default Re: help regarding sql loader - 01-17-2008 , 10:24 AM



Comments embedded.
On Jan 16, 10:36*pm, amitabh.me... (AT) gmail (DOT) com wrote:
Quote:
Hi

I have a table Test:
* * * id * * * number * * default -999
* * * occ varchar2(25) default 'student'
* * * addr varchar2(25)
* * * qual * varchar2(100)
* * * secid *varchar2(25) default 'h-000'

This is fine.

Quote:
primary key: id, occ, secid
This is your first problem. Since all columns in the primary key are
NOT NULL you'll never get default values to populate them.

Quote:
I am using sql loader to load data into the table. The ctrl file is :
LOAD DATA
INFILE 'C:/record_dir/log/bad/out/test.dat'
APPEND INTO TABLE Test
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '|'
TRAILING NULLCOLS
(ID CHAR( 40 ),OCC, ADDR, QUAL, SECID CHAR(25))

My test input is something like:
1,asst,abc,xyz,,
2,asst,abc,xyz,,
,,klm,abc,xyz,,

The problem is that sql loader throws error in log file:
Record 1: Rejected - Error on table TEST, column SECID .
ORA-01400: cannot insert NULL into ("TEST"."SECID ")
Because of your primary key definition.

Quote:
Its just not putting default values for the null values.
'It' can't, as you cannot submit NULL values for insert into primary
key columns.

Quote:
Is there some
way this can be done?
Not with the primary key declared as it is.

Quote:
Please dont ask me to change the model. Its what
I have to work with
Then your default value assignments for those columns are worthless,
as they will never be used.

Quote:
Thanks
Amitabh

David Fitzjarrell


Reply With Quote
  #5  
Old   
fitzjarrell@cox.net
 
Posts: n/a

Default Re: help regarding sql loader - 01-17-2008 , 10:24 AM



Comments embedded.
On Jan 16, 10:36*pm, amitabh.me... (AT) gmail (DOT) com wrote:
Quote:
Hi

I have a table Test:
* * * id * * * number * * default -999
* * * occ varchar2(25) default 'student'
* * * addr varchar2(25)
* * * qual * varchar2(100)
* * * secid *varchar2(25) default 'h-000'

This is fine.

Quote:
primary key: id, occ, secid
This is your first problem. Since all columns in the primary key are
NOT NULL you'll never get default values to populate them.

Quote:
I am using sql loader to load data into the table. The ctrl file is :
LOAD DATA
INFILE 'C:/record_dir/log/bad/out/test.dat'
APPEND INTO TABLE Test
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '|'
TRAILING NULLCOLS
(ID CHAR( 40 ),OCC, ADDR, QUAL, SECID CHAR(25))

My test input is something like:
1,asst,abc,xyz,,
2,asst,abc,xyz,,
,,klm,abc,xyz,,

The problem is that sql loader throws error in log file:
Record 1: Rejected - Error on table TEST, column SECID .
ORA-01400: cannot insert NULL into ("TEST"."SECID ")
Because of your primary key definition.

Quote:
Its just not putting default values for the null values.
'It' can't, as you cannot submit NULL values for insert into primary
key columns.

Quote:
Is there some
way this can be done?
Not with the primary key declared as it is.

Quote:
Please dont ask me to change the model. Its what
I have to work with
Then your default value assignments for those columns are worthless,
as they will never be used.

Quote:
Thanks
Amitabh

David Fitzjarrell


Reply With Quote
  #6  
Old   
Ed Prochak
 
Posts: n/a

Default Re: help regarding sql loader - 01-18-2008 , 12:28 PM



On Jan 16, 11:36*pm, amitabh.me... (AT) gmail (DOT) com wrote:
Quote:
Hi

I have a table Test:
* * * id * * * number * * default -999
* * * occ varchar2(25) default 'student'
* * * addr varchar2(25)
* * * qual * varchar2(100)
* * * secid *varchar2(25) default 'h-000'

primary key: id, occ, secid

I am using sql loader to load data into the table. The ctrl file is :
LOAD DATA
INFILE 'C:/record_dir/log/bad/out/test.dat'
APPEND INTO TABLE Test
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '|'
TRAILING NULLCOLS
(ID CHAR( 40 ),OCC, ADDR, QUAL, SECID CHAR(25))

My test input is something like:
1,asst,abc,xyz,,
2,asst,abc,xyz,,
,,klm,abc,xyz,,

The problem is that sql loader throws error in log file:
Record 1: Rejected - Error on table TEST, column SECID .
ORA-01400: cannot insert NULL into ("TEST"."SECID ")

Its just not putting default values for the null values. Is there some
way this can be done? Please dont ask me to change the model. Its what
I have to work with

Thanks
Amitabh

You will have to assign the defaults yourself. apply som SQL to the
null fields
LOAD DATA
INFILE 'C:/record_dir/log/bad/out/test.dat'
APPEND INTO TABLE Test
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '|'
TRAILING NULLCOLS
(ID CHAR( 40 ) "NVL(LTRIM(:ID),'-999')"
--- similar SQL for OCC and SECID
OCC, ADDR, QUAL, SECID CHAR(25))

why are any of those key fields in your input file empty anyway? Note
that SQL*Loader may reject some records due to duplicate keys because
of the default values.

HTH,
ed


Reply With Quote
  #7  
Old   
Ed Prochak
 
Posts: n/a

Default Re: help regarding sql loader - 01-18-2008 , 12:28 PM



On Jan 16, 11:36*pm, amitabh.me... (AT) gmail (DOT) com wrote:
Quote:
Hi

I have a table Test:
* * * id * * * number * * default -999
* * * occ varchar2(25) default 'student'
* * * addr varchar2(25)
* * * qual * varchar2(100)
* * * secid *varchar2(25) default 'h-000'

primary key: id, occ, secid

I am using sql loader to load data into the table. The ctrl file is :
LOAD DATA
INFILE 'C:/record_dir/log/bad/out/test.dat'
APPEND INTO TABLE Test
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '|'
TRAILING NULLCOLS
(ID CHAR( 40 ),OCC, ADDR, QUAL, SECID CHAR(25))

My test input is something like:
1,asst,abc,xyz,,
2,asst,abc,xyz,,
,,klm,abc,xyz,,

The problem is that sql loader throws error in log file:
Record 1: Rejected - Error on table TEST, column SECID .
ORA-01400: cannot insert NULL into ("TEST"."SECID ")

Its just not putting default values for the null values. Is there some
way this can be done? Please dont ask me to change the model. Its what
I have to work with

Thanks
Amitabh

You will have to assign the defaults yourself. apply som SQL to the
null fields
LOAD DATA
INFILE 'C:/record_dir/log/bad/out/test.dat'
APPEND INTO TABLE Test
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '|'
TRAILING NULLCOLS
(ID CHAR( 40 ) "NVL(LTRIM(:ID),'-999')"
--- similar SQL for OCC and SECID
OCC, ADDR, QUAL, SECID CHAR(25))

why are any of those key fields in your input file empty anyway? Note
that SQL*Loader may reject some records due to duplicate keys because
of the default values.

HTH,
ed


Reply With Quote
  #8  
Old   
Ed Prochak
 
Posts: n/a

Default Re: help regarding sql loader - 01-18-2008 , 12:28 PM



On Jan 16, 11:36*pm, amitabh.me... (AT) gmail (DOT) com wrote:
Quote:
Hi

I have a table Test:
* * * id * * * number * * default -999
* * * occ varchar2(25) default 'student'
* * * addr varchar2(25)
* * * qual * varchar2(100)
* * * secid *varchar2(25) default 'h-000'

primary key: id, occ, secid

I am using sql loader to load data into the table. The ctrl file is :
LOAD DATA
INFILE 'C:/record_dir/log/bad/out/test.dat'
APPEND INTO TABLE Test
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '|'
TRAILING NULLCOLS
(ID CHAR( 40 ),OCC, ADDR, QUAL, SECID CHAR(25))

My test input is something like:
1,asst,abc,xyz,,
2,asst,abc,xyz,,
,,klm,abc,xyz,,

The problem is that sql loader throws error in log file:
Record 1: Rejected - Error on table TEST, column SECID .
ORA-01400: cannot insert NULL into ("TEST"."SECID ")

Its just not putting default values for the null values. Is there some
way this can be done? Please dont ask me to change the model. Its what
I have to work with

Thanks
Amitabh

You will have to assign the defaults yourself. apply som SQL to the
null fields
LOAD DATA
INFILE 'C:/record_dir/log/bad/out/test.dat'
APPEND INTO TABLE Test
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '|'
TRAILING NULLCOLS
(ID CHAR( 40 ) "NVL(LTRIM(:ID),'-999')"
--- similar SQL for OCC and SECID
OCC, ADDR, QUAL, SECID CHAR(25))

why are any of those key fields in your input file empty anyway? Note
that SQL*Loader may reject some records due to duplicate keys because
of the default values.

HTH,
ed


Reply With Quote
  #9  
Old   
Ed Prochak
 
Posts: n/a

Default Re: help regarding sql loader - 01-18-2008 , 12:28 PM



On Jan 16, 11:36*pm, amitabh.me... (AT) gmail (DOT) com wrote:
Quote:
Hi

I have a table Test:
* * * id * * * number * * default -999
* * * occ varchar2(25) default 'student'
* * * addr varchar2(25)
* * * qual * varchar2(100)
* * * secid *varchar2(25) default 'h-000'

primary key: id, occ, secid

I am using sql loader to load data into the table. The ctrl file is :
LOAD DATA
INFILE 'C:/record_dir/log/bad/out/test.dat'
APPEND INTO TABLE Test
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '|'
TRAILING NULLCOLS
(ID CHAR( 40 ),OCC, ADDR, QUAL, SECID CHAR(25))

My test input is something like:
1,asst,abc,xyz,,
2,asst,abc,xyz,,
,,klm,abc,xyz,,

The problem is that sql loader throws error in log file:
Record 1: Rejected - Error on table TEST, column SECID .
ORA-01400: cannot insert NULL into ("TEST"."SECID ")

Its just not putting default values for the null values. Is there some
way this can be done? Please dont ask me to change the model. Its what
I have to work with

Thanks
Amitabh

You will have to assign the defaults yourself. apply som SQL to the
null fields
LOAD DATA
INFILE 'C:/record_dir/log/bad/out/test.dat'
APPEND INTO TABLE Test
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '|'
TRAILING NULLCOLS
(ID CHAR( 40 ) "NVL(LTRIM(:ID),'-999')"
--- similar SQL for OCC and SECID
OCC, ADDR, QUAL, SECID CHAR(25))

why are any of those key fields in your input file empty anyway? Note
that SQL*Loader may reject some records due to duplicate keys because
of the default values.

HTH,
ed


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.