Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: sqlldr - sequence nextval
Ken Chesak wrote:
> I would like to use sequence.nextval to update column value in sqlldr.
> The column does not exist in the input file.
>
> LOAD DATA
> INFILE 'gws_case.dat'
> APPEND
> INTO TABLE benefit_case
> FIELDS TERMINATED BY X'09'
>
> (
> id_benefit_case SEQUENCE(MAX,1), <<< this works
So if it work, then use it.
> case_no ,
> id_seq
> )
>
> But I would like to use something like this, but I cant figure out the
> right syntax:
> id_benefit_case SEQUENCE(sq_benefit_case.nextval)
>
> I can use the SEQUENCE(MAX,1) but then I would need to update the
> sequence sq_benefit_case to the correct value after running sqlldr.
>
> Thanks
That's the easier way to go. But if your DB must be online during the load I can sse a need for the NEXTVAL.
I don't have an environment handy to test this but using a SQL clause on the field should do it. So try
id_benefit_case integer "sq_benefit_case.nextval",
If that doesn't, then wrap it up in a function and use it
id_benefit_case integer "next_benefit_case_id()",
where next_benefit_case_id() is a PL/SQL function that selects and returns the nextval.
HTH
-- Ed Prochak running http://www.faqs.org/faqs/running-faq/ netiquette http://www.psg.com/emily.html -- "Two roads diverged in a wood and I I took the one less travelled by and that has made all the difference." robert frostReceived on Tue Apr 15 2003 - 12:33:45 CDT