2.2.1 Use Substitution VariablesIn this exercise, you will calculate the square of a number. The value of the number will be provided with the help of a substitution variable. Then the result will be displayed on the screen. Create the following PL/SQL script: -- ch02_1a.sql, version 1.0 SET SERVEROUTPUT ON DECLARE v_num NUMBER := &sv_num; v_result NUMBER; BEGIN v_result := POWER(v_num, 2); DBMS_OUTPUT.PUT_LINE ('The value of v_result is: ' v_result); END; Execute the script, and then answer the following questions:
2.2.2 Use the DBMS_OUTPUT.PUT_LINE StatementIn this exercise, you will determine the day of the week based on today's date. You will then display the results on the screen. Create the following PL/SQL script: -- ch02_2a.sql, version 1.0 SET SERVEROUTPUT ON DECLARE v_day VARCHAR2(20); BEGIN v_day := TO_CHAR(SYSDATE, 'Day'); DBMS_OUTPUT.PUT_LINE ('Today is 'v_day); END; Execute the script, and then answer the following questions:
|