on ‎2020 Jun 12 7:41 AM
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
Request clarification before answering.
Hello Abou,
it could be related to this line
"select Trigramme into v_trigramme from TABLE_TRIGRAMME;"
If TABLE_TRIGRAMME contains more than one row the statement will fail. Please check this.
Best regards, Kai
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 9 | |
| 6 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.