create or replace procedure auto_deal(input_listing_price in type, Input_listing_number in type,input_product_id in type,input_et_id in type,input_class_id in type,input_cust_id in type)
is Sell_Part Boolean DEFAULT TRUE; --卖方拆单
Buy_Part Boolean DEFAULT FALSE; --买方拆单
Status Boolean;
Status Boolean DEFAULT FALSE;
length int;
all_listing_number float;
listing_number_tmp float;
product_id_tmp float;
listing_id_tmp float;
listing_price_tmp float;
cust_id_tmp int;
begin
Status:=false;
select sum(product_listing.listing_number) into all_listing_number from product, product_listing where product.product_id=product_listing.product_id and product.product_id=input_product_id and product_listing.is_done=0 and product_listing. for_sale=1 and product_listing.listing_price<=input_listing_price; Status:=false;
If all_listing_number < input_listing_number and not Buy_part then
begin
status:=false; exit;
end;
endif;
select count(product_listing.listing_id) into length from product, product_listing where product.product_id=product_listing.product_id and product.product_id=input_product_id and product_listing.is_done=0 and product_listing. for_sale=1 and product_listing.listing_price<=input_listing_price order by product_listing.listing_number;
select SellPart into Sell_Part from sys_config;
select BuyPart into Buy_Part from sys_config;
DECLARE
CURSOR info IS select product_listing.listing_number ,product_listing.listing_price,product_listing.product_id ,product_listing.listing_id ,product_listing.cust_id from product, product_listing where product.product_id=product_listing.product_id and product.product_id=input_product_id and product_listing.is_done=0 and product_listing. for_sale=1 and product_listing.listing_price<=input_listing_price order by product_listing.listing_number;
begin
open info;
for info_result in info LOOP --WHILE status ==false DO
begin -- if length=0 then exit; --endif;
FETCH info INTO listing_number_tmp ,listing_price_tmp,product_id_tmp,listing_id_tmp,cust_id_tmp;
If listing_number_tmp>input_listing_number and Sell_Part then
begin
--If Sell_Part then --卖方拆单
-- begin
update product_listing set is_done=1 where listing_id=listing_id_tmp; --成交input_listing_number,is_done=1,
insert into shop_order(et_id,class_id,product_id,order_number,order_price,A_cust_id,B_cust_id,auto_contract) values(input_et_id,input_class_id,product_id_tmp,listing_number_tmp,input_listing_price,cust_id_tmp,input_cust_id,1);--写shop_order表(auto_contract=1)。挂牌卖方订单
insert into product_listing(for_sell,product_id,et_id,class_id,cust_id,listing_number,listing_price) values(1,product_id_tmp,input_et_id,input_class_id, cust_id_tmp,listing_number_tmp-input_listing_number ,listing_price_tmp);
input_listing_number:=0;
status:=true;exit;
-- end;
--Endif;
end;
endif;
if listing_number_tmp=input_listing_number then
begin
update product_listing set is_done=1 where listing_id=listing_id_tmp; --成交input_listing_number,is_done=1,
insert into shop_order(et_id,class_id,product_id,order_number,order_price,A_cust_id,B_cust_id,auto_contract) values(input_et_id,input_class_id,product_id_tmp,listing_number_tmp,input_listing_price,cust_id_tmp,input_cust_id,1);--写shop_order表(auto_contract=1)。挂牌卖方订单
--成交input_listing_number,is_done=1, 写shop_order表(auto_contract=1)。
input_listing_number:=0;
status:=true;exit;
end;
endif;
if listing_number_tmp<input_listing_number and Buy_Part then
begin
--If Buy_part then ---买方订单拆单
-- begin
update product_listing set is_done=1 where listing_id=listing_id_tmp; --成交 listing_number_tmp,is_done=1,
insert into shop_order(et_id,class_id,product_id,order_number,order_price,A_cust_id,B_cust_id,auto_contract) values(input_et_id,input_class_id,product_id_tmp,listing_number_tmp,input_listing_price,cust_id_tmp,input_cust_id,1);--写shop_order表(auto_contract=1)。挂牌卖方订单
--成交 listing_number_tmp;is_done=1, 写shop_order表(auto_contract=1)。
input_listing_number:=input_listing_number-listing_number_tmp;
-- end;
-- Endif;
end;
endif; end;
end LOOP;
close info;
end;
if input_listing_number>0 then
begin
insert into product_listing(for_sale,product_id,et_id,class_id,cust_id,listing_number,listing_price) values(0,product_id_tmp,input_et_id,input_class_id, input_cust_id,input_listing_number ,input_listing_price);
end;
endif;
end auto_deal;
第81行报错:
Error: PLS-00103: Encountered the symbol ";" when expecting one of the following:
if,
请问是什么原因?
is Sell_Part Boolean DEFAULT TRUE; --卖方拆单
Buy_Part Boolean DEFAULT FALSE; --买方拆单
Status Boolean;
Status Boolean DEFAULT FALSE;
length int;
all_listing_number float;
listing_number_tmp float;
product_id_tmp float;
listing_id_tmp float;
listing_price_tmp float;
cust_id_tmp int;
begin
Status:=false;
select sum(product_listing.listing_number) into all_listing_number from product, product_listing where product.product_id=product_listing.product_id and product.product_id=input_product_id and product_listing.is_done=0 and product_listing. for_sale=1 and product_listing.listing_price<=input_listing_price; Status:=false;
If all_listing_number < input_listing_number and not Buy_part then
begin
status:=false; exit;
end;
endif;
select count(product_listing.listing_id) into length from product, product_listing where product.product_id=product_listing.product_id and product.product_id=input_product_id and product_listing.is_done=0 and product_listing. for_sale=1 and product_listing.listing_price<=input_listing_price order by product_listing.listing_number;
select SellPart into Sell_Part from sys_config;
select BuyPart into Buy_Part from sys_config;
DECLARE
CURSOR info IS select product_listing.listing_number ,product_listing.listing_price,product_listing.product_id ,product_listing.listing_id ,product_listing.cust_id from product, product_listing where product.product_id=product_listing.product_id and product.product_id=input_product_id and product_listing.is_done=0 and product_listing. for_sale=1 and product_listing.listing_price<=input_listing_price order by product_listing.listing_number;
begin
open info;
for info_result in info LOOP --WHILE status ==false DO
begin -- if length=0 then exit; --endif;
FETCH info INTO listing_number_tmp ,listing_price_tmp,product_id_tmp,listing_id_tmp,cust_id_tmp;
If listing_number_tmp>input_listing_number and Sell_Part then
begin
--If Sell_Part then --卖方拆单
-- begin
update product_listing set is_done=1 where listing_id=listing_id_tmp; --成交input_listing_number,is_done=1,
insert into shop_order(et_id,class_id,product_id,order_number,order_price,A_cust_id,B_cust_id,auto_contract) values(input_et_id,input_class_id,product_id_tmp,listing_number_tmp,input_listing_price,cust_id_tmp,input_cust_id,1);--写shop_order表(auto_contract=1)。挂牌卖方订单
insert into product_listing(for_sell,product_id,et_id,class_id,cust_id,listing_number,listing_price) values(1,product_id_tmp,input_et_id,input_class_id, cust_id_tmp,listing_number_tmp-input_listing_number ,listing_price_tmp);
input_listing_number:=0;
status:=true;exit;
-- end;
--Endif;
end;
endif;
if listing_number_tmp=input_listing_number then
begin
update product_listing set is_done=1 where listing_id=listing_id_tmp; --成交input_listing_number,is_done=1,
insert into shop_order(et_id,class_id,product_id,order_number,order_price,A_cust_id,B_cust_id,auto_contract) values(input_et_id,input_class_id,product_id_tmp,listing_number_tmp,input_listing_price,cust_id_tmp,input_cust_id,1);--写shop_order表(auto_contract=1)。挂牌卖方订单
--成交input_listing_number,is_done=1, 写shop_order表(auto_contract=1)。
input_listing_number:=0;
status:=true;exit;
end;
endif;
if listing_number_tmp<input_listing_number and Buy_Part then
begin
--If Buy_part then ---买方订单拆单
-- begin
update product_listing set is_done=1 where listing_id=listing_id_tmp; --成交 listing_number_tmp,is_done=1,
insert into shop_order(et_id,class_id,product_id,order_number,order_price,A_cust_id,B_cust_id,auto_contract) values(input_et_id,input_class_id,product_id_tmp,listing_number_tmp,input_listing_price,cust_id_tmp,input_cust_id,1);--写shop_order表(auto_contract=1)。挂牌卖方订单
--成交 listing_number_tmp;is_done=1, 写shop_order表(auto_contract=1)。
input_listing_number:=input_listing_number-listing_number_tmp;
-- end;
-- Endif;
end;
endif; end;
end LOOP;
close info;
end;
if input_listing_number>0 then
begin
insert into product_listing(for_sale,product_id,et_id,class_id,cust_id,listing_number,listing_price) values(0,product_id_tmp,input_et_id,input_class_id, input_cust_id,input_listing_number ,input_listing_price);
end;
endif;
end auto_deal;
第81行报错:
Error: PLS-00103: Encountered the symbol ";" when expecting one of the following:
if,
请问是什么原因?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货