Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL sequence Help Please !

Re: PL/SQL sequence Help Please !

From: fumi <fumi_at_tpts5.seed.net.tw>
Date: Thu, 25 Jun 1998 21:38:29 +0800
Message-ID: <6mvrq1$ku7$2@news.seed.net.tw>

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US