Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Simple For Loop Not Working

1013062Jul 30 2013 — edited Jul 30 2013

I'm trying this simple FOR loop statement but it keeps giving me the following error. Any help is greatly appreciated!!!!! Thank you so much.

Error report:

ORA-06550: line 5, column 18:

PLS-00382: expression is of wrong type

06550. 00000 -  "line %s, column %s:\n%s"

*Cause:    Usually a PL/SQL compilation error.

*Action:

/*QUERY*/

--Creating a temp table

CREATE TABLE zzTab(

                    num NUMBER

                  );

--Inserting values from 1 to 10 in the table

BEGIN

    FOR i IN

            (

               SELECT to_number(ROWNUM) i

               FROM dual

               CONNECT BY ROWNUM <=10

             )

    LOOP

    INSERT INTO zztab (

                        num

                      )

        SELECT 7*i num

        from dual;

END LOOP;

END;   

This post has been answered by Frank Kulash on Jul 30 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 27 2013
Added on Jul 30 2013
5 comments
1,690 views