Tag: databases

Questions Related to databases

  1. Begin Dbms_output.put_line('Heello World'); exception when others then Dbms_output.put_line('error'); end; /

  2. Begin null; End;

  3. Declare a varchar2(100) := 'Hello World'; Begin Dbms_output.put_line(a); exception when others then Dbms_output.put_line('error'); end; /

  4. begin Dbms_output.put_line('Heello World'); end; /


Correct Option: B
  1. Case [ TRUE | selector_variable ]] When [criteria1 | expression1 ] then criteria1_statements; When [criteria1 | expression1 ] then Criteria2_statements; Else block statement; end;

  2. Case value case [criteria1 | expression1 ] then criteria1_statements; case [criteria1 | expression1 ] then Criteria2_statements; Else block statement; end case;

  3. Case [ TRUE | selector_variable ]] When [criteria1 | expression1 ] then criteria1_statements; When [criteria1 | expression1 ] then Criteria2_statements; Else block statement; end case;

  4. Case [ TRUE | selector_variable ]] Loop When [criteria1 | expression1 ] then criteria1_statements; When [criteria1 | expression1 ] then Criteria2_statements; Else block statement; end Loop;


Correct Option: C
  1. The exception B will be handled in inner block

  2. The exception B will be handled in outer block exception handler

  3. The exception will not be handled as there is no handler defined for B in inner block

  4. The exception section in inner block is executed and also Outer block exception section as we have defined there too


Correct Option: B
  1. There is no error in the statement

  2. Exception handler is missing

  3. DBMS_OUTPUT.PUT_LINE package must be declared

  4. semicolon is missing in the line "Dbms_output.put_line(‘Hello world’)"


Correct Option: D

CREATE OR REPLACE FUNCTION dml_call_sql (p_sal NUMBER) RETURN NUMBER IS BEGIN INSERT INTO employees(employee_id, last_name, email, hire_date, job_id, salary) VALUES(1, 'employee 1', '[email protected]', SYSDATE, 'SA_MAN', 1000); RETURN (p_sal + 100); END; / Function created. UPDATE employees SET salary = dml_call_sql(2000) WHERE employee_id = 170; What is the error in the block

  1. No errors in the block

  2. ORA-04091: table PLSQL.employees is mutating. Trigger/function may not see it. ORA-06512: at PL/SQL "DBMS_CALL_SQL"

  3. There is no exception handler in the function

  4. No rows updated exception will occur


Correct Option: B
  1. If the function exists, it will be dropped and replaced with the new version created by the statement.

  2. If the function does not exist, it will create a new one.

  3. No action will be taken

  4. There is no such option available.


Correct Option: A