-查询view1中sname对应的最大的qty
createorreplacefunction find_qty(
f_name varchar2
)return NUMBER
is
Result NUMBER;beginselectmax(QTY)into Result from view1 where sname=f_name;return(Result);end;select find_qty('东方红')from dual;
--获得产品的状态,没有产品就提示没有createorreplacefunction fun1(
f1_no varchar2
)return number
as
f1_status s.STATUS%type;beginselectSTATUSinto f1_status from S where upper(f1_no)=upper(SNO);return f1_status;
exception
when no_data_found then
raise_application_error(-20009,'该产品不存在');end;select fun1('S1')from dual;