TurboSQL Guide

CREATE PROCEDURE Statement

Previous  Top  Next

Syntax

CREATE PROCEDURE function_name([:parameter_name data_type]...) AS statement

CREATE PROCEDURE function_name([:parameter_name data_type]...) AS BEGIN statement [statement]... END

CREATE PROCEDURE function_name([:parameter_name data_type]...) AS EXTERNAL NAME [namespace_name.class_name].method_name,assembly_name

Description

namespace_name.class_name refers to a public class in the assembly.

method_name refers to the name of a static public function in the assembly. The function must not be overloaded and the parameters must fit the parameters of the TurboSQL function (see "Exchanging Parameters with .NET  Assemblies").

Samples

CREATE PROCEDURE Insert(:LastName WCHAR(40), :Salary INTEGER, :Department WCHAR(40) AS BEGIN
       INSERT INTO Departments ([Name]) VALUES(:Department)
       INSERT INTO Employees (LastName, Salary, Department) VALUES(:LastName, :Salary, :Department)
END

The following example requires a static public method Send of a public class SmtpClient in the namespace Email in an assembly called Email.dll. The assembly must be located in the same directory as is the database (tdbd) file.

CREATE PROCEDURE SendEmail(:Address WCHAR(100), :Subject WCHAR(100), :Content WCHAR(100)) AS
EXTERNAL NAME [Email.SmtpClient].Send,Email

Compatibility Information

This statement is only available in TurboDB Managed.