f2s_esql_set_proc_param¶
Applies to: Oracle, MS SQL, MySql/MariaDB, PostgreSQL Drivers
Syntax
f2s_esql_set_proc_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 Stored Procedure Parameter. With this command you can pass one or more parameters to predefined stored procedures. The f2s_esql_set_proc_param command enables you to add a parameter to a stored procedure which you are planning to call. You can pass multiple parameters by calling the command for each 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.
Examples
- SQL Server Code to create a simple Stored Procedure ‘dbo.TEST’ that takes a ‘DATETIME’ input and adds 40 days to the ‘OUTPUT’ parameter
CREATE PROCEDURE TEST @dDateIN DATETIME, @dDateOUT DATETIME OUTPUT AS SELECT @dDateOUT = DATEADD(dd,40,@dDateIN)
- DataFlex code to call the SQL Server ‘TEST’ Stored Procedure under the ‘.dbo’ schema
DateTime dtCurrentDateTime DateTime dtOutputDateTime Move (CurrentDateTime()) to dtCurrentDateTime f2s_esql_set_proc_name "dbo.TEST" f2s_esql_prepare_stmt f2s_esql_set_proc_param "@dDateIN" to dtCurrentDateTime f2s_esql_execute_proc f2s_esql_get_proc_param "@dDateOUT" to dtOutputDateTime Showln dtOutputDateTime
- Another Example of calling the SQL Server ‘sp_help’ Stored Procedure with the optional ‘using’ syntax with a variant variable
Variant vStat Variant[] vRow Boolean bWorked String sVal Integer i Integer iSize f2s_esql_set_proc_name "sp_help" using vStat f2s_esql_set_cursor_type f2s_olecursor_client using vStat f2s_esql_prepare_stmt using vStat f2s_esql_set_proc_param "@objname" to "fn_helpdatatypemap" using vStat f2s_esql_execute_proc using vStat f2s_esql_move_next bWorked using vStat If (bWorked) Begin f2s_esql_get_row vRow using vStat Move (SizeOfArray(vRow)) to iSize For i from 0 to (iSize-1) Showln "item #" i " = " vRow[i] Inkey sVal Loop End
Related Commands
Replaces: Command SQL_SET_PROCEDURE_PARAMETER