AMT Help Files

Stored Procedure Functions

In order to use a stored procedure through the code, a handler needs to be defined first. This is done with the following syntax:

<Stored procedure handler> : Storedproc (<Stored procedure>)

 Hander items Description

<Stored procedure handler>

The name of the handler.

Storedproc

Declaration that indicates that a stored procedure handler is concerned.

<Object>

Name of the stored procedure to be used through the handler. This stored procedure needs to be created in the same AMT application.

 
The following functions and properties can be used for stored procedures.

 Function/Property Description

ASINTEGER

Copies the requested value into the specified integer field. If the value that is returned through the stored procedure does not contain an integer value, the duplicated value will be converted to an integer automatically.

Use:

to place (for instance) the returned value in the specified variable:

<Variable> := <Stored procedure handler>.ASINTEGER ('<fieldname>')

ASNUMERIC

Copies the requested value into the specified numeric field. If the value that is returned through the stored procedure does not contain a numeric value, the duplicated value will be converted to an numeric automatically.

Use:

<Variable> := <Stored procedure handler>.ASNUMERIC ('<fieldname>')

ASSTRING

Copies the requested value into the specified string field. If the value that is returned through the stored procedure does not contain a string value, the duplicated value will be converted to an string automatically.

Use:

to place (for instance) the returned ACCESSEDDATE value in the specified variable:

<Variable> := <Stored procedure handler>.ASSTRING ('<fieldname>')

DATABASE

When the stored procedure is in a remote database, this property should be set to the alias of the remote database.

Use:

<Stored procedure handler>.DATABASE := '<RemoteDatabaseAlias>'

EXECUTE

Runs the stored procedure.

Use:

<Stored procedure handler>.EXECUTE

<Fieldname>

* only for MSSQL and DB2 databases

Points to the concerned field in the stored procedure.

Use: 

<Variable> := <Stored procedure handler>.<Fieldname>

PREFIX

Sets a prefix for a stored procedure, f.i for Oracle packages.

Use:

sp1 : storedprocedure(procedure1)
sp1.prefix := ‘PACKAGE1.’ // Package name for Oracle
sp1.execute()

<Parametername>

Points to the concerned parameter in the stored procedure.

Syntax 1 below is used to fill the specified variable with the value that is found under the specified parametername.

Syntax 2 below is used to write a specific value into the field that is found in the stored procedure under the specified parametername. This is only possible if the concerned stored procedure parameter is either defined for Input or for Input/output.

Use:

(1)
<Variable> := <Stored procedure handler>.<Parametername>

(2)
<Stored procedure handler>.<Parametername> := <Expression>

 
The way stored procedures can be used in the code varies with the way data is transferred from and to the Stored Procedure. In the following subpages explanation and examples of the different transfer procedure.