Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL sequence Help Please !
Mujahid Hamid ¼¶¼g©ó¤å³¹
<898731139.3158.0.nnrp-06.c2de4f17_at_news.demon.co.uk>...
>Hi All,
>
>How can insert values of 1 to 100 into a empty table from a sequence
without
>using a cursor.
>Is there a way I can insert these vales by simply one or two commands.
>Thanks in advance
>Muji
In PL/SQL, you can use a loop to do this:
BEGIN
FOR I IN 1..100 LOOP
INSERT INTO table_name (column_name) VALUES (I);
END LOOP;
END;
In SQL, you can take a table having more than 100 rows (say,
ALL_TAB_COLUMNS) to do this:
INSERT INTO table_name (column_name)
SELECT ROWNUM FROM ALL_TAB_COLUMNS WHERE ROWNUM<=100; Received on Thu Jun 25 1998 - 08:38:29 CDT
![]() |
![]() |