Brien Pirkle wrote:

How can I execute a SQL Server stored proc from my Perl script? The Cheeta
book (DBD::ODBC Driver pg 296) suggests using the following ODBC escape
sequence:

{call procedure1_name}

Fine. But what's the rest of the syntax?


From BOL:
The ODBC CALL escape sequence for calling a procedure is:

{[?=]call procedure_name[([parameter][,[parameter]]...)]}

where procedure_name specifies the name of a procedure and parameter specifies a procedure parameter.

A procedure can have zero or more parameters. It can also return a value (as indicated by the optional parameter marker ?= at the start of the syntax). If a parameter is an input or an input/output parameter, it can be a literal or a parameter marker. If the parameter is an output parameter, it must be a parameter marker because the output is unknown. Parameter markers must be bound with SQLBindParameter before the procedure call statement is executed.

Input and input/output parameters can be omitted from procedure calls. If a procedure is called with parentheses but without any parameters, the driver instructs the data source to use the default value for the first parameter. For example:

{call procedure_name()}

If the procedure does not have any parameters, the procedure can fail. If a procedure is called without parentheses, the driver does not send any parameter values. For example:

{call procedure_name}

Literals can be specified for input and input/output parameters in procedure calls. For example, suppose the procedure InsertOrder has five input parameters. The following call to InsertOrder omits the first parameter, provides a literal for the second parameter, and uses a parameter marker for the third, fourth, and fifth parameters. (Parameters are numbered ordinally, beginning with a value of 1.)

{call InsertOrder(, 10, ?, ?, ?)}



Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to