Q:

Write a PL/SQL procedure to accepts a BOOLEAN parameter and uses a CASE statement to print Unknown if the value of the parameter is NULL, Yes if it is TRUE, and No if it is FALSE

0

Write a PL/SQL procedure to accepts a BOOLEAN parameter and uses a CASE statement to print Unknown if the value of the parameter is NULL, Yes if it is TRUE, and No if it is FALSE.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

CREATE PROCEDURE use_of_boolean (bl BOOLEAN) AUTHID DEFINER
AS
BEGIN
  DBMS_OUTPUT.put_line (
    CASE
      WHEN bl IS NULL THEN 'Unknown'
      WHEN bl THEN 'Yes'
      WHEN NOT bl THEN 'No'
    END
  );
END;
/
BEGIN
  use_of_boolean(NULL);
  use_of_boolean(FALSE);
  use_of_boolean(TRUE);
END;
/
Sample Output:
Unknown
No
Yes

PL/SQL procedure successfully completed.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now