Hello there, I am using cursors for the first time and I need help.
My stored procedure:
...
begin
declare Teste_Cursor dynamic scroll cursor for
select cod_customer from t_sic_books_proxy
where id = @NUM_ID
and cod_user not in ('DEFINIDO', 'PAGTOS')

open Teste_Cursor

while 1=1
begin
fetch next Teste_Cursor into @DIVIDA

select
case @DIVIDA
when '1539' then '<img src="http://www.gatosdocampodesantana.kit.net/realidade/0.jpg>'
when '1406' then '<img src="http://www.gatosdocampodesantana.kit.net/realidade/3.jpg>'
end

end


close Teste_Cursor
end

----------------------------------
ps - the variabel @DIVIDA is declared.

- This query returns 2 results and I need to make a select case and show a different image to each one.
ok, i run my procedure and it locks my user (in this case I am using DBA) as "CURSOR OPEN" and did not finish the steps.
Maybe I am declaring the cursor in a wrong way, but I tried a lot and it doesnt work out.


I hope you, that are more experienced could help me.
Thanks in advance,

venusgirrl