Skip to Content
0
Jun 12, 2020 at 06:41 AM

fetch on cursor

39 Views

Hi,

I'm writing a cursor for retrieve a name from a table.

And take this name to do logic work.

My code is :

DECLARE v_nomtable VARCHAR(70);

DECLARE v_trigramme CHAR(3);

DECLARE v_expresst1 varchar(200);

DECLARE v_expresst2 varchar(200);

DECLARE CURSOR cursor_reset_repli FOR

select NomTable from TABLE_REPLICATE;

select Trigramme into v_trigramme from TABLE_TRIGRAMME;

OPEN cursor_reset_repli;

FETCH cursor_reset_repli into v_nomtable;

WHILE NOT cursor_reset_repli::NOTFOUND

DO

v_expresst1 = CONCAT ('VT_',:v_trigramme) || CONCAT ('_', :v_nomtable);

v_expresst2 = CONCAT ('TG_',:v_trigramme) || CONCAT ('_', :v_nomtable);

... some exec

FETCH cursor_reset_repli into v_nomtable;

END WHILE;

CLOSE cursor_reset_repli;

END

---

When I've exec the cursor, I've got this error:

Error: (dberror) [1300]: fetch returns more than requested number of rows:

I can't understand why my cursor doesn't.

Can you help me?

Really thanks