简体   繁体   English

Oracle 数据库 - 在 dbms_parallel_execute 中立即执行

[英]Oracle Database - EXECUTE IMMEDIATE inside dbms_parallel_execute

I've faced the following task: to parallel some process on Oracle 12c database.我面临以下任务:在 Oracle 12c 数据库上并行一些进程。 As always, I've started making this using dbms_parallel_execute package.和往常一样,我已经开始使用dbms_parallel_execute包来做这个。 Created a new task using dbms_parallel_execute.run_task procedure and passed my anonymous block with stored procedure call as sql_stmt parameter.使用dbms_parallel_execute.run_task过程创建了一个新任务,并通过存储过程调用作为sql_stmt参数传递了我的匿名块。

l_sql := 'BEGIN my_procedure(:start_id, :end_id); END;';
dbms_parallel_execute.run_task
(
    task_name => l_task_name,
    sql_stmt => l_sql,
    language_flag => dbms_sql.native,
    parallel_level => l_parallel_level
);

This stored procedure calls a couple of other procedures.这个存储过程调用了几个其他过程。

As a result, my "parent" procedure fails with the following exception:结果,我的“父”程序失败,但出现以下异常:

PLS-00103: Encountered the symbol "." when expecting one of the following:

   ( begin case declare exit for goto if loop mod null pragma
   raise return select update while with <an identifier>
   <a double-quoted delimited-identifier> <a bind variable> <<
   continue close current delete fetch lock insert open rollback
   savepoint set sql execute commit forall merge pipe purge
The symbol "<an identifier>" was substituted for "." to continue.

As I found out, this exception throws because of EXECUTE IMMEDIATE call inside on of the procedures:正如我发现的那样,由于过程中的EXECUTE IMMEDIATE调用而引发此异常:

l_sql := 'BEGIN ' || some_another_pkg.schema_name || '.some_pkg.some_procedure(:1, :2); END;'

EXECUTE IMMEDIATE l_sql 
USING l_param_1, l_param_2l

Where schema_name is a global variable of VARCHAR2(30) inside some_another_pkg package.其中schema_namesome_another_pkg包内 VARCHAR2(30) 的全局变量。

When I changed it to a forward procedure call, exception disappeared.当我将其更改为转发过程调用时,异常消失了。 But I can't replace this EXECUTE IMMEDIATE on a target environment.但是我无法在目标环境中替换此EXECUTE IMMEDIATE

Are there any workarounds to fix this issue without replacing EXECUTE IMMEDIATE call?是否有任何解决方法可以在不替换EXECUTE IMMEDIATE调用的情况下解决此问题?

Thanks in advance.提前致谢。

The problem, as it was mentioned in comments, was in some_another_pkg.schema_name code.正如评论中提到的,问题出在some_another_pkg.schema_name代码中。 In my case this value was NULL .在我的情况下,这个值是NULL

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM