Informix-ESQL/C Programmer's Manual
Chapter 17: Using an sqlda Structure
Home
Contents
Index
Master Index
New Book
Handling a Parameterized User-Defined Routine
For an introduction on how to determine input parameters, see
page 15-26
. This section describes how to handle a parameterized user-defined routine with an
sqlda
structure. The following statements execute user-defined routines:
The
EXECUTE FUNCTION
statement executes a user-defined function (external and SPL).
The
EXECUTE PROCEDURE
statement executes a user-defined procedure (external and SPL).
If a prepared
EXECUTE PROCEDURE
or
EXECUTE FUNCTION
statement has arguments specified as input parameters of unknown number and data type, your ESQL/C program can use an
sqlda
structure to define the input parameters.
Executing a Parameterized Function
You handle the input parameters of a user-defined function in the same way that you handle input parameters in the
WHERE
clause of a
SELECT
statement, as follows:
Execute a
noncursor
function in the same way as a singleton
SELECT
statement.
If you know at the time that you write the program that the dynamic user-defined function
always
returns just one row, you can use the
EXECUTE...USING DESCRIPTOR...INTO
statement to provide the argument values from an
sqlda
structure and to execute the function. For more information, see
"Executing a Parameterized Singleton SELECT"
.
Execute a
cursor
function in the same way as a
SELECT
statement that returns one or more rows.
If you are not sure at the time that you write the program that the dynamic user-defined function
always
returns just one row, define a function cursor and use the
OPEN...USING DESCRIPTOR
statement to provide the argument values from an
sqlda
structure. For more information, see
"Executing a Parameterized SELECT That Returns Multiple Rows"
.
The only difference between the execution of these
EXECUTE FUNCTION
and
SELECT
statements is that you prepare the
EXECUTE FUNCTION
statement for the noncursor function, instead of the
SELECT
statement.
Executing a Parameterized Procedure
To execute a parameterized user-defined procedure, you can use the
EXECUTE...USING DESCRIPTOR
statement to provide the argument values from an
sqlda
structure and to execute the procedure. You handle the input parameters of a user-defined procedure in the same way that you handle input parameters in a noncursor function. The only difference between the execution of the
EXECUTE PROCEDURE
statement and the
EXECUTE FUNCTION
statement (for a noncursor function) is that you do not need to specify the
INTO
clause of the
EXECUTE...USING DESCRIPTOR
statement for the user-defined procedure. For more information, see
"Executing a Parameterized Function"
.
Informix-ESQL/C Programmer's Manual
, version 9.1
Copyright © 1998, Informix Software, Inc. All rights reserved.