这个(Oracle)存储过程错在那?很简单,各位大虾看一下,一定给分!!谢谢啦!!!!!

cqxhhe 2001-12-03 09:37:28
SQL> create or replace procedure upd_ord_detail
2 (p_order_no varchar2(20),
3 p_item_code varchar2(10),
4 p_item_qty numeric(10))
5 as
6 update ord_order_detail2
7 set item_qty = item_qty + p_item_qty
8 where order_no = p_order_no
9 and item_code = p_item_code;
10 if sql%rowcount = 0 then --no record updated
11 insert into ord_order_detail2 (order_no,item_code,item_qty)
12 values (p_order_no, p_item_code, p_item_qty);
13 end if;
14 end upd_ord_detail;
15 /

警告: 创建的过程带有编译错误。

SQL> show error;
PROCEDURE UPD_ORD_DETAIL 出现错误:

LINE/COL ERROR
-------- -----------------------------------------------------------------
2/26 PLS-00103: 出现符号 "("在需要下列之一时:
:=.),@%defaultcharacter
符号 ":=" 被替换为 "(" 后继续。

3/24 PLS-00103: 出现符号 "("在需要下列之一时:
:=.),@%defaultcharacter
符号 ":=" 被替换为 "(" 后继续。

4/24 PLS-00103: 出现符号 "("在需要下列之一时:
:=.),@%defaultcharacter
符号 ":=" 被替换为 "(" 后继续。

LINE/COL ERROR
-------- -----------------------------------------------------------------

6/3 PLS-00103: 出现符号 "UPDATE"在需要下列之一时:
beginfunctionpackage
pragmaproceduresubtypetypeuse<an identifier>
<a double-quoted delimited-identifier>cursorformcurrent
externallanguage
符号 "begin" 被替换为 "UPDATE" 后继续。
...全文
68 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
cqxhhe 2001-12-03
  • 打赏
  • 举报
回复
还是不行啊??

SQL> create or replace procedure upd_ord_detail
2 (p_order_no varchar2,
3 p_item_code varchar2,
4 p_item_qty numeric)
5 as
6 update ord_order_detail2
7 set item_qty = item_qty + p_item_qty
8 where order_no = p_order_no
9 and item_code = p_item_code;
10 if sql%rowcount = 0 then --no record updated
11 insert into ord_order_detail2 (order_no,item_code,item_qty)
12 values (p_order_no, p_item_code, p_item_qty);
13 end if;
14 end upd_ord_detail;
15 /

警告: 创建的过程带有编译错误。

SQL> show error;
PROCEDURE UPD_ORD_DETAIL 出现错误:

LINE/COL ERROR
-------- -----------------------------------------------------------------
6/3 PLS-00103: 出现符号 "UPDATE"在需要下列之一时:
beginfunctionpackage
pragmaproceduresubtypetypeuse<an identifier>
<a double-quoted delimited-identifier>cursorformcurrent
externallanguage
符号 "begin" 被替换为 "UPDATE" 后继续。
Free_Man 2001-12-03
  • 打赏
  • 举报
回复
create or replace procedure upd_ord_detail(p_order_no varchar2,
p_item_code varchar2,
p_item_qty numeric)
as
begin
update ord_order_detail2 set item_qty = item_qty + p_item_qty
where order_no = p_order_no and item_code = p_item_code;
if sql%rowcount = 0 then --no record updated
insert into ord_order_detail2 (order_no,item_code,item_qty)
values (p_order_no, p_item_code, p_item_qty);
end if;
end upd_ord_detail;
/
KingSunSha 2001-12-03
  • 打赏
  • 举报
回复
参数指定类型的时候不能指定长度
create or replace procedure upd_ord_detail
(p_order_no varchar2,
p_item_code varchar2,
p_item_qty number)

2,596

社区成员

发帖
与我相关
我的任务
社区描述
Sybase相关技术讨论区
社区管理员
  • Sybase社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧