从Select语句将varchar2参数传递给plsql过程(Passing varchar2 parameter to plsql procedure from the Select stateme

编程入门 行业动态 更新时间:2024-10-10 14:21:13
从Select语句将varchar2参数传递给plsql过程(Passing varchar2 parameter to plsql procedure from the Select statement)

在Oracle Toad中执行以下语句

exec plsql_procedure(select 'somestring' from dual);

转发以下异常:

ORA-06550:第1行,第33列:PLS-00103:遇到以下某种情况时遇到符号“SELECT”:

() - + case mod new not null

过程采用一个VARCHAR2参数。 怎么修好?

Executing the following statement in Oracle Toad

exec plsql_procedure(select 'somestring' from dual);

trhows the following exception:

ORA-06550: line 1, column 33: PLS-00103: Encountered the symbol "SELECT" when expecting one of the following:

( ) - + case mod new not null

Procedure takes one VARCHAR2 parameter. How it can be fixed?

最满意答案

除非您使用select from dual只是其他内容的示例,否则请忽略选择。

exec plsql_procedure('somestring');

否则,选择一个变量并将其传递给过程。

declare my_var table_name.column_name%Type; begin select column_name into my_var from table_name where ...; plsql_procedure(parameter_name => my_var); end; /

Unless your use of the select from dual is just an example of something else, leave out the selection.

exec plsql_procedure('somestring');

Otherwise, select into a variable and pass that to the procedure.

declare my_var table_name.column_name%Type; begin select column_name into my_var from table_name where ...; plsql_procedure(parameter_name => my_var); end; /

更多推荐

本文发布于:2023-08-07 07:24:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1463055.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:语句   参数   过程   Select   plsql

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!