Total Pageviews

June 25, 2016

6/25/2016 12:27:00 PM
Oracle plsql questions

What is the output for below code?

DECLARE
  shigh  EXCEPTION;
  csal NUMBER := 20000;
  msal NUMBER := 10000;
  erroneous_salary NUMBER;
BEGIN
  BEGIN  ---------- sub-block begins
    IF csal > msal THEN
      RAISE shigh;  -- raise the exception
    END IF;
  EXCEPTION
    WHEN shigh THEN
      -- first step in handling the error
      DBMS_OUTPUT.PUT_LINE('Salary ' || erroneous_salary ||
      ' is out of range.');
      DBMS_OUTPUT.PUT_LINE
        ('Maximum salary is ' || msal || '.');
      RAISE;  -- reraise the current exception
  END;  ------------ sub-block ends
EXCEPTION
  WHEN shigh THEN
    -- handle the error more thoroughly
    erroneous_salary := csal;
    csal := msal;
    DBMS_OUTPUT.PUT_LINE('Revising salary from ' || erroneous_salary ||
       ' to ' || csal || '.');
END;
/
For answer(with explanation) visit tomorrow 
 
Related Posts Plugin for WordPress, Blogger...