Hey Hi SET, le me Have a look.
How are You Sir? :)
Quite not seen from long time... :)
Thanks a Ton again...
On Friday, 17 February 2017 4:21 PM, "Svein Erling Tysvær
setys...@gmail.com [firebird-support]" wrote:
I don't use cursors myself, but are you sure "open cur_list_of_contracts;"
is enough to set a value different from 0 for row_count? Maybe you need to do
the first fetch earlier, e.g.
execute block as declare contractno
CHAR(20); declare cur_list_of_contracts cursor for (select CU.CONTRACTNO
from CLASSIC_UPGRADE CU
join CONTRACT C on C.CONTRACTNO = CU.CONTRACTNO
where C.CONTRACTSTATUS = 'A'
and CU.INSERTDATE > '09/01/2016'
and CU.INSERTDATE < '09/10/2016'
and (CU.STATUS in ('authorized', 'Authorized')
and C.CONVERT2YRDATE IS NULL );begin
open cur_list_of_contracts; fetch cur_list_of_contracts into contractno;
while (ROW_COUNT > 0) do begin UPDATE CONTRACT C SET CONVERT2YRDATE =
(SELECT CU.INSERTDATE From CLASSIC_UPGRADE CU where CU.CONTRACTNO =
:contractno) where C.CONTRACTNO = :contractno; if (ROW_COUNT = 0) then
leave; fetch cur_list_of_contracts into contractno; end close
cur_list_of_contracts;end;
HTH,Set
2017-02-17 10:04 GMT+01:00 Vishal Tiwari vishuals...@yahoo.co.in
[firebird-support] :
Hi All,
I have created the below cursor on Firbird DB (version 2.5). The update
statement in below cursor is not updating value. execute blockas
declare contractno CHAR(20);declare cur_list_of_contracts
cursor for (SelectCU.CONTRACTNO From CLASSIC_UPGRADE CU, CONTRACT C where
C.CONTRACTNO =CU.CONTRACTNO AND C.CONTRACTSTATUS = 'A' AND CU.INSERTDATE >
'09/01/2016'AND CU.INSERTDATE < '09/10/2016' AND (CU.status = 'authorized' or
CU.status= 'Authorized') AND C.CONVERT2YRDATE IS NULL ); beginopen
cur_list_of_contracts; while (ROW_COUNT > 0) do begin fetch
cur_list_of_contracts intocontractno; UPDATE CONTRACT C SET
CONVERT2YRDATE = (SELECTCU.INSERTDATE From CLASSIC_UPGRADE CU where
CU.CONTRACTNO = :contractno) where C.CONTRACTNO = :contractno; if
(ROW_COUNT = 0) then leave; suspend; end close cur_list_of_contracts;end;
The block is getting executed without any errors.
But, the output is not as expected. The records in the table are not getting
updated.
With Best Regards.
Vishal
#yiv4117988309 #yiv4117988309 -- #yiv4117988309ygrp-mkp {border:1px solid
#d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;}#yiv4117988309
#yiv4117988309ygrp-mkp hr {border:1px solid #d8d8d8;}#yiv4117988309
#yiv4117988309ygrp-mkp #yiv4117988309hd
{color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px
0;}#yiv4117988309 #yiv4117988309ygrp-mkp #yiv4117988309ads
{margin-bottom:10px;}#yiv4117988309 #yiv4117988309ygrp-mkp .yiv4117988309ad
{padding:0 0;}#yiv4117988309 #yiv4117988309ygrp-mkp .yiv4117988309ad p
{margin:0;}#yiv4117988309 #yiv4117988309ygrp-mkp .yiv4117988309ad a
{color:#ff;text-decoration:none;}#yiv4117988309 #yiv4117988309ygrp-sponsor
#yiv4117988309ygrp-lc {font-family:Arial;}#yiv4117988309
#yiv4117988309ygrp-sponsor #yiv4117988309ygrp-lc #yiv4117988309hd {margin:10px
0px;font-weight:700;font-size:78%;line-height:122%;}#yiv4117988309
#yiv4117988309ygrp-sponsor #yiv4117988309ygrp-lc .yiv4117988309ad
{margin-bottom:10px;padding:0 0;}#yiv4117988309 #yiv4117988309actions
{font-family:Verdana;font-size:11px;padding:10px 0;}#yiv4117988309
#yiv4117988309activity
{background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}#yiv4117988309
#yiv4117988309activity span {font-weight:700;}#yiv4117988309
#yiv4117988309activity span:first-child
{text-transform:uppercase;}#yiv4117988309 #yiv4117988309activity span a
{color:#5085b6;text-decoration:none;}#yiv4117988309 #yiv4117988309activity span
span {color:#ff7900;}#yiv4117988309 #yiv4117988309activity span
.yiv4117988309underline {text-decoration:underline;}#yiv4117988309
.yiv4117988309attach
{clear:both;display:table;font-family:Arial;font-size:12px;padding:10px
0;width:400px;}#yiv4117988309 .yiv4117988309attach div a
{text-decoration:none;}#yiv4117988309 .yiv4117988309attach img
{border:none;padding-right:5px;}#yiv4117988309 .yiv4117988309attach label
{display:block;margin-bottom:5px;}#yiv4117988309 .yiv4117988309attach label a
{text-decoration:none;}#yiv4117988309 blockquote {margin:0 0 0
4px;}#yiv4117988309 .yiv4117988309bold
{font-family:Arial;font-size:13px;font-weight:700;}#yiv4117988309
.yiv4117988309bold a {text-decoration:none;}#yiv4117988309 dd.yiv4117988309last
p a {font-family:Verdana;font-weight:700;}#yiv4117988309 dd.yi