Send feedback on this topic.
ExecuteCreateProcedure Method

Teradata.Client.Provider Namespace > TdCommand Class : ExecuteCreateProcedure Method
Specifies whether or not Stored Procedure source text is saved after compilation. true save, false not saved.
ExecuteCreateProcedure executes an internal form of the CREATE PROCEDURE statement.
Public Function ExecuteCreateProcedure( _
   ByVal saveSourceText As Boolean _
) As Integer
Dim instance As TdCommand
Dim saveSourceText As Boolean
Dim value As Integer
value = instance.ExecuteCreateProcedure(saveSourceText)
public int ExecuteCreateProcedure( 
   bool saveSourceText
int ExecuteCreateProcedure( 
   bool saveSourceText


Specifies whether or not Stored Procedure source text is saved after compilation. true save, false not saved.

Return Value

Returns the number of compilation messages that are warnings.
Thrown when compilation error messages are generated by Teradata. Contains the collection of error messages generated during the compilation of the store procedure.
Thrown when an operation is performed on a disposed object
Can be thrown because of one of the following errors: 1) TdConnection is not in Open state or is null or 2) The local transaction associated with the TdCommand is not the same local transaction associated with the TdConnection. Assign the local transaction to Transaction property. 3) TdCommand.CommandText is null or empty.

ExecuteCreateProcedure must be called when executing a CREATE PROCEDURE statement.

Error or warning messages can be generated by the Teradata Database when compiling a stored procedure. If any error messages are returned by the Teradata Database, ExecuteCreateProcedure will throw an exception. However, if the compilation only produced warning messages, an InfoMessage event will be fired.

Error messages generated during the compilation of a stored procedure are put into an error collection, and a TdException is thrown. All the error messages can be iterated through by accessing the TdException.Errors property.

Warning messages are put into a warning collection. These messages are made available through the TdConnection.InfoMessage event.

The following example creates a stored procedure. If there were any compilation error messages, the example routine iterates through the messages and prints information about the error to the console.
public void CreateProcedureExample(TdConnection conn)
  cmd = new TdCommand("replace procedure sptest1 (in p1 int) begin declare d1 int; set d1 = p1 + 10; end;", conn);
      Int32 xx = cmd.ExecuteCreateProcedure(true);
  catch (TdException tdException)
      for (int i = 0; i < tdException.Errors.Count; i++)
          Console.WriteLine("Message = {0}, StatementNumber = {1}, Source = {2}", 

Target Platforms: Windows 7, Windows 8, Windows 8.1, Windows 10, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2

See Also


TdCommand Class
TdCommand Members