Norbert Felde wrote : > >Hi, > >I tried to loop through the result of the cur_vpid cursor but >it gives me >only the first record. I am sure that there are more than only one >record. What do I wrong? Is there a different way to step through a >result table? > >maxdb 7.5.00.05 >winxp > >Thanks, >Norbert > >The dbproc code snippet: > >TRY >DECLARE CUR_VPID CURSOR FOR > SELECT VIZSGALAT_PARAMETERID > FROM KFCSUSER.VIZSGALAT_PARAMETER > WHERE VIZSGALATID = :VID ORDER BY SORSZAM; > >SET NR = TRUE; >FETCH FIRST "CUR_VPID" INTO :PID; >WHILE( NR = TRUE ) DO BEGIN > SELECT SEQ_VIZSGALATPARAMID.NEXTVAL FROM DBA.DUAL; > FETCH INTO :VPID; > > INSERT INTO KFCSUSER.VIZSGALAT_PARAMETER > SELECT :VPID, :NVID, SORSZAM, OSSZETEVOID, MERTEKEGYSEGID, > ALSOMERESIHATAR > FROM KFCSUSER.VIZSGALAT_PARAMETER > WHERE VIZSGALAT_PARAMETERID = :PID; > > INSERT INTO KFCSUSER.VIZSGALAT_HATARERTEK > SELECT :VPID, JEL, ERTEK FROM KFCSUSER.VIZSGALAT_HATARERTEK > WHERE VIZSGALAT_PARAMETERID = :PID; > > FETCH NEXT "CUR_VPID" INTO :PID; >END; >CLOSE CUR_VPID; >CATCH > IF( $rc = 100 ) THEN BEGIN > SET NR = FALSE; > CONTINUE EXECUTE; > END; > > > >-- >MaxDB Discussion Mailing List >For list archives: http://lists.mysql.com/maxdb >To unsubscribe: >http://lists.mysql.com/[EMAIL PROTECTED] > >
I have just a supposition. If one of the insert select statements inside the while loop returns error 100, the while loop terminates. Please have a look into the vtrace for this. Besides, you don't have to select DBA.DUAL for the next sequence value. Just write VPID = SEQ_VIZSGALATPARAMID.NEXTVAL; Best Regards, Thomas -- MaxDB Discussion Mailing List For list archives: http://lists.mysql.com/maxdb To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
