本文介绍了pl/sql存储过程:参数名称与列名称相同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个这样的存储过程
I have a Stored Procedure like this
procedure P_IssueUpdate
(
Id in integer,
ModifiedDate in date,
Solution in varchar2
) AS
BEGIN
update T_Issue
Set
ModifiedDate = ModifiedDate,
Solution = Solution
where id = id;
END P_IssueUpdate;
我的问题是参数名称与表"列名称相同.有没有一种方法可以指示sql"=之后的值应该是参数而不是列"?
my problem is that the parameter name is the same name as the Table column name.Is there a way to instruct the sql that the value after the "=" should be the parameter and not the column?
感谢您的帮助
推荐答案
您可以为过程名称加上参数和变量名,如下所示:
You can prefix parameter and variable names with the name of the procedure like this:
SQL> declare
2 procedure p (empno number) is
3 ename varchar2(10);
4 begin
5 select ename
6 into p.ename
7 from emp
8 where empno = p.empno;
9 dbms_output.put_line(p.ename);
10 end;
11 begin
12 p (7839);
13 end;
14 /
KING
PL/SQL procedure successfully completed.
这篇关于pl/sql存储过程:参数名称与列名称相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!