-
Immediate help needed on inserting
Hi,
I have 5 tables into which I have to load data from a spread sheet. I do
know how to use the data-load procedure to load data into the database.
My dilema is that I have been given field values which go to 5 different
tables.
Does anyone has a script written to insert data into various tables at the
same time where as the values from one table is dependent on the other.
I will appreiate a lot.
Thanks
Ari
-
Re: Immediate help needed on inserting
I used to break out the trusty TextPad Text Editor and record
a macro to do the insertion statements...
Starting with a line like
1,2,"Dennis",4,5
I might turn it into something like
Insert into table1 (Table1_ID, Field2) select table1_ID.nextval, 1 from dual;
Insert into table1 (Table2_ID, Field1, Field2) select table2_ID.nextval, 1, 2 from dual;
Insert into table1 (Table3_ID, field1, Field2) select table3_ID.nextval, 1, 'Dennis' from dual;
Insert into table1 (Table4_ID, field1, Field2) select table4_ID.nextval, 1, 4 from dual;
Insert into table1 (Table5_ID, field2, Field2) select table5_ID.nextval, 1, 5 from dual;
Then stop recording the macro after reaching the first column of the next
row of data and then play the macro back 'till the end of the file.
Its not pretty, but you can save the macro for use on subsequent iterations
of this procedure.
Remember to include all the not-null fields in the ( ) field set.
NOTE: This only works if you're using sequences for your primary keys.
hth,
D.
"Ari Flycher" <araza1216@cs.com> wrote in message news:3cf7d0ab$1@10.1.10.29...
|
| Hi,
| I have 5 tables into which I have to load data from a spread sheet. I do
| know how to use the data-load procedure to load data into the database.
| My dilema is that I have been given field values which go to 5 different
| tables.
| Does anyone has a script written to insert data into various tables at the
| same time where as the values from one table is dependent on the other.
| I will appreiate a lot.
| Thanks
| Ari
-
Re: Immediate help needed on inserting
oops... I forgot to increment the
Insert into table1
for each diferent table, but hopefully you get the gist
of where I was going with this...
D>
"dnagel" <GrandNagel@hotmail.com> wrote in message news:3cf820f0@10.1.10.29...
| I used to break out the trusty TextPad Text Editor and record
| a macro to do the insertion statements...
|
| Starting with a line like
|
| 1,2,"Dennis",4,5
|
| I might turn it into something like
|
| Insert into table1 (Table1_ID, Field2) select table1_ID.nextval, 1 from dual;
| Insert into table1 (Table2_ID, Field1, Field2) select table2_ID.nextval, 1, 2 from dual;
| Insert into table1 (Table3_ID, field1, Field2) select table3_ID.nextval, 1, 'Dennis' from dual;
| Insert into table1 (Table4_ID, field1, Field2) select table4_ID.nextval, 1, 4 from dual;
| Insert into table1 (Table5_ID, field2, Field2) select table5_ID.nextval, 1, 5 from dual;
|
| Then stop recording the macro after reaching the first column of the next
| row of data and then play the macro back 'till the end of the file.
|
| Its not pretty, but you can save the macro for use on subsequent iterations
| of this procedure.
|
| Remember to include all the not-null fields in the ( ) field set.
|
| NOTE: This only works if you're using sequences for your primary keys.
|
| hth,
|
| D.
|
|
| "Ari Flycher" <araza1216@cs.com> wrote in message news:3cf7d0ab$1@10.1.10.29...
| |
| | Hi,
| | I have 5 tables into which I have to load data from a spread sheet. I do
| | know how to use the data-load procedure to load data into the database.
| | My dilema is that I have been given field values which go to 5 different
| | tables.
| | Does anyone has a script written to insert data into various tables at the
| | same time where as the values from one table is dependent on the other.
| | I will appreiate a lot.
| | Thanks
| | Ari
|
|
-
Re: Immediate help needed on inserting
"dnagel" <GrandNagel@hotmail.com> wrote:
>oops... I forgot to increment the
> Insert into table1
>for each diferent table, but hopefully you get the gist
>of where I was going with this...
>
>D>
Thanks a lot, it works.
>
>"dnagel" <GrandNagel@hotmail.com> wrote in message news:3cf820f0@10.1.10.29...
>| I used to break out the trusty TextPad Text Editor and record
>| a macro to do the insertion statements...
>|
>| Starting with a line like
>|
>| 1,2,"Dennis",4,5
>|
>| I might turn it into something like
>|
>| Insert into table1 (Table1_ID, Field2) select table1_ID.nextval, 1 from
dual;
>| Insert into table1 (Table2_ID, Field1, Field2) select table2_ID.nextval,
1, 2 from
>dual;
>| Insert into table1 (Table3_ID, field1, Field2) select table3_ID.nextval,
1, 'Dennis'
>from dual;
>| Insert into table1 (Table4_ID, field1, Field2) select table4_ID.nextval,
1, 4 from
>dual;
>| Insert into table1 (Table5_ID, field2, Field2) select table5_ID.nextval,
1, 5 from
>dual;
>|
>| Then stop recording the macro after reaching the first column of the next
>| row of data and then play the macro back 'till the end of the file.
>|
>| Its not pretty, but you can save the macro for use on subsequent iterations
>| of this procedure.
>|
>| Remember to include all the not-null fields in the ( ) field set.
>|
>| NOTE: This only works if you're using sequences for your primary keys.
>|
>| hth,
>|
>| D.
>|
>|
>| "Ari Flycher" <araza1216@cs.com> wrote in message news:3cf7d0ab$1@10.1.10.29...
>| |
>| | Hi,
>| | I have 5 tables into which I have to load data from a spread sheet.
I do
>| | know how to use the data-load procedure to load data into the database.
>| | My dilema is that I have been given field values which go to 5 different
>| | tables.
>| | Does anyone has a script written to insert data into various tables
at the
>| | same time where as the values from one table is dependent on the other.
>| | I will appreiate a lot.
>| | Thanks
>| | Ari
>|
>|
>
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks