You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would be good if the throws annotation allow to instead of hardocode number use a constant from other packages. Quite often the error numbers are defined in common package so that can be reused.
eg. - - %throws(schema.package.c_e_exception_no)
The text was updated successfully, but these errors were encountered:
If we want to support variables, we should probably support both kinds (number/exception)
If we will go into effort of supporting exception type, we're actually already there to support named exceptions too.
Sample code:
create or replace package my_exceptions is
e_some_exception exception;
pragma exception_init(e_some_exception, -20000);
e_other_exception constant integer :=-20000;
end;
/
declare
procedure check_var(a_var varchar2) is
a varchar2(250);
b varchar2(250);
c varchar2(250);
dblink varchar2(250);
next_pos pls_integer;
begin--check if it is a number firstdbms_utility.name_tokenize(a_var, a, b, c, dblink, next_pos);
--check if it is a predefined exceptionbegin
execute immediate 'begin null; exception when '||a_var||' then null; end;';
dbms_output.put_line(a_var||' is a named exception');
exception
when others then
if dbms_utility.format_error_stack() like'%PLS-00485%' then
execute immediate 'declare x positiven := -('||a_var||'); begin null; end;';
dbms_output.put_line(a_var||' is a negative number');
--- then what?
end if;
end;
end;
begin
check_var('my_exceptions.e_some_exception');
check_var('my_exceptions.e_other_exception');
check_var('no_data_found');
-- check_var('-20000');
end;
/
Would be good if the throws annotation allow to instead of hardocode number use a constant from other packages. Quite often the error numbers are defined in common package so that can be reused.
eg. - - %throws(schema.package.c_e_exception_no)
The text was updated successfully, but these errors were encountered: