user867621 user867621 - 4 months ago 45
SQL Question

Simple informix select stored procedure

I am trying to write a simple stored procedure that does a select statement but it keeps giving me a syntax error without any other help telling me what the error is

create procedure _this_is_it(this CHAR(3), that CHAR(4), other CHAR(3))
foreach select * from table
where column1 = this and
column2 = that and
column3 = other
end foreach
end procedure;


Any reason why I should get a syntax error?

aF. aF.
Answer

Remove the foreach and the _ as first letter, also add a ; at the end of the select.

create procedure this_is_it(this CHAR(3), that CHAR(4), other CHAR(3))

select * from table 
where column1 = this and
column2 = that and
column3 = other;

end procedure;
Comments