![]() The CLOSE statement releases the current result set associated with the cursor. The OPEN statement populates the result set, and FETCH returns a row from the result set. This can differ based on another condition or a variable value. DECLARE CURSOR defines the attributes of a Transact-SQL server cursor, such as its scrolling behavior and the query used to build the result set on which the cursor operates. And you can see, the source table can be either 'sample_table_a' or 'sample_table_b'. he says he prefers to just use the update in rpgle because it only does one record at a time. , output fetch next from into while ( = 0)īegin print cast( as varchar) + ' - ' + fetch next from into end close deallocate /* = Sample Table B = */ set = ' select id, country from sample_table_b' set = ' set = cursor forward_only static for ' + + ' open exec ' cursor output'īegin print cast( as varchar) + ' - ' + fetch next from into end close deallocate the above example, I have used a dynamic select query to create a trigger. Re: Sqlrpgle Update haha, well one of the more experienced programmers here said that he doesn't like to use sql to update in rpgle because you could blow out the entire table if you aren't very careful and exact. * = Sample Table A = */ set = ' select id, name from sample_table_a' set = ' set = cursor forward_only static for ' + + ' open exec ' cursor output' * = Variable Declaration = */ declare as cursor declare as nvarchar(max)
0 Comments
Leave a Reply. |