f2s_esql_set_func_param

Applies to: Oracle, MS SQL, MySql/MariaDB, PostgreSQL Drivers

Syntax

f2s_esql_set_func_param {Parameter Number}  to {value} [using {variant}]

Parameter

Description

Parameter Number

The parameter number (from 1 to iNum)

value

The value of the SQL Parameter

variant

Optional variant type variable that will receive a statement interface

Description

This command is used to set the value a SQL Function Parameter.

The optional “using” syntax allows you to pass around the interface created by this command. The variable passed MUST be a variant. This allows for multiple statements to be active concurrently in some cases. If you use the “using” syntax, it must be used on all subsequent commands. Mixing the using syntax is not supported. So for instance, if you plan on having multiple statements active concurrently, all active statements must make use of the using syntax.

Example

SQL Server Code to create a simple function ‘dbo.AddTwoIntegers’ that adds two integers and returns the result
CREATE FUNCTION AddTwoIntegers(
    @intOne INT,
    @intTwo INT
)
RETURNS INT
AS
BEGIN
    RETURN   @intOne + @intTwo;
END;
-- To call the function
-- Select dbo.AddTwoIntegers(2, 2)
DataFlex code to call the ‘AddTwoIntegers’ SQL Function under the ‘.dbo’ schema
Integer iReturnVal
Integer iParmIntegerValue1
Integer iParmIntegerValue2
Move 1 to iParmIntegerValue1
Move 2 to iParmIntegerValue2

f2s_esql_set_func_name "dbo.AddTwoIntegers"
f2s_esql_prepare_stmt
f2s_esql_set_func_param 1 to iParmIntegerValue1
f2s_esql_set_func_param 2 to iParmIntegerValue2
f2s_esql_execute_func
f2s_esql_get_func_retval iReturnVal

Showln  (String(iReturnVal))

Related Commands

  • f2s_esql_set_func_name

  • f2s_esql_prepare_stmt

  • f2s_esql_set_func_name

  • f2s_esql_execute_func

  • f2s_esql_get_func_retval

Replaces: Command SQL_SET_FUNCTION_PARAMETER