sybase - While loop goes on forever -
i wanted create while loop in sybase loops while there entry left in temporary table "nodesnothavingcriteria". procedure created below seems go on forever , think because while loop going on don dnt seem find reason it. can help? seems fine me , unable find reason of never ending loop.
create procedure createcriteria begin declare @uid varchar(10) while (select count(*) #nodesnothavingcriteria) > 0 set rowcount 1 select @uid = nodes #nodesnothavingcriteria -- pull 1 uid temp table set rowcount 0 delete #nodesnothavingcriteria nodes = @uid -- delete uid temp table -- uid have --insert backtestingcriteria (nodeid,hierarchyviewid,varcriteriaid,pnlcriteriaid) values -- (@uid,16008,16,3) --insert backtestingcriteria (nodeid,hierarchyviewid,varcriteriaid,pnlcriteriaid) values --(@uid,16008,16,4) end
i think while loop not check criteria ever again. select count once , check > 0 forever
maybe should try (pseudo code in js)
var count = select count(*) #nodesnothavingcriteria; while(count > 0) // count = select count(*) #nodesnothavingcriteria;
also don't know sybase #nodesnothavingcriteria update after delete it?
Comments
Post a Comment