oracle存储过程查询更新--哪里有相关实例
萤火架构 2008-01-06 08:09:29 依据查询到的值,更新
CREATE OR REPLACE PROCEDURE SELECTUPDATETEST
(
WHERE_NUM IN VARCHAR2
)
is
v_dept number;
begin
select col2 into v_dept from tb1 where col1=WHERE_NUM;//第8行
UPDATEAMOUNTTEST2('110',v_dept);//第9行
EXCEPTION
WHEN OTHERS THEN
rollback;
end SELECTUPDATETEST;
CREATE OR REPLACE PROCEDURE UPDATEAMOUNTTEST2
(
WHERE_NUM IN VARCHAR2,
SET_NAME IN VARCHAR2
)
IS
BEGIN
UPDATE tb1 SET col2=SET_NAME where col1 like WHERE_NUM||'%';
EXCEPTION
WHEN OTHERS THEN
rollback;
END;
编译错误:
Compilation errors for PROCEDURE SCDX.SELECTUPDATETEST
Error: PLS-00103: 出现符号 ""在需要下列之一时:
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> << close current delete fetch lock insert
open rollback savepoint set sql execute commit forall merge
pipe
符号 "" 被忽略。
Line: 8
Text: select col2 into v_dept from tb1 where col1=WHERE_NUM;
Error: PLS-00103: 出现符号 ""在需要下列之一时:
begin case declare end
exception exit for goto if loop mod null pragma raise return
select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge pipe
符号 "" 被忽略。
Line: 9
Text: UPDATEAMOUNTTEST2('110',v_dept);