Skip to content

Commit

Permalink
Check invalid procedure call (execute immediate 'call X' not allowed …
Browse files Browse the repository at this point in the history
…for Oracle 19c).
  • Loading branch information
paulissoft committed Jul 1, 2024
1 parent b724022 commit 44d6de3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
5 changes: 5 additions & 0 deletions db/app/msg/src/full/R__09.PACKAGE_SPEC.MSG_SCHEDULER_PKG.sql
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ e_end_date_not_in_the_future exception;
pragma exception_init(e_end_date_not_in_the_future, -20209);
c_end_date_not_in_the_future_msg constant varchar2(2000 char) := 'The end date ("%s") should be in the future (current system timestamp = "%s")';

c_invalid_procedure_call simple_integer := c_job_already_running - 10;
e_invalid_procedure_call exception;
pragma exception_init(e_invalid_procedure_call, -20210);
c_invalid_procedure_call_msg constant varchar2(2000 char) := 'Invalid procedure call: "%s"';

/**
Package to (re)start, stop or drop the process that will process the groups for which the default processing method is "package://<schema>.MSG_SCHEDULER_PKG"
and whose queue is NOT registered as a PL/SQL callback "plsql://<schema>.MSG_NOTIFICATION_PRC".
Expand Down
23 changes: 21 additions & 2 deletions db/app/msg/src/full/R__14.PACKAGE_BODY.MSG_SCHEDULER_PKG.sql
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,14 @@ pragma exception_init(e_procobj_locked, -27468);
e_job_is_not_running exception;
pragma exception_init(e_job_is_not_running, -27366);

-- ORA-06576: not a valid function or procedure name
e_not_a_valid_function_or_procedure_name exception;
pragma exception_init(e_not_a_valid_function_or_procedure_name, -06576);

-- ORA-06550: line 1, column 56:
e_parse_error exception;
pragma exception_init(e_parse_error, -6550);

-- ROUTINEs

procedure init
Expand Down Expand Up @@ -660,6 +668,9 @@ procedure process_command
( p_command in command_t
)
is
l_command constant command_t := 'begin
' || p_command || ';
end;';
begin
$if oracle_tools.cfg_pkg.c_debugging $then
dbug.print(dbug."info", 'process_command(p_command => %s)', dyn_sql_parm(p_command));
Expand All @@ -670,9 +681,17 @@ $end
g_commands.extend(1);
g_commands(g_commands.last) := p_command;
else
execute immediate 'call ' || p_command;
execute immediate l_command;
end if;
end;
exception
when e_parse_error or e_not_a_valid_function_or_procedure_name
then
raise_application_error
( c_invalid_procedure_call
, utl_lms.format_message(c_invalid_procedure_call_msg, l_command)
, true
);
end process_command;

-- invoked by:
-- * create_program
Expand Down

0 comments on commit 44d6de3

Please sign in to comment.