Monday, October 12, 2009

Not an infinte loop

If you know why the below piece of code wont go into an infinite loop in Oracle, then you know a very important concept of Oracle database.

BEGIN
FOR x in (SELECT * from t) LOOP
INSERT INTO t values (x.user_name, x.user_id, x.created);
END LOOP;
END;

Its a direct lift from Thomas Kyte's text book.

Buy the book if you don't know why or thinks that it will go into infinite loop.

No comments: