Name

exec_score — Compiles a SQL statement and returns the estimate time cost

Synopsis

exec_score ( in str varchar ,
  out state varchar ,
  out message varchar );
 

Description

This function provides dynamic SQL capabilities in Virtuoso PL. The first argument is an arbitrary SQL statement, which may contain parameter placeholders. The function returns as output parameters a SQL state, error message and returns the estimate time cost in milliseconds.

Parameters

str

A varchar containing arbitrary SQL using ?'s for parameter markers.

state

An output parameter of type varchar set to the 5 character SQL state if the exec resulted an error. Not set if an error is not present.

message

An output parameter of type varchar set to SQL error message associated with the error. Not set if an error is not present.

Return Types

The function returns a float number which is the calculated estimate time cost for the query execution.

Errors

The function will generate a SQL 22023 error value if a supplied parameter is not of the type expected.

Examples

Example 24.106. Simple Use

SQL> select exec_score ('select * from T1');