Informix Problems - Problem in executing stored procedures
Posted in 1996
Topics: Stored Procedures & SPL, Data Types & Schema Design
I have problems in executing two of my stored procedures on the informix =
database on my machine, whereas the same stored procedures work on some othe=
r =
informix database on another machine. My informix version is 7.12.UC1 and th=
e =
informix version on the other machine is 7.10.UC2.
1.
The first stored procedure, upon execution, gives an error "Resulting strin=
g =
length must be less than or equal to 255". I've got a char variable of lengt=
h =
3000 which I am returning from the SP.
Extract from the SP :-
CREATE PROCEDURE "sstm".g_wo_sm006a(
p_wo_no LIKE work_order.wo_no
)
RETURNING
VARCHAR(9,0),
VARCHAR(8,0),
VARCHAR(10,0),
.
.
.
VARCHAR(10,0),
CHAR(2),
VARCHAR(30,0),
CHAR(3000), -----> This is the return variable which causes the prob=
lem
CHAR(1);
DEFINE lvc_wo_no VARCHAR(9,0);
DEFINE lvc_ins_claim VARCHAR(8,0);
DEFINE lvc_notified_by VARCHAR(10,0);
.
.
.
DEFINE lvc_upd_user VARCHAR(10,0);
DEFINE lc_status_cd CHAR(2);
DEFINE lvc_status_desc VARCHAR(30,0);
DEFINE lc_prob_desc CHAR(3000);
-- The above is the definition of the return variable.
DEFINE lvc_prob_desc VARCHAR(255,0);
DEFINE li_seq_no INTEGER;
DEFINE lc_sr_min_maint_fl CHAR(1);
Following is the piece of code I use to populate the variable, before =
returning it from the SP. I populate it by concatenating fields from a table=
..
LET lc_prob_desc =3D "";
FOREACH
SELECT wd_prob_desc,wd_seq_no
INTO lvc_prob_desc,li_seq_no
FROM wo_prob_desc
WHERE wo_prob_desc.wd_no =3D p_wo_no
ORDER BY wd_seq_no DESC
LET lc_prob_desc =3D lvc_prob_desc || lc_prob_desc;
END FOREACH;
2.
The second stored procedure, upon execution, gives an error "Variable db_sr_no =
declared as serial type". In this stored procedure, I have declared a variab=
le =
as serial datatype which causes the problem. =
Extract from the SP:-
DEFINE li_serial_no LIKE disp_board_members.db_sr_no;
I've defined the field li_serial_no like disp_board_members.db_sr_no, which=
is =
of datatype serial. This causes a problem. This is because, according to =
manuals, Serial Type is not a legal procedure type. Use integer type to matc=
h =
SQL serial type. However the same SP gets executed without any errors on the=
=
other informix database. I wonder why? The problem gets solved if we change =
=
the above code to :-
DEFINE li_serial_no INT;
I am wondering whether both the above problems arre caused due to different=
=
informix versions or due to different setups. I would like to find out. Sinc=
e =
I've got a workaround for the second SP, but I would still be interested in=
=
finding out why the database is behaving in this manner.
Regards,
Ravi
ravi.hubbly@autozone.com