Home » SQL & PL/SQL » SQL & PL/SQL » MULTIPLE DYNAMIC INSERTION (SQL DEVELOPER)
MULTIPLE DYNAMIC INSERTION [message #395785] |
Thu, 02 April 2009 10:18  |
Krishna_dev
Messages: 32 Registered: May 2007
|
Member |
|
|
I have a set of records I would create in a table. I am first inserting the first row of records as follows.
COMPANY,LOCATION,SERVICE,FUTURE
Once I have inserted the first row of records I would like to insert another 3 records derived from the first one but only the value of SERVICE will change. So the end result will be
COMPANY,LOCATION,SERVICE,FUTURE
COMPANY,LOCATION,SERVICE1,FUTURE
COMPANY,LOCATION,SERVICE2,FUTURE
COMPANY,LOCATION,SERVICE3,FUTURE
What is the most efficient way to do this in PL/SQL?
|
|
|
|
Re: MULTIPLE DYNAMIC INSERTION [message #395793 is a reply to message #395785] |
Thu, 02 April 2009 10:32   |
pablolee
Messages: 2882 Registered: May 2007 Location: Scotland
|
Senior Member |
|
|
Krishna. The people here at OraFaq are generally pretty clever folks. You don't have to overly simplify your question for us. If you tell us what you actually need, someone will most likely be able to give you a good answer. If you ioversimplify, you are likely to end up getting more questions fired back at you for clarification.
[Edit:] Q.E.D.
[Updated on: Thu, 02 April 2009 10:33] Report message to a moderator
|
|
|
|
|
|
Re: MULTIPLE DYNAMIC INSERTION [message #395881 is a reply to message #395824] |
Thu, 02 April 2009 23:59   |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
Krishna_dev wrote on Thu, 02 April 2009 20:21 | dear pablolee. If the question had in fact been oversimplified, then would'nt you, in all your infinite wisdom, have simply answered it.
|
I totally agree with you. Your requirements are very very clear, so you have all the right to bash the people you ask for help if they dare to give you advice on how you stand more chance to get a good answer!
Now, here's the code you are asking for:
begin
insert into your_table values ('COMPANY','LOCATION','SERVICE','FUTURE');
insert into your_table values ('COMPANY','LOCATION','SERVICE1','FUTURE');
insert into your_table values ('COMPANY','LOCATION','SERVICE2','FUTURE');
insert into your_table values ('COMPANY','LOCATION','SERVICE3','FUTURE');
end;
/
Not what you meant? It does comply to what you asked for..
|
|
|
Re: MULTIPLE DYNAMIC INSERTION [message #396036 is a reply to message #395881] |
Fri, 03 April 2009 10:20  |
pablolee
Messages: 2882 Registered: May 2007 Location: Scotland
|
Senior Member |
|
|
As would
begin
insert into your_table values ('COMPANY,LOCATION,SERVICE,FUTURE');
insert into your_table values ('COMPANY,LOCATION,SERVICE1,FUTURE');
insert into your_table values ('COMPANY,LOCATION,SERVICE2,FUTURE');
insert into your_table values ('COMPANY,LOCATION,SERVICE3,FUTURE');
end;
|
|
|
Goto Forum:
Current Time: Thu Jul 17 00:53:17 CDT 2025
|