Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Calling stored function

152 views
Skip to first unread message

agad

unread,
Jul 28, 2009, 7:31:01 AM7/28/09
to
Hello,
I have following function in my Informix database:
CREATE PROCEDURE climbertops(c varchar(128))
RETURNING row

DEFINE result row(mountain varchar(128),climber varchar(128),year
int);

FOREACH
SELECT *
INTO result
FROM ontop
WHERE climber=c
RETURN result
WITH RESUME;
END FOREACH;

END PROCEDURE;

But when trying too execute this (execute procedure climbertops('Josef
Rakoncaj');) I get the message:
9628: Type () not found.
I've tried to declare host variable to execute function into this
variable:
EXEC SQL BEGIN DECLARE SECTION;
row(varchar(128), varchar(128), int) climber;
EXEC SQL END DECLARE SECTION;
execute function climbertops('Josef Rakoncaj') into :climber;
but I always get " 201: A syntax error has occurred." error.
Even simple copy and paste from Informix tutorial (
EXEC SQL BEGIN DECLARE SECTION;
int p_int;
EXEC SQL END DECLARE SECTION;
) causes the same error.

Can anybody help me with this (for sure) easy problem?

Agata

Prasad

unread,
Jul 28, 2009, 5:47:16 PM7/28/09
to

Informix deoe not support a generic row type as return type of a
stored procedure. You need to specify the explicit row type
definition. For example,
CREATE PROCEDURE climbertops(c varchar(128))
RETURNING row(mountain varchar(128) , climber varchar(128) , year
int );

thanx
Prasad

agad

unread,
Jul 29, 2009, 4:55:46 AM7/29/09
to
Hello, thank you for the answer. It works, when I add variable
initialization:
LET result = ROW(NULL::VARCHAR(128), NULL::VARCHAR(128),
NULL::INTEGER);
Without it I get an error:
696: Variable (result) has undefined value.

Another solution I got, was to declare new row type:
CREATE ROW TYPE result_rt (mountain varchar(128),climber varchar
(128),year int);

0 new messages