示例:open ResultCursor for  select a.* from v_query_receiptstoreout a where a.store_id = str_store_id;请问高手要将cursor的查询部分改成动态sql应该怎么写?
假设SQL如下定义
str_sql varchar2(2000);
str_sql :=  'select * from v_query_receiptstoreout a where a.store_id = str_store_id;';

解决方案 »

  1.   

    str_sql varchar2(2000);
    str_sql :=  'select * from v_query_receiptstoreout a where a.store_id = str_store_id';
    open ResultCursor for str_sql;
      

  2.   

    你自己不是已经写出来了嘛
    把这个变量str_sql 代替 for  后面的语句
      

  3.   

    问题刚刚解决,我自己写得当然是不行的.....
    正确的写法是
    str_ := 'select * from v_query_receiptstoreout where store_id = :1';
        
    OPEN ResultCursor FOR str_ using str_store_id;
    分还是会给的,没那么多了哦^O^