oracle存储过程测试,提示 ORA-24344: success with compilation error ,请帮我看看哪一行有问题。
createorreplacePROCEDURErate_test(codeStrintemptable.pcode%type,pStrintemptable.prob%...
create or replace PROCEDURE rate_test (codeStr in temptable.pcode%type,pStr in temptable.prob%type)
AS
rStr NUMBER;
BEGIN
select rper INTO rStr from temptable where pcode = codeStr
and prob = pStr;
IF 1=1 THEN
begin
update temptable set createflag = '1'
commit;
end;
end if;
EXCEPTION
when other then
rollback;
end rate_test; 展开
AS
rStr NUMBER;
BEGIN
select rper INTO rStr from temptable where pcode = codeStr
and prob = pStr;
IF 1=1 THEN
begin
update temptable set createflag = '1'
commit;
end;
end if;
EXCEPTION
when other then
rollback;
end rate_test; 展开
2个回答
展开全部
有两处错误:
1.update后的分后
2.rStr NUMBER;要去掉,rStr NUMBER;是多余的,procedure是没有返回值的,就算写成function,也应该写成return number 而不是rStr NUMBER;,
还有就是要在此处写is
改成这样,执行以下修改后的看看:
CREATE OR REPLACE PROCEDURE Rate_Test(Codestr IN Temptable.Pcode%TYPE,
Pstr IN Temptable.Prob%TYPE) IS
BEGIN
SELECT Rper
INTO Rstr
FROM Temptable
WHERE Pcode = Codestr
AND Prob = Pstr;
IF 1 = 1 THEN
BEGIN
UPDATE Temptable SET Createflag = '1';
COMMIT;
END;
END IF;
EXCEPTION
WHEN Other THEN
ROLLBACK;
END Rate_Test;
1.update后的分后
2.rStr NUMBER;要去掉,rStr NUMBER;是多余的,procedure是没有返回值的,就算写成function,也应该写成return number 而不是rStr NUMBER;,
还有就是要在此处写is
改成这样,执行以下修改后的看看:
CREATE OR REPLACE PROCEDURE Rate_Test(Codestr IN Temptable.Pcode%TYPE,
Pstr IN Temptable.Prob%TYPE) IS
BEGIN
SELECT Rper
INTO Rstr
FROM Temptable
WHERE Pcode = Codestr
AND Prob = Pstr;
IF 1 = 1 THEN
BEGIN
UPDATE Temptable SET Createflag = '1';
COMMIT;
END;
END IF;
EXCEPTION
WHEN Other THEN
ROLLBACK;
END Rate_Test;
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
update最后少了个分号
追问
加分号,
还是
success with compilation error
追答
你用show errors命令看看,会显示详细的错误信息的。
另一个错误是EXCEPTION里,要用OTHERS,不是OTHER。
给你个改好的,编译成功。修改就两处,一个是UPDATE后面的分号,另一个是EXCEPTION里改成OTHERS
create or replace PROCEDURE rate_test (codeStr in temptable.pcode%type,pStr in temptable.prob%type)
AS
rStr NUMBER;
BEGIN
select rper INTO rStr from temptable where pcode = codeStr
and prob = pStr;
IF 1=1 THEN
begin
update temptable set createflag = '1';
commit;
end;
end if;
EXCEPTION
when others then
rollback;
end rate_test;
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询