function 调用 package
我想用oracle中的function调用下面的package 用
function输入3个值 调用package 后返回给function
请问怎么写
CREATE OR REPLACE PACKAGE BODY LESSON.PK_SHUILV
IS
PROCEDURE PK_SHUILV
/* Com=commodity Pri=price Pre=precision */
( InputDate in CHAR,
InpuComCode in number,
InputComNum in number,
Tax out number,
Pri out number,
TaxAndPri out number,
OutputTax out number,
OutputPri out number,
OutputTaxAndPri out number,
TaxRate out number,
TaxType out number,
Pre out number,
UnitPri out char,
CodeErr out char,
DateErr out date,
MyReturn out NUMBER
)
is
CodeNum NUMBER;
BEGIN
DateErr:=to_date(InputDate, 'YYYY-MM-DD ');
/***************************** tax ******************************/
select Code
into CodeErr
from T3
where CODE = InpuComCode;
select TAX
into TaxRate
from LESSON.T1
where DATENOW = InputDate;
select TAXTYPE
into TaxType
from LESSON.T3
where CODE = InpuComCode;
select TAXDEF
into Pre
from LESSON.T3
where CODE = InpuComCode;
select PRICE
into UnitPri
from LESSON.T2
where CODE = InpuComCode;
IFTaxType= 0THEN
Tax:= (UnitPri-(UnitPri/TaxRate));
Pri:= UnitPri*InputComNum - Tax*InputComNum;
ENDIF;
IF TaxType= 1THEN
Tax:= UnitPri * (TaxRate - 1);
Pri:= UnitPri*InputComNum;
ENDIF;
TaxAndPri:= Tax*InputComNum + Pri;
/***************************** precision ******************************/
IF Pre = 0THEN
OutputTax:=round(Tax,1)*InputComNum;
OutputPri:=round(Pri,1);
ENDIF;
IF Pre = 1THEN
OutputTax:=ceil(Tax)*InputComNum;
OutputPri:=ceil(Pri);
ENDIF;
IF Pre = 2THEN
OutputTax:=floor(Tax)*InputComNum;
OutputPri:=floor(Pri);
ENDIF;
OutputTaxAndPri:= OutputTax+OutputPri;
END;
END;
/
[解决办法]
function里定义一个package变量a,然后a.PK_SHUILV(参数)这样调用,要接受返回的话就用一个同类型的接收返回数据。
[解决办法]
a是基本数据类型, 不是一个对象
