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!

WHILE LOOPS and pulling from a database

8eacaf9d-e3b3-414c-b651-b8cc3a90e9fbOct 10 2015 — edited Oct 12 2015

I am trying to run a simple while loop and every time I try the terminal line disappears. screenshot.png

My portion of code will not be able to be testing by anyone willing to help because i am pulling variable contents from a database. I'm not sure if it is because i'm pulling from a database that is causing me problems, but here is what i have.

SET SERVEROUTPUT ON

DECLARE

v_idProduct BB_PRODUCT.idProduct%TYPE;

v_ProductName BB_Product.ProductName%TYPE;

v_Price BB_Product.Price%TYPE;

v_Budget number := 100;

BEGIN

SELECT idProduct, ProductName, Price

INTO v_idProduct, v_ProductName, v_price

FROM BB_PRODUCT

WHERE idProduct = 4;

WHILE v_Budget = 100 LOOP

DBMS_OUTPUT.PUT_LINE(v_ProductName);

END LOOP;

END;

/

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 9 2015
Added on Oct 10 2015
7 comments
666 views