[plsql] QueryHomework
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
- // 1. WRITE a PL/SQL block TO show an invalid case-insensitive reference TO a quoted AND without quoted user-defined identifier.
- QUOTED USER-IDENTIFIER
- DECLARE
- "HELLO" VARCHAR2(10) :='Hello';
- BEGIN
- DBMS_OUTPUT.put_line("Hello");
- END;
- // 2. WRITE a PL/SQL block TO calculate the incentive OF an employee whose ID IS 110.
- DECLARE
- v_incentive NUMBER(8,2);
- BEGIN
- SELECT salary * 0.15 INTO v_incentive
- FROM employees
- WHERE employee_id = 110;
- DBMS_OUTPUT.put_line('Incentive = '||v_incentive);
- END;
- // 3. WRITE a PL/SQL block TO show the result TO neglect double quotation marks IN reserved word identifier.
- DECLARE
- "HELLO" VARCHAR2(25) :='hello';
- "DECLARE" VARCHAR2(25) :='declare';
- BEGIN
- DBMS_OUTPUT.put_line(Hello);
- DBMS_OUTPUT.put_line(DECLARE);
- END;
- // 4. WRITE a PL/SQL block TO show a reserved word can be used AS a user-define identifier.
- DECLARE
- "DECLARE" VARCHAR2(25) :='UPPERCASE DECLARE';
- "Declare" VARCHAR2(25) :='Declare with uppercase D';
- "declare" VARCHAR2(25) := 'lowercase declare';
- BEGIN
- DBMS_OUTPUT.put_line("HELLO");
- DBMS_OUTPUT.put_line("Hello");
- DBMS_OUTPUT.put_line("hello");
- END;
- // 5. WRITE a PL/SQL block TO explain single AND multiline comments.
- DECLARE
- v_name VARCHAR2(25) :='Danail'; --we declare name and this is single line comment
- BEGIN
- DBMS_OUTPUT.put_line(v_name); /*we use this commant to display the name.
- and this is multi line comment*/
- END;
- // 6. WRITE a PL/SQL block TO show the result TO neglect the CASE sensitivity OF a USER defined identifier which IS also a reserved word.
- DECLARE
- "HELLO" VARCHAR2(10) := 'hello';
- "DECLARE" VARCHAR2(10) := 'declare';
- BEGIN
- DBMS_OUTPUT.Put_Line(Hello);
- DBMS_OUTPUT.Put_Line("Declare");
- END;
- // 7. WRITE a PL/SQL block TO show a valid case-insensitive reference TO a quoted AND without quoted user-defined identifier.
- --QUOTED USER-IDENTIFIER
- DECLARE
- "HELLO" VARCHAR2(10) :='Hello';
- BEGIN
- DBMS_OUTPUT.put_line("HELLO");
- END;
- --WITHOUT QUOTED USER-IDENTIFIER
- DECLARE
- HELLO VARCHAR2(10) :='Hello';
- BEGIN
- DBMS_OUTPUT.put_line(HELLO);
- END;
- // 8. WRITE PL/SQL blocks TO show the scope AND visibility OF local AND global identifiers.
- DECLARE
- var_a INTEGER;
- var_b REAL;
- BEGIN
- var_a:=5;
- var_b:=10.25;
- DBMS_OUTPUT.PUT_LINE('In the Outer Block');
- DBMS_OUTPUT.PUT_LINE('var_a = ' || var_a);
- DBMS_OUTPUT.PUT_LINE('var_b = ' || var_b);
- DECLARE
- var_a CHAR;
- var_c REAL;
- BEGIN
- var_a:='C';
- var_c:=15.50;
- DBMS_OUTPUT.PUT_LINE('In the First sub-Block');
- DBMS_OUTPUT.PUT_LINE('var_a = ' || var_a);
- DBMS_OUTPUT.PUT_LINE('var_b = ' || var_b);
- DBMS_OUTPUT.PUT_LINE('var_c = ' || var_c);
- NULL;
- END;
- DECLARE
- var_d REAL;
- BEGIN
- var_d:=20.75;
- DBMS_OUTPUT.PUT_LINE('In the Second sub-Block');
- DBMS_OUTPUT.PUT_LINE('var_a = ' || var_a);
- DBMS_OUTPUT.PUT_LINE('var_b = ' || var_b);
- DBMS_OUTPUT.PUT_LINE('var_d = ' || var_d);
- NULL;
- END;
- DBMS_OUTPUT.PUT_LINE('At the end in the Outer-Block');
- DBMS_OUTPUT.PUT_LINE('var_a = ' || var_a);
- DBMS_OUTPUT.PUT_LINE('var_b = ' || var_b);
- END;
Editor
You can edit this paste and save as new:
File Description
- QueryHomework
- Paste Code
- 23 Jun-2021
- 3.25 Kb
You can Share it:
Latest Code Pastes