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

  • pl/sql

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.

الأجوبة

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.
هل كان المحتوى مفيد؟

معلومات ذات صلة

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...