PDF PLSQL 2 7 Practice Compress
PDF PLSQL 2 7 Practice Compress
www.oracle.com/academy
Try It / Solve It
1. Enter and run the following PL/SQL block. It will execute correctly if you have entered it
correctly, but it contains some examples of bad programming practices.
DECLARE
myvar1 VARCHAR2(20);
myvar2 number(4);
BEGIN
SELECT country_name INTO myvar1
FROM countries WHERE country_id = 421;
myvar2 := '1234';
MYVAR2 := myvar2 * 2;
DBMS_OUTPUT.PUT_LINE(myvar1);
End;
DECLARE
myvar1 VARCHAR2(20);
myvar2 number(4);
BEGIN
SELECT country_name INTO myvar1
FROM wf_countries WHERE country_id =
1246;
myvar2 := 1234;
MYVAR2 := myvar2 * 2;
DBMS_OUTPUT.PUT_LINE(myvar1);
End;