日期:2014-05-17  浏览次数:20830 次

求各位大神帮忙 存储过程问题
我想建一个 存储过程 


create or replace procedure proc_CLXX_List --查询

(

pro_cursor out pkg_order.p_cursor, --查询结果集

pzh_ in varchar2,--牌照号

beginTime_ in date,--创建日期上限

endTime_ in date,--创建日期上限
) is sql_str varchar2(1000):= ' select * from o_hbbz_djb a where(:pzh_ is null or c.characters like :pzh_) and (:beginTime_ is null or c.createtime > :beginTime_) and (:endTime_ is null or c.createtime < :endTime_) and rownum<=:500 end proc_client_List';



哪里出错了 请各位大神 指点 一下 可以吗 谢谢

------解决方案--------------------
SQL code

create or replace procedure proc_CLXX_List(
pro_cursor out pkg_order.p_cursor,
pzh_ in varchar2,
beginTime_ in date,
endTime_ in date
)
is
sql_str varchar2(1000):= 'select * from o_hbbz_djb a where(:pzh_ is null or a.PZH like :pzh_) 
        and (:beginTime_ is null or a.FFTIME > :beginTime_) 
        and (:endTime_ is null or a.FFTIME < :endTime_) 
        and rownum<=500';
begin
    open pro_cursor for sql_str
        using pzh_,pzh_,beginTime_,beginTime_,endTime_,endTime_;
end;
/