Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagecpp
 
/* The cursor is declared using the LIMIT clause. n is the last record value to be returned in the LIMIT clause and must be defined according to the operating environment. The number of records in the communication buffer depends on the record size. */
DECLARE 커서CURSOR
         SELECT ~
           FROM ~
          WHERE ~
          LIMIT :s_start, n;
              

/* Declare the starting value used in the LIMIT clause. */
s_start = 1;
   
while(1)
{ 
    /* Cursor open is repeated until all records meeting the conditions are fetched. */                   
    OPEN CURSOR
    
		while(1)
		{
		    FETCH CURSOR ;
		    
		    if (sqlca.sqlcode == SQL_SUCCESS) {
		    
		       /* Execute change DML */   		     		       
		    }
		    else if (sqlca.sqlcode == SQL_NO_DATA) {
		       ...
		    }
		    else {              
		       ...
		    }   
		}
		
		/* Perform COMMIT or ROLLBACK */    
 
       /* Specify the starting value of the LIMIT clause. n is an example. */ 
       s_start = s_start + n ; 
        
}

CLOSE CURSOR 또는OR CLOSE RELEASE CURSOR
 

3. fetch across commit 

...