为什么我的
oracle存储过程编译报错呢?
create or replace procedure PTR_add_check (
mid varchar2 (50)
,UserID varchar2 (50)
,code varchar2 (50)
,Barcode varchar2 (50)
,Msg out varchar2 (100)) as
Qty number,
name varchar2 (50),
Package varchar2 (50)
begin
select name,Package into name,Package from "SYSTEM"."pt_wh_goods" where Barcode=Barcode
if SQL%rowcount =0
begin
Msg := '条码(' + ltrim(rtrim(Barcode)) + ')不存在!'
DBMS_OUTPUT.put_line(Msg);
end
select qty:=isnull(order_qty,0) from "SYSTEM"."pt_wh_add_items" where order_code=code and barcode=barcode
begin
if SQL%rowcount =0 then
qty:=0
Msg :=name+'('+Package+')' + ' 已下补货数量:' + cast(qty as varchar2(20))
DBMS_OUTPUT.put_line(Msg);
end
end;
------解决方案--------------------
create or replace procedure PTR_add_check (
mid VARCHAR2,
UserID VARCHAR2,
code VARCHAR2,
Barcode VARCHAR2,
Msg out VARCHAR2) AS
Qty NUMBER;
v_name VARCHAR2(50);
v_package VARCHAR2(50);
BEGIN
SELECT name,Package INTO v_name,v_package FROM "SYSTEM"."pt_wh_goods" WHERE Barcode=Barcode;
IF SQL%rowcount = 0 THEN
Msg := '条码(' + ltrim(rtrim(Barcode)) + ')不存在!';
DBMS_OUTPUT.put_line(Msg);
END IF;
SELECT isnull(order_qty,0) INTO Qty FROM "SYSTEM"."pt_wh_add_items" WHERE order_code=code AND barcode=barcode;
IF SQL%rowcount = 0 THEN
qty := 0;
Msg := name+'('+Package+')' + ' 已下补货数量:' + qty;
DBMS_OUTPUT.put_line(Msg);
END IF;
end;
SQL语句自己去调吧 我没有表!