gsh*_*arp 24 oracle plsql stored-procedures
我有这样的存储过程
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;
Run Code Online (Sandbox Code Playgroud)
我的问题是参数名称与表列名称相同.有没有办法指示sql"="之后的值应该是参数而不是列?
谢谢你的帮助
Ton*_*ews 43
您可以使用过程的名称为参数和变量名称添加前缀,如下所示:
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.
Run Code Online (Sandbox Code Playgroud)
我找到了解决方案。它通过完全限定参数来工作:
procedure P_IssueUpdate
(
Id in integer,
ModifiedDate in date,
Solution in varchar2
) AS
BEGIN
update T_Issue
Set
ModifiedDate = P_IssueUpdate.ModifiedDate,
Solution = P_IssueUpdate.Solution
where id = P_IssueUpdate.id;
END P_IssueUpdate;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
18853 次 |
| 最近记录: |