oracle报00103出现PROMpt,PL/SQL ERROR无法识别错误是什么,PSL-00103

我被要求编写一个简单的过程,它在证明条件下向表中插入一个新行。 数据库: 表用户 - USER_ID .... 表曲目 - track_id .... 表喜欢 - USER_ID,track_idPL/SQL ERROR无法识别错误是什么,PSL-00103

程序必须确保用户在用户,轨道是轨道,但两者都不会出现在喜欢的表的相同记录中。

不知道错误来自哪里,请帮忙!错误的

列表: 错误(72,1):PLS-00103:出现符号 “申报单” 错误(77.4):PLS-00103:出现符号 “档案结尾” 预期时下列之一:(开始的情况下宣告结束退出异常的转到如果环模空编译提高收益选择更新而与<

create or replace Procedure proc_insert_liked

(p_userID IN liked.user_id%TYPE , p_trackID IN liked.track_id%TYPE)

AS

test1 liked.user_id%TYPE;

test2 liked.track_id%TYPE;

test3 tracks.track_id%Type;

test4 users.user_id%Type;

cursor c1 is

Select user_id

from liked

where user_id = p_userID;

cursor c2 is

Select track_id

from liked

where track_id = p_trackID;

cursor c3 is

Select track_id

from tracks

where track_id = p_trackID;

cursor c4 is

Select user_id

from users

where user_id = p_userID;

Begin

--opening cursors

open c1;

open c2;

open c3;

open c4;

fetch c1 into test1;

fetch c2 into test2;

fetch c3 into test3;

fetch c4 into test4;

-- if user and track in liked

if (c1%found) AND (c2%found) then

dbms_output.put_line('User already liked that song');

else

-- if track in tracks

if c3%found then

-- if user in users

if c4%found then

Insert into Liked (user_id, track_id)

Values (p_userId, p_trackID);

else

dbms_output.put_line('no such a user');

end if;

else

dbms_output.put_line('no such a track');

end if;

end if;

-- closing cursors

close c1;

close c2;

close c3;

close c4;

EXCEPTION

WHEN OTHERS THEN

raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);

END;

Declare

prompt_user_id liked.user_id%Type :=4795;

prompt_track_id liked.track_id%Type :=199589;

Begin

proc_insert_liked(prompt_user_id, prompt_track_id);

end;

+0

另外 - 建议不要将对象创建和执行包括在同一个文件中。 –

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值