Skip to content

Instantly share code, notes, and snippets.

@ticklemynausea
Created September 1, 2014 15:13
Show Gist options
  • Save ticklemynausea/914c9d2d077b9242d79c to your computer and use it in GitHub Desktop.
Save ticklemynausea/914c9d2d077b9242d79c to your computer and use it in GitHub Desktop.
assert in pl/sql
create or replace procedure assert(
p_condition in boolean
) is
l_caller_owner varchar2(128);
l_caller_name varchar2(128);
l_caller_lineno varchar2(128);
l_caller_caller_t varchar2(128);
begin
if not p_condition then
owa_util.who_called_me(
owner => l_caller_owner,
name => l_caller_name,
lineno => l_caller_lineno,
caller_t => l_caller_caller_t
);
raise_application_error(-20999, 'ASSERT failed on '||l_caller_caller_t||' '||l_caller_owner||'.'||l_caller_name||':'||l_caller_lineno);
end if;
end assert;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment