cStr = 'select * from tbl_name where a=:a1';
if aa=bb then
cStr = cStr || ' and b=:a2'
end if;
if cc<>dd then
cStr = cStr || ' and b=:a3'
end if;
dbms_sql.parse(nNum,cStr,DBMS_SQL.native);
dbms_sql.bind_variable(nNum,':a1',a1);
if aa=bb then
dbms_sql.bind_variable(nNum,':a2',a2);
end if;
if cc<>dd then
dbms_sql.bind_variable(nNum,':a3',a3);
end if;
http://www.itpub.net/showthread.php?s=&postid=8235339#post8235339
[@more@]来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7916042/viewspace-933348/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/7916042/viewspace-933348/