各位,想问一下这个存储过程如何写.
表1 test2
a b
表2 test3
c dtest2.a=test3.c想将A和C关联的数据B更新到CSELECT ::update test3 set d=
(select b from test2
where a='a2')
where c='a2'我写的存储过程:create PROCEDURE dd(P_ID IN NUMBER)
ISCURSOR REMARK IS
SELECT a
FROM test2
WHERE a = P_ID;beginFOR j in re loopupdate test3 set d=
(select b from test2
where a=j.p_id)
where c=j.p_idend loop;end; 帮忙看下那里有问题..
表1 test2
a b
表2 test3
c dtest2.a=test3.c想将A和C关联的数据B更新到CSELECT ::update test3 set d=
(select b from test2
where a='a2')
where c='a2'我写的存储过程:create PROCEDURE dd(P_ID IN NUMBER)
ISCURSOR REMARK IS
SELECT a
FROM test2
WHERE a = P_ID;beginFOR j in re loopupdate test3 set d=
(select b from test2
where a=j.p_id)
where c=j.p_idend loop;end; 帮忙看下那里有问题..
IS CURSOR REMARK IS
SELECT a,b
FROM test2
WHERE a = P_ID; begin FOR j in re loop update test3 set d= j.b
where c = j.a;
end loop; end;
试试。
.(*@%&-+;/atmodremreturnreturning
<an exponent (**)>andor||
?? ";" ???? "END" ????
行:18
SELECT a
FROM test2
WHERE a = P_ID; begin
FOR j in re loop update test3 set d=
(select b from test2
where a=j.a)
where c=j.a ;end loop;
end t;
你这种情况没有必要使用update中的子查询的。
好好想想,应该很容易实现。
另外,我这个存储过程编译能通过,但如何CALL T呢?
请指教.
t(1);
end;select * from test3;存储过程的调用本身就是PLSQL语句,不是表达式的一部分来调用的的(函数是)最终要看存储过程运行的结果 就要看你的那个存储过程是干什么的,
这里你更新TEST3,就查查TEST3看变化吧!
begin
cc.t(1);
end; 不能调用测试.
上面错了
是
begin
t(1);
end; 存储过程不属于哪个表!
要是想调用游标,参量就把它写在一个包里(PACKAGE)
包是全局的,存储过程和函数是局部的