I am not sure if this is possible or not, but here is my problem with select expression in a sql loader file.
I have two tables.
TABLE 1
IDENTITYNUMBER
ID NUMBER
100 8
200 9
TABLE 2
TESTTABLE
NAME ID
John 100
data file for the loader sql
Jim,8
Carol,9
Now, I want to load this data in test table by replacing the second number with the id from the first table.
So this is how my test.ctl file looks like
load data
append
into table testtable
fields terminated by ',' optionally enclosed by '"'
(
NAME,
ID EXPRESSION "(select i.id from identitynumber i where i.number = :ID)"
)
But I keep getting this error: SQL*Loader-291: Invalid bind variable ID in SQL string for column ID
I expect the table 2 to look like this after a successful execution of the loader script.
TESTTABLE
NAME ID
John 100
Jim 100
Carol 200
Any pointers will be greatly appreciated.
Do without "expression"
ID "(select i.id from identitynumber i where i.number = :ID)"