示例: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;';
假设SQL如下定义
str_sql varchar2(2000);
str_sql := 'select * from v_query_receiptstoreout a where a.store_id = str_store_id;';
str_sql := 'select * from v_query_receiptstoreout a where a.store_id = str_store_id';
open ResultCursor for str_sql;
把这个变量str_sql 代替 for 后面的语句
正确的写法是
str_ := 'select * from v_query_receiptstoreout where store_id = :1';
OPEN ResultCursor FOR str_ using str_store_id;
分还是会给的,没那么多了哦^O^