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

查询条件是字符型变量该怎么弄
可能表述的有点问题
看部分代码
declare
  v_where varchar2(200) default '1=1';  
  v_uiid varchar2(20) default '';
begin

 select a,b into v_a,v_b
  from promotions where id=542 and rownum=1; 
 if v_a> 0 then
  v_where := v_where || ' and a=' || v_a;
  end if; 
 if v_b> 0 then
  v_where := v_where || ' and b=' || v_b;
 end if; 

select uiid into v_uiid from userinfo where v_where
这行报错 好像是提示表达式类型不匹配
end;

该怎么弄?

------解决方案--------------------
execute immediate 'select uiid from userinfo where '||v_where into v_uiid;