MULTEXT - Document MQL2. SgmlQL reference/Operators.

Variable declaration

Global declaration

Global variables are defined by means of the global statement. The variable is defined for all subsequent queries.

Syntax

global variable_name = query [ , variable_name = query]*

Examples

global $n = 3;
global $t = ($n == 3);
global $firstname = "John";
global $myfile = "myfile-ces.sgml";
global $d = DIV;
global $i = 1, $j = 2, $k = 3;


Local declaration

Variables can be defined locally with a local let statement:

Syntax

let variable_name = query [ , variable_name = query]*
in query

Examples

  • let $i = 3, $j = 6
    in (every P within file $myfile) [$i:$j]
  • <P>
    Can detailed results be forwarded to
    Parliament? ...
    
    

    Local variables may also be introduced when using certain operators; such variables are valid only for the environment of that operator (i.e. during the evaluation of its arguments and final result).

    Example (the $p variable is valid inside the select/from/where operator)

  • select $p
    from $p in (every P within file $myfile)
    where text($p) match "law"
  • <P>
    Under German income tax law, the
    wages tax annual ...
    



    | Top | Next | SgmlQL reference | LPL/CNRS | MULTEXT

    Copyright © Centre National de la Recherche Scientifique, 1997.