SQL

Summary


Sql is used to launch a selection request.

Syntax

   For (dim_var_type_list)From type_base Sql sql_exp As  class  
   Next

Parameters

Element

Description

Restrictions

dim_var_type_list

List of Type and var_dim separated by the character ','.

None.

type

One of the keywords used for the declarations :
Label, Shortint, Date, Integer, Decimal, Char.
In the case of Char, the name of the variable is then followed by ().

This must be of the Adonix data type.

var_dim

Variable expressed in one of the following forms :
var_name or var_name '(' list_sep ')'

None.

var_nom

variable_name.

None.

list_sep

List of separators ','  ( the place normally taken by the dimension expression remains empty, only the number of dimensions declared is declared in this way).

No more than 3 separators because the number of dimensions is limited to 4.

type_base

alphanumeric character describing the database type.

 

sql_exp

Character string or character string grid containing the SQL request

 

Examples

# request that is used to select the maximum value of the ACCNUM_0 field in the GACCENTRYD table.
Local Char REQUEST(255)
REQUEST="select max(ACCNUM_0) From GACCENTRYD"
For (Integer NUM) From "3"
Sql REQUEST As [XXX]
  Infbox num$([F:XXX]NUM)
Next

# request that is used to select the ABREV_0 and MOT_0 fields from the AABREV table.
Local Char REQUEST(255)
REQUEST="select ABREV_0,MOT_0 From AABREV"
For (Char ABR(15),Char MOT(30)) From "3"
Sql REQUEST As [ABB]
  Infbox [F:ABB]ABR-[F:ABB]MOT
Next

# request with grid
Local Char REQUEST(255)(3)
REQUEST(0)="select *"
REQUEST(1)=" From BPARTNER"
REQUEST(2)=" Where BPCFLG=1"
# complete request
For From
Sql TAB 
# complete request without the clause where
For From
Sql TAB(0..1) 

Description and comments

Sql is used to launch a selection Sql request "Select From". It is not possible to launch a request for creation"Insert", for modification "update" or for deletion "delete".

The dim_var_type_list parameter represents the list of variable declarations in which the result of the selection will be inserted. 

The parameter type_base  is used to indicate the database type to be accessed :
- "o","O","3" to describe an Oracle database
- "s","S","5" to describe a SQL 7 database.

The sql_exp parameter is used to indicate the sql request. It is expressed by a character string or else a grid. When using a grid, the expression of the request is constructed by the plain concatenation is of the character strings.

The class is the abbreviation for which the declared variables will be described in the dim_var_type_list .

Associated errors

Error

Description

 

 

Associated keywords

Anasql - Execsql


SUMMARY


Copyright © Sage 1999 - 2007