|
Re: insertion.. How can we make multiple insertion in a table?? PLZ HELP [message #371378 is a reply to message #371375] |
Wed, 11 October 2000 03:15 |
Sandeep Deshmukh
Messages: 13 Registered: October 2000
|
Junior Member |
|
|
Bassiouni,
Through SQL you can have multiple rows insertion possible only through use of output of select query. The syntax would look like.
1) insert into table1
( select * from table2)
2)insert into table1 (col1,col2..coln)
(select col1,col2...coln from table2[[,table3]]
1. In both the cases "not null"columns in table1 should be populated through select.
2. You can have all rows inserted in a table which are brough as o/p of select.
3. If you are using values clause of insert i.e. insert into table1 values (..) ,u can't have more than a row at a time
Hope this helps.
Regards,
Sandeep
Regards,
Sandeep
|
|
|
|
|
Re: but there must be a quicker way... [message #371385 is a reply to message #371378] |
Wed, 11 October 2000 23:42 |
Sandeep Deshmukh
Messages: 13 Registered: October 2000
|
Junior Member |
|
|
bassiouni,
Yeah theres a way,if you wan't not to type "insert into" for n times for n rows.On sql prompt,u use -
insert into table1 (col1...coln)
values
(&1,'&2',&3.... &n)
/
It will ask you for values 1 ..n for first row.And after / ,you can enter it for next set.
This way you just need to enter valuez not the syntax again & again.
There is a variant of the substitution variable(&) in form of && where in you need to give value only once & next time onward it will use the same value in the insert column(unless you change it with define).SO the combination of & and && will make the insertion easy for you.
But I will suggest ,if you got a requirement of bulk insertion.You better go for SQLLOAD with append option.
|
|
|