create or replace function fn_bookid_get_by_chapterid(inintChapterId in integer,
outvarBookId out varchar2)
return integer is
/*
* 名 称: fn_bookid_get_by_chapterid
* 参 数:
* inintChapterId --章节
* outvarBookId --返回的书ID
* 功 能: 通过章节ID得到书的ID
*
* 创建日期: ××-××-××
* 创 建 人: ×××××
* ---------------------------
* 修改说明:
* 修改时间:
* 修 改 人:
*/
outintReturn integer;
v_cnt integer;
begin
/*
初始化输出参数
*/
outintReturn := 0;
/*
初始化变量
*/
/*
业务判断
*/
outvarBookId := '0';
select count(*)
into v_cnt
from tbbookchapter
where CHAPTERID = inintChapterId;
if (v_cnt>0) then
select bookid
into outvarBookId
from tbbookchapter
where CHAPTERID = inintChapterId;
end if;
return outintReturn;
end fn_bookid_get_by_chapterid;