1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
project.
Copyright (C) 1998-2018 OpenLink Software
This project is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; only version 2 of the License, dated June 1991
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-->
<refentry id="fn_exec_score">
<refmeta>
<refentrytitle>exec_score</refentrytitle>
<refmiscinfo>sql</refmiscinfo>
</refmeta>
<refnamediv>
<refname>exec_score</refname>
<refpurpose>Compiles a SQL statement and returns the estimate time cost</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis id="fsyn_exec_score">
<funcprototype id="fproto_exec_score">
<funcdef><function>exec_score</function></funcdef>
<paramdef>in <parameter>str</parameter> varchar</paramdef>
<paramdef>out <parameter>state</parameter> varchar</paramdef>
<paramdef>out <parameter>message</parameter> varchar</paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1 id="desc_exec_score">
<title>Description</title>
<para>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.</para>
</refsect1>
<refsect1 id="params_exec_score">
<title>Parameters</title>
<refsect2><title><parameter>str</parameter></title>
<para>A <type>varchar</type> containing arbitrary SQL using ?'s for parameter markers.</para>
</refsect2>
<refsect2><title>state</title>
<para>An output parameter of type <type>varchar</type> set to the 5 character SQL state if the exec resulted an error. Not set if an error is not present.</para>
</refsect2>
<refsect2><title>message</title>
<para>An output parameter of type <type>varchar</type> set to SQL error message associated with the error. Not set if an error is not present.</para>
</refsect2>
</refsect1>
<refsect1 id="ret_exec_score"><title>Return Types</title>
<para>The function returns a float number which is the calculated estimate time cost for the query execution.</para>
</refsect1>
<refsect1 id="errors_exec_score">
<title>Errors</title>
<para>
The function will generate a SQL 22023 error value if a supplied parameter is not of the type expected.
</para>
<tip>
<title>See Also:</title>
<para>
<link linkend="errors">List of SQL 22023 errors.</link>
</para>
</tip>
<!-- In case of non-function-specific errors, i.e. only common
parameter errors are signalled, comment out the table below
otherwise add the unique error values as individual errorcodes -->
</refsect1>
<refsect1 id="examples_exec_score">
<title>Examples</title>
<example id="ex_exec_score"><title>Simple Use</title>
<screen><![CDATA[
SQL> select exec_score ('select * from T1');
]]>
</screen>
</example>
</refsect1>
<refsect1 id="seealso_exec_score">
<title>See Also</title>
<para><link linkend="fn_exec"><function>exec()</function></link></para>
<para><link linkend="fn_exec_metadata"><function>exec_metadata()</function></link></para>
<para><link linkend="fn_exec_next"><function>exec_next()</function></link></para>
<para><link linkend="fn_exec_close"><function>exec_close()</function></link></para>
</refsect1>
</refentry>
|