ANASQL

Summary


Anasql is used to launch a SQL request without recovery of data.

Syntax

   Anasql From type_base Sql sql_exp Using variable

 

Parameters

Element

Description

Restrictions

type_base

alphanumeric character describing the database type.

 

sql_exp

Character string or character string grid containing the SQL request

 

variable

numeric variable_name containing the number of the choice made in the box (that is to say the line number).

The variable must exist.

Examples

# analysis of the request used in the requestor.
Anasql From num$(BASE) Sql TEXTE(1..NBLIG) Using TYP

Wrseq "For ("
For I=1 To TYP(0)
  Wrseq "& ";
  If I>1 Wrseq ",";
  Else   Wrseq " ";
  Endif
  Case TYP(I)
    When 1,2 Wrseq "Shortint C"+num$(I);
    When 3 Wrseq "Date C"+num$(I);
    When 4 Wrseq "Integer C"+num$(I);
    When 7 Wrseq "Decimal C"+num$(I);
    When Default
    Wrseq "Char C"+num$(I)+"("+num$(TYP(I)-10)+")";
  Endcase
  Wrseq
Next I
Wrseq "& ) From '";num$(BASE);"' Sql TEXTE(1..";num$(NBLIG);") As [SQL0]"

 

Description and comments

Execsql is used to launch a SQL request without data recovery, unlike the instruction For...From...Sql that recovers the columns.     

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 variable is a dimensioned numeric variable. The Anasql  instruction returns the following information in this grid :
- in position 0 : the number of fields
- in position n : the type of the nth field (same value as that returned by function type)

Associated errors

Error

Description

 

 

Associated keywords

Execsql - For...From...sql


SUMMARY


Copyright © Sage 1999 - 2007