executing procedure in select ...
Posted in 1996
We are running Informix V 7.12 ( Sinix V 5.42 RM 400) On line
client application in Gupta 5.0.2
comm. via Informix Net V 5.0.1 WD1
Has anyone experience with executing procedures via select statement
select proc_name() from table_name
We wanted to do such sequence of sql commands:
1. to find a row with primary_key=new_value
2. if row does not exist insert new row with new_value of primary key
3. if row exist do nothing
returning value - number of rows from step 1.
i got simplified our procedure :
create procedure proc_name(new_value char(4)) returning smallint;define num_of_rows smallint;
select count(*) into num_of_rows from tab1
where column1=new_value;
IF num_of_rows=0 THEN
insert into tab1 (column1) values (new_value);
END IF
return num_of_rows;
end procedure;
We had no problems while using
execute procedure proc_name(..) returning ...But we can not use this from Gupta while we wanted to send
several entry parameters to procedure and getting return value .
Problems concerning executing procedures from Gupta were
discussed several month ago and conclusions and solutions
are known for us. We have decided to try this via select
select proc_name(new_value) from tabxy
( no relations between tab1 and tabxy)
and we got error message:
insert into tab1(column1)
values (new_value);exception : looking for handler
SQL error = -675 ISAM error = 0 error string = = ""exception : no appropriate handler
Description of the error is clear to us , but we didn't use
DML statements is these circumstances.
We also tested using temporary table (not in foreach ... end foreach)
- with the same results .
Our conclusion is that no insert,update,delete statements
( no problems with select )
are allowed while executing procedure as we did it .
we appreciate any opinions , experience.
P.S we do not want to invoke discussion how to do it in different
way .
Thanks
katarina
--
Katarina Hamzova Voice : +42 7 5384324
SWH s.r.o Bratislava
Slovakia
Internet : Katarina.Hamzova@swh.sk