SQLLDR retaining DB column value [message #621572] |
Thu, 14 August 2014 08:15  |
 |
Member2014
Messages: 33 Registered: July 2014 Location: USA
|
Member |
|
|
I am using SQLLDR to load the data in a file into a database table. The Table has 22 columns out of which the first 20 columns come from the incoming data file and the last two columns values are computed as a part of the code and updated in the table.
The control file is as below
OPTIONS (
ERRORS=1000,
DIRECT=TRUE,
READSIZE=104857600,
BINDSIZE=104857600,
ROWS=25000
)
LOAD DATA
INFILE '-' "str X'0A'"
DISCARDMAX 1
TRUNCATE INTO TABLE STG_TABLE
FIELDS TERMINATED BY X'7C'
TRAILING NULLCOLS
(
col1,
col2,
....
col20
)
Since I have added two new columns to the stg_table (i.e. col21, col22), I will need to modify the control file.
Can anyone suggest how I can modify the control file to retain the database value of col21, col22 while loading the file to the DB?
Thanks.
|
|
|
|
Re: SQLLDR retaining DB column value [message #621586 is a reply to message #621572] |
Thu, 14 August 2014 12:37   |
joy_division
Messages: 4963 Registered: February 2005 Location: East Coast USA
|
Senior Member |
|
|
Member2014 wrote on Thu, 14 August 2014 09:15
Since I have added two new columns to the stg_table (i.e. col21, col22), I will need to modify the control file.
Can anyone suggest how I can modify the control file to retain the database value of col21, col22 while loading the file to the DB?
.
Your question makes no sense. sqlldr "loads" data into a table. There is no mechanism to update any data.
Please look at external tables (http://docs.oracle.com/cd/B19306_01/server.102/b14215/et_concepts.htm) if you want a more robust solution.
|
|
|
|
|
|
|
Re: SQLLDR retaining DB column value [message #624188 is a reply to message #624170] |
Thu, 18 September 2014 14:08   |
Lalit Kumar B
Messages: 3174 Registered: May 2013 Location: World Wide on the Web
|
Senior Member |
|
|
I have a thought, as you want the two computed columns to automatically get populated based on the values of the other columns, why not have them as VIRTUAL COLUMNS. They are meant for computed values after all.
|
|
|
|
|
|
|
|
Re: SQLLDR retaining DB column value [message #624575 is a reply to message #624571] |
Tue, 23 September 2014 10:52   |
Lalit Kumar B
Messages: 3174 Registered: May 2013 Location: World Wide on the Web
|
Senior Member |
|
|
I too thank you for the feedback. But my name doesn't have a trailing "h" It's Lalit, not Lalith. Usually people from Southern part of India tend to add a trailing "h" in the first name 
Anyway, regarding the virtual column concept, you might also have to look into performance aspects. But, now I would leave it up to you to figure it out(only if required). Else, you can come back again.
All the best!
[Updated on: Tue, 23 September 2014 13:16] Report message to a moderator
|
|
|
|