declare v_XTXMBH number; v_ZJZJZJRQ varchar2(40); cursor c_job is SELECT XT.XTXMBH AS XTXMBH, QJ.ZJZJZJRQ AS ZJZJZJRQ FROM XTXMXX XT, QJGLXX_ZQL_MID QJ WHERE XT.XTXMBH = QJ.XTXMBH AND XT.XTXMCLRQ >= '20120630' AND (QJ.ZJQHZJRQ IS NULL OR QJ.ZJZJZJRQ
用法:目的更新B表的数据 查询出A表的字段,命名为表1.然后更新B表 BEGIN FOR 表1 IN ( SELECT [匹配字段],[更新字段] FROM A表 ) loop UPDATE B表 SET B表.[需要更新字段]= 表1.[更新字段]: WHERE B表.[匹配字段]= 表1.[匹配字段]; END loop ; END; 实例: BEGIN FOR r IN ( SELECT A .*, b.SHORTLIST_EXPIRE_DATE old_SHORTLIST_EXPIRE_
DECLARE @a INTDECLARE aaa CURSOR for select columnID from LNDB_COLUMN_INFO where columnID BETWEEN 223899 AND 224003OPEN aaaFETCH next from aaa into @aWHILE @@fetch_status=0BEGINprint @aupdate LNDB_COLUMN_INFO SET columnID=@a-223910 where columnID=@aF