Home » SQL & PL/SQL » SQL & PL/SQL » SQL Loader question - Using a sequence to populate column
SQL Loader question - Using a sequence to populate column [message #19480] Thu, 21 March 2002 05:38 Go to next message
Mike Oakes
Messages: 25
Registered: December 2000
Junior Member
Hello, I'm using sql loader to load data into the database from a flat file. I have 2 columns in the file and 2 in the database. The data looks like
"","test"
"","test1",

etc. The first column is always null. The database looks like
ID NUMBER
DESCRIPTION VARCHAR

I already have about 100 records loaded into the database. The ID uses a sequence to populate the column. Is there a simple way to populate the ID column from the sequence during a sql load. I have tried putting a sql statement in the ctl file.
"select ID.nextval from dual" but I receive an error. I thought about using a trigger or function but wondering if that is necessary.
Thanks for your help,
Mike O.
Re: SQL Loader question - Using a sequence to populate column [message #19482 is a reply to message #19480] Thu, 21 March 2002 05:45 Go to previous messageGo to next message
Grant
Messages: 578
Registered: January 2002
Senior Member
You have to do it with a trigger.
Re: SQL Loader question - Using a sequence to populate column [message #19561 is a reply to message #19480] Thu, 28 March 2002 05:59 Go to previous message
oraboy
Messages: 97
Registered: October 2001
Member
yes..there is an easy way

in your control file specify like this

ID "yoursequence.nextval"

and you are all set

Good luck
Oraboy
Previous Topic: Calling EXECUTE command from UNIX script
Next Topic: Urgent !
Goto Forum:
  


Current Time: Wed Apr 24 23:22:59 CDT 2024