Search notes:

Oracle: PL/SQL package ASSERT

is_true(val) Makes sure that the boolean value val is true.
usr('RENE') Makes sure that user evaluates to RENE. Used in conjunction with AUTHID CURRENT_USER

Specification

create or replace package assert
   authid current_user
as
 --
 -- V0.2
 --

    procedure is_true(val      boolean);

    procedure usr(assumed_user varchar2);

end assert;
/
Github repository PL-SQL-pkg-assert, path: /spec.sql

Body

create or replace package body assert
as
 --
 -- V0.2
 --

    procedure is_true(val boolean) is -- {
    begin

        if val is null then
           raise_application_error(-20800, user || ' val is neither true nor false');
        end if;

        if not val then
           raise_application_error(-20800, user || ' val is false');
        end if;

    end is_true; -- }

    procedure usr(assumed_user in varchar2) is -- {
    begin

       if upper(assumed_user) != user then
          raise_application_error(-20800, user || ' is not ' || assumed_user);
       end if;

    end usr; -- }

end assert;
/
Github repository PL-SQL-pkg-assert, path: /body.sql

History

V0.2 Add is_true (2021-07-16)

Index