这是oracle包实体里面的一个存储过程
CREATE OR REPLACE PACKAGE BODY CHXT_FWZ_FWH_RELATIONPACKAGE
is
procedure GetFwxxByFwzl
(
ret_cursor out mycursor,-- 定义过程,用游标变量作为返回参数
p_fwzl in varchar2,
p_yzh in varchar2,
p_gczh in number,
p_fh in varchar2,
p_type in number) as
p_strsql varchar2(500);
BEGIN
IF p_type =1 then
--精确查询
p_strsql := 'select a.*,b.* from chxt_fwzxxb a,chxt_fwfhxxb b where a.fwzl = p_fwzl ';
if p_yzh <> '' then
p_strsql := p_strsql || ' and YZH= p_yzh';
end if;
if p_gczh >0 then
p_strsql := p_strsql || ' and gczh = p_gczh';
end if;
p_strsql := p_strsql || ' and a.autoid = b.zbh';
if p_fh <> '' then
p_strsql := p_strsql || ' and b.fh = p_fh';
end if;
open ret_cursor for p_strsql;
----- else if p_type = 2 then
-----p_strsql := 'select a.*,b.* from chxt_fwzxxb a,chxt_fwfhxxb b where a.fwzl = p_fwzl ';
-----open ret_cursor for p_strsql;
else
p_strsql := 'select a.*,b.* from chxt_fwzxxb a,chxt_fwfhxxb b where a.fwzl = p_fwzl ';
open ret_cursor for p_strsql;
end if;
END GetFwxxByFwzl;
END CHXT_FWZ_FWH_RELATIONPACKAGE;
如果我注释掉
----- else if p_type = 2 then
-----p_strsql := 'select a.*,b.* from chxt_fwzxxb a,chxt_fwfhxxb b where a.fwzl = p_fwzl ';
-----open ret_cursor for p_strsql;
这一段,编译是正确的
但是,加上这一段 如下
CREATE OR REPLACE PACKAGE BODY CHXT_FWZ_FWH_RELATIONPACKAGE
is
procedure GetFwxxByFwzl
(
ret_cursor out mycursor,-- 定义过程,用游标变量作为返回参数
p_fwzl in varchar2,
p_yzh in varchar2,
p_gczh in number,
p_fh in varchar2,
p_type in number) as
p_strsql varchar2(500);
BEGIN
IF p_type =1 then
--精确查询
p_strsql := 'select a.*,b.* from chxt_fwzxxb a,chxt_fwfhxxb b where a.fwzl = p_fwzl ';
if p_yzh <> '' then
p_strsql := p_strsql || ' and YZH= p_yzh';
end if;
if p_gczh >0 then
p_strsql := p_strsql || ' and gczh = p_gczh';
end if;
p_strsql := p_strsql || ' and a.autoid = b.zbh';
if p_fh <> '' then
p_strsql := p_strsql || ' and b.fh = p_fh';
end if;
open ret_cursor for p_strsql;
else if p_type = 2 then
p_strsql := 'select a.*,b.* from chxt_fwzxxb a,chxt_fwfhxxb b where a.fwzl = p_fwzl ';
open ret_cursor for p_strsql;
else
p_strsql := 'select a.*,b.* from chxt_fwzxxb a,chxt_fwfhxxb b where a.fwzl = p_fwzl ';
open ret_cursor for p_strsql;
end if;
END GetFwxxByFwzl;
END CHXT_FWZ_FWH_RELATIONPACKAGE;
编译就有错误
Compilation errors for PACKAGE BODY FCCH.CHXT_FWZ_FWH_RELATIONPACKAGE
Error: PLS-00103: 出现符号 "GETFWXXBYFWZL"在需要下列之一时:
if
Line: 44
Text: END GetFwxxByFwzl;
Error: PLS-00103: 出现符号 "end-of-file"在需要下列之一时:
beginfunction
packagepragmaprocedureform
Line: 51
Compilation errors for PACKAGE BODY FCCH.CHXT_FWZ_FWH_RELATIONPACKAGE
Error: PLS-00103: 出现符号 "GETFWXXBYFWZL"在需要下列之一时:
if
Line: 44
Text: END GetFwxxByFwzl;
Error: PLS-00103: 出现符号 "end-of-file"在需要下列之一时:
beginfunction
packagepragmaprocedureform
Line: 51
麻烦各位指点一下!谢谢!