and now i can insert one row with asingle statement like
insert into test values ('vas');
this will work fine , but i want to insert more than one row with a single statement . i think using 'values' its not possible .
Is there any other method to do this?
SQL> desc test;
Name Null? Type
----------------------------------------------------- -------- -----------------
NAME VARCHAR2(10)
if want to insert a row i will insert like this
insert into test values ('vas');
one will be created
like this if i want to insert 10 rows , i have to insert 10 times like above. in my case it is hitting the database (server side) 10 times. so what my question is can we insert those 10 rows with a single statement ?
I see what you mean but are all the rows the same? Is it an incrementing value you want put in there 10 times? 10 random numbers? Etc
A pl/sql block will still execute 10 insert statements but you can put it in a loop to make your life easier. There isn't a way to get out of inserting 10 times if you want 10 rows.
well there isn't really a random function in oracle, you can insert whatever you want into the table. a small block that just loops 10 times and inserts is
<font face="courier">
begin
**for i in 1..10 loop
****insert into table values(i);
**end loop;
end;
</font>
that doesn't commit so you would have to put commits wherever you want, etc. that inserts 1, 2, 3 ... 10 into the table.
The short answer to your question was that no there isn't a way to insert more than one row with one insert statement, but there are lots of ways to do it with more insert statements.
Bookmarks