IProcedure.UpdateProcedure

Syntax

UpdateProcedure([Options: Integer = 0]);

Parameters

Options. Reserved parameter.

Description

The UpdateProcedure method updates the structure of procedure on a database server according to structure of current procedure.

Comments

The method is analog of the AlterProcedure method. On executing the UpdateProcedure method, the structure of current procedure in repository is taken as the procedure structure to be updated.

Example

Executing the example requires that the repository contains a procedure with the Proc_1 identifier. Server contains a table with the Table_1 physical name.

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Proc: IProcedure;
Begin
    Mb := MetabaseClass.Active;
    MObj := Mb.ItemById("Proc_1").Edit;
    Proc := MObj As IProcedure;
    Proc.Text("ORCL") :=
        "As" + #13 + #10 +
        "Begin" + #13 + #10 +
        "For i In 1..10 Loop" + #13 + #10 +
        "insert into Table_1(field, field1) Values(i, i);" + #13 + #10 +
        "End Loop;" + #13 + #10 +
        "End;";
    Proc.Text("MSSQL") :=
        "As" + #13 + #10 +
        "Begin" + #13 + #10 +
        "Declare @i int" + #13 + #10 +
        "set @i = 0;" + #13 + #10 +
        "While (@i<10)" + #13 + #10 +
        "Begin" + #13 + #10 +
        "insert into Table_1(field, field1) Values(@i,@i);" + #13 + #10 +
        "set @i=@i+1;" + #13 + #10 +
        "End;" + #13 + #10 +
        "End;";
    Proc.UpdateProcedure;
    Proc.Refresh;
End Sub UserProc;

After executing the example, the text of procedure in a repository is changed, procedure text in a database is updated according to these changes. The procedure text is specified in the DBMS Oracle and MSSQL for the update.

See also:

IProcedure