Hello there, I am using cursors for the first time and I need help.
My stored procedure:
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
fetch next Teste_Cursor into @DIVIDA

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>'


close Teste_Cursor

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,