patriceguic
Programmer
Hello,
I don't know how fetch a cursor whose request is contained in a variable. The following code is ok in a 4GL but not in a stored procedure. I use version 9.40 of informix.
Thank you for your help
I don't know how fetch a cursor whose request is contained in a variable. The following code is ok in a 4GL but not in a stored procedure. I use version 9.40 of informix.
Thank you for your help
Code:
CREATE PROCEDURE sp_get_nom_calc_sect(pi_instance VARCHAR(100))
RETURNING CHAR(2);
DEFINE ls_sql char(100);
DEFINE po_cd_act_sect char(2);
let ls_sql = "SELECT cd_sect_act from " || pi_instance;
prepare statement2 FROM ls_sql
declare cur_calc_sect cursor FOR statement2
FOREACH cur_util INTO po_cd_act_sect
RETURN po_cd_act_sect WITH RESUME;
END FOREACH
END PROCEDURE;