» Documentation » SQL Reference

Execute

Executes one of the following modules: a stored procedure, an extended UDI procedure, DQL statement, or Free-Text query:

Syntax

[ { EXEC  | EXECUTE  | EXECUTE UDI   } ]
    {
        { [database_name.] procedure_name | module_name@procedure_name }   [  [ @param = ]  value ]  [ ,...n ]
    }
[;] 

Arguments

Parameter

Description

database_name

Is database to which procedure belongs.

procedure_name

Procedure name to execute. There can be a stored procedure or an extended procedure exported from module_name.

module_name

Is a reference name of the module DLL where are the implementation of exported extended procedure(s). The extended procedure module can be added with a ADD MODULE command.

value

Is the value of the parameter to pass to the procedure. If parameter names are not specified, parameter values must be supplied in the order defined in the procedure.

@param

Is procedure's named parameter. The names of parameters must be preceded by the @ symbol. If the @param=value form is used for any parameter, it must be used for all other parameters as well. The named parameters do not have to be supplied in the order in which they are defined in the procedure.

If a default value of the parameter is defined, a user can execute the procedure without specifying a parameter.

Execute a DQL statement

Syntax

EXECUTE DQL BEGIN dql_statement END 

Arguments

Parameter

Description

dql_statement

Set of DQL commands to execute. This is a low-level DB commands that describe the execution plan. Generally, the database query language is SQL. Query optimizer will convert SQL to DQL and pass to execute. If, the optimization is not sufficient or needs to be altered, a user can always choose to execute DQL directly.

Executing Free-Text query

Syntax

EXECUTE FREETEXT
 (
SELECT {[column][,¦] | *}
FROM [database_name.]freetext_index
[WHERE  search_expression ]
[RESTRICT Start, NumberOfRows]
[ORDER BY {column [ASC | DESC] [, ...]}]
) 

search_expression syntax :

expression {= | > | < | >= | <= | != | <>} {value|@param} 

expression BETWEEN {lower_value|@param } AND {upper_value|@param } 

search_expression {AND | OR} search_expression 

Arguments

Parameter

Description

column

The column name of the free-text index. If the column has not been set to store the indexed data, the output will be NULL. Read more about free-text index<¦.>. Additionally you can use [score] column that provides the number of the matched document. And greater the number is, the better is the match.

freetext_index

Is the name of free-text index that was created with Create full-text index command.

value @param

Value or parameter name used to match document(s). It can be number, real, datetime or string data types.

Note: Use the same data type as indexed columns. If indexed column data type does not match value data type, the value will be converted to desired data type. For example, integer (1) will be represented as string (¦00001), and if indexed column was string type, the documents will not match.

restrict to start, count

Return top rows, where start position of rows in matched documents (starting with 0), count number of rows to return.

order by

Order by column, that are declared as KEYWORD, i.e. the text is not tokenized and stored as is.