请教一个SQL问题
是这样的
小弟定义变量如下
big_trade PRODUSRTB.WMRPT_BIGTRADE%rowtype;
TYPE ref_cursor_type is REF CURSOR;
select_cursor ref_cursor_type ;
PRODUSRTB.WMRPT_BIGTRADE这张表中间 有A,B,C,D,E,5列。游标select_cursor
是select a,b from table b where;
现在问题是这样的 我要把游标的查询结果 写到 big_trade.A,big_trade.C 怎么实现这个问题? 请各位不吝赐教
------解决方案--------------------把游标的查询结果附给两个变量,然后在循环里update表big_trade的字段,可以不~~
------解决方案--------------------fetch select_cursor
into big_trade.A, big_trade.B, big_trade.C, big_trade.D, big_trade.E
这个可以吗?
------解决方案--------------------declare @par1 varchar(20),@par2 varchar(20)
declare select_cursor cursor for select a,b from b where.... for read only
open select_cursor
fetch next from select_cursor into @par1,@par2
while(@@fetch_status=0)
begin
update big_trade set a = @par1,b=@par2 where.....
fetch next from myCursor into @par1,@par2
end
close select_cursor
deallocate select_cursor
类似这样行不?