Pagini

marți, 12 martie 2013

Section 2 Lesson 1: Using Variables in PL/SQL


 Using Variables in PL/SQL

Section 1
 
  1.  Evaluate the following declaration. Determine whether or not it is legal.
DECLARE
    name,dept VARCHAR2(14);
(1) Points
   
    legal
    illegal (*)

  2.  Examine the following variable declarations:
DECLARE v_number NUMBER := 10; v_result NUMBER;
Which of the following correctly assigns the value 50 to V_RESULT?  (1) Points
   
    v_result := v_number * 5;
    v_result := 100 / 2;
    v_result := ROUND(49.77);
    All of the above. (*)
   
  3.  After they are declared, variables can be used only once in an application. True or False?  (1) Points
   
    True
    False (*)
   
  4.  Constants must be initialized. True or False?  (1) Points
   
    True (*)
    False
   
  5.  Evaluate the following declaration. Determine whether or not it is legal. DECLARE
    test NUMBER(5);  (1) Points
   
    legal (*)
    illegal
   
  6.  Which of the following are required when declaring a variable? (Choose two.)  (1) Points (Choose all correct answers)
   
    Identifier name (*)
    CONSTANT
    Data type (*)
    NOT NULL
   
  7.  Variables may be reused. True or False?  (1) Points
    True (*)
    False
   
  8.  A function called FORMAT_TODAYS_DATE accepts no parameters and returns today's date in the format: Month DD, YYYY
The following anonymous block invokes the function:

DECLARE v_today DATE; BEGIN -- invoke the function here

Which of the following statements correctly assigns the date variable v_today to the value returned by the format_todays_date function?
(1) Points
   
    format_todays_date := v_today('Month DD, YYYY');
    v_today := format_todays_date ('Month DD, YYYY');
    v_today := format_todays_date(v_today);
    v_today := TO_DATE(format_todays_date, 'Month DD, YYYY'); (*)

Niciun comentariu:

Trimiteți un comentariu