StoreSQL

Mon 01 January 2018

Syntax

StoreSQL(sqlstring, [SQL.]sqlname[, dbtype[, effdt [, ownerid [, description]]]])

Description

Use the StoreSQL function to write the given sqlstring value to a SQL definition, storing it under the name sqlname , with the database type dbtype and the effective date effdt . If sqlname is a literal name, it must be in the form SQL . sqlname or in quotes (" sqlname ").

To specify a generic statement, that is, one that is overridden by any other matching statement, specify dbtype as Default and effdt as the null date (or Date(19000101).

You must commit all database changes prior to using this function. This is to avoid locking critical Tools tables and hence freezing all other users. You receive a runtime error message if you try to use this function when there are pending database updates, and your PeopleCode program terminates. You need to commit any database updates prior to using this function. The CommitWork PeopleCode function has been enhanced to allow this.

Parameters

Field or Control

Definition

sqlstring

Specify the SQL string to be saved as the SQL definition. This parameter takes a string value.

sqlname

Specify the name of the SQL definition to be created. This is either in the form SQL . sqlname or a string value giving the sqlname.

dbtype

Specify the database type to be associated with the SQL definition. This parameter takes a string value. If dbtype isn’t specified or is null (""), it is set by default to the current database type (the value returned from the %DbName system variable.)

Values for dbtype are as follows. These values are not case-sensitive:

  • APPSERVER

  • DB2

  • DB2UNIX

  • MICROSOFT

  • ORACLE

Note: Database platforms are subject to change.

effdt

Specify the effective date to be associated with the SQL definition. If effdt isn’t specified, it is set by default to the current as of date, that is, the value returned from the %AsOfDate system variable.

ownerid

Specify the four character ownerId associated with this SQL statement. If not specified, no ownerId is associated.

description

Specify the description text associated with this SQL statement.

Returns

None.