AMT Help Files

Data to a Stored Procedure

Defining the Stored Procedure

The only way to transfer Data to a Stored Procedure is by the usage of input Parameters. These input Parameters can be declared in the Parameters section of the Stored Procedure in the AMT Developer Studio. E.g. for an insert into customers table:

 
The SQL code for the stored procedure for the insert can then be:

MS-SQL


 

 

Oracle


Unlike MS-SQL, Oracle does not support numeric columns with auto increment. The LIONRECNO column is therefore defined as Sequential and the increment has to be executed in the INSERT as shown above.

Before the Stored Procedure can be used it has to be checked in, generated and imported into the database by performing a Reorganize on the database.

 

 

Using the Stored Procedure in the Code

To add one record to the table in a Report, the LION code could then be:

begin_definitions
var
    ac : storedproc (add_stpcust)
end_definitions

routine main
begin_routine

    ac.parcustid  := 1000
    ac.parfirst   := 'klaas'
    ac.parlast    := 'Vaak'
    ac.parcountry := 'Nederland'
    ac.parcity    := 'Monnickendam'

    ac.execute ()
end_routine