Database Programming With PL/SQL 1-3: Practice Activities
Database Programming With PL/SQL 1-3: Practice Activities
com/academy
Bloque PL / SQL Unnamed blocks of code not stored in the database and do not
anónimo exist after they are executed
Named PL/SQL blocks that are stored in the database and can be
Subprograma declared as procedures or functions
Try It / Solve It
1. Complete the following chart defining the syntactical requirements for a PL/SQL block:
Sentencias SQL y
BEGIN Obligatoria
PL/SQL
A. BEGIN
END;
B. DECLARE
amount INTEGER(10);
END;
C. DECLARE
BEGIN
END;
D. DECLARE
amount NUMBER(10);
BEGIN
DBMS_OUTPUT.PUT_LINE(amount);
END;
B. Procedimientos and Funciones are named blocks and are stored in the database.
4. In Application Express, create and execute a simple anonymous block that outputs “Hello
World.”
BEGIN
DBMS_OUTPUT.PUT_LINE ('Hello World');
END;
5. Create and execute a simple anonymous block that does the following:
• Outputs “In six months, the date will be: <insert date>.”
DECLARE
v_date DATE := ADD_MONTHS(sysdate, 6);
BEGIN
DBMS_OUTPUT.PUT_LINE('In six months, the date will be:' );
DBMS_OUTPUT.PUT_LINE(v_date);
END;