函数里如何保存一多条select记录,
然后把这个结果集返回。比如说select * tabale a where name = '';得到一条或多条结果集,然后又select * tabale a where name = '';得到一条或多条结果集,把这样多条select 语句的结果集加在一起返回
然后把这个结果集返回。比如说select * tabale a where name = '';得到一条或多条结果集,然后又select * tabale a where name = '';得到一条或多条结果集,把这样多条select 语句的结果集加在一起返回
union all
select * tabale a where name = 'b'
是这样的。
我写了一个函数。定义了一个游标记录结果集,
查一次就把记录open一次游标,把结果放到游标里。不过游标好象只能open一次呢。
有别的办法么? select * from rms.table t where t.name = 'aaa' and t.type = type;
if SQL%found then select * from rms.table t where t.name = 'aaa' and t.type = type;
open cur;
....
close cur;
...
open cur;
...
close cur;
把每次游标执行完的结果放进去
二呢 定义一个临时表,把每次游标执行完的结果插入进去
最后 select临时表 函数返回这个结果集的游标不知道大家还有什么办法