Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: multi-table insert puzzler
foothillbiker wrote:
> All,
>
> platform: 10.2.0.2 / solarisx86 64bit
>
> I am transforming data from table A to tables "Guardian" and "Ward"
>
> Table A contains:
> GuardianID
> Wards (comma delimited list of 0 or more progeny, all in a single,
> VARCHAR2(2000) field)
>
> I'd like to, in a single pass through Table A:
> - populate Guardian with the GuardianID
> - add one (1) record to Ward for each of the associated children.
>
> Ideally I would be able to
> - autogen an id for the guardian
> - use that id as an fk in thw Ward table
>
> I /think/ this is a job for INSERT ALL but am not quite sure.
>
> As ever, I appreciate your collective wisedom.
>
> REgards,
> Chas.
You may not like my wisdom but you get it anyway as you asked for it.
You need to write a stored procedure as your design, storing comma delimited data in a VARCHAR2(2000) is by definition bad. INSERT ALL is a wonderful tool but it can't count an unknown number of commas and substring out what is between them.
If you need someone to write that procedure for you I would suggest a posting in c.d.o.marketplace requesting either a fixed price bid or a per-diem price for the work.
There are many here, including some of my students, who would gladly do your job for you. But I can't think of any willing to do it for free.
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace x with u to respond) Puget Sound Oracle Users Group www.psoug.orgReceived on Fri Mar 09 2007 - 20:17:38 CST