Professional Documents
Culture Documents
Harsharan Kaur Lab Section 1 January 23, 2021
Harsharan Kaur Lab Section 1 January 23, 2021
Harsharan Kaur Lab Section 1 January 23, 2021
Lab Section 1
January 23, 2021
2. In your own words, describe why a procedural language like PL/SQL is needed.
It allows logic and control to be combined with basic SQL statements, making it
possible to create more useful programs.
4. Which of the following PL/SQL blocks execute successfully? For the blocks
that fail, explain why they fail
4 A. BEGIN
END;
Fails because the executable section must contain at least one statement.
4 B. DECLARE
amount INTEGER(10);
END;
4 C. DECLARE
BEGIN
END;
Fails because the executable section must contain at least one statement.
4 D. DECLARE
amount NUMBER(10);
BEGIN
DBMS_OUTPUT.PUT_LINE(amount);
END;
Succeeds
5. In Application Express:
A. Create and execute a simple anonymous block that outputs your name.
BEGIN
DBMS_OUTPUT.PUT_LINE(‘Harsharan Kaur’);
END;
B. Create and execute a simple anonymous block that does the following:
Declares a variable of datatype DATE and populates it with the date that is six
months from today
Outputs “In six months, the date will be: <insert date>.”
DECLARE
v_six DATE;
BEGIN
v_six := ADD_MONTHS(SYSDATE, 6);
DBMS_OUTPUT.PUT_LINE('In six months, the date will be: '|| v_six);
END;