<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>OpenText Analytics Database 26.2.x – CREATE FUNCTION statements</title>
    <link>/en/sql-reference/statements/create-statements/create-function-statements/</link>
    <description>Recent content in CREATE FUNCTION statements on OpenText Analytics Database 26.2.x</description>
    <generator>Hugo -- gohugo.io</generator>
    
	  <atom:link href="/en/sql-reference/statements/create-statements/create-function-statements/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Sql-Reference: CREATE AGGREGATE FUNCTION</title>
      <link>/en/sql-reference/statements/create-statements/create-function-statements/create-aggregate-function/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/statements/create-statements/create-function-statements/create-aggregate-function/</guid>
      <description>
        
        
        &lt;p&gt;Adds a &lt;a href=&#34;../../../../../en/extending/developing-udxs/aggregate-functions-udafs/&#34;&gt;user-defined aggregate function&lt;/a&gt; (UDAF) to the catalog. The library containing the function must have been previously added using &lt;a href=&#34;../../../../../en/sql-reference/statements/create-statements/create-library/#&#34;&gt;CREATE LIBRARY&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;CREATE AGGREGATE FUNCTION automatically determines the function parameters and return value from data supplied by the factory class. OpenText™ Analytics Database supports overloading aggregate functions. When you call the SQL function, the database passes the input table to the function to process.&lt;/p&gt;
&lt;p&gt;User-defined aggregate functions run in &lt;a href=&#34;../../../../../en/extending/udxs/fenced-and-unfenced-modes/&#34;&gt;unfenced mode&lt;/a&gt; only.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;CREATE [ OR REPLACE ] AGGREGATE FUNCTION [ IF NOT EXISTS ]
  [[&lt;span class=&#34;code-variable&#34;&gt;database&lt;/span&gt;.]&lt;span class=&#34;code-variable&#34;&gt;schema&lt;/span&gt;.]&lt;span class=&#34;code-variable&#34;&gt;function&lt;/span&gt; AS
  [ LANGUAGE &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;language&lt;/span&gt;&amp;#39; ]
  NAME &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;factory&lt;/span&gt;&amp;#39;
  LIBRARY &lt;span class=&#34;code-variable&#34;&gt;library&lt;/span&gt;
  [ NOT FENCED ];
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;OR REPLACE&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;If a function with the same name and arguments exists, replace it. You can use this to change between fenced and unfenced modes, for example. If you do not use this directive and the function already exists, the CREATE statement returns with a rollback error.&lt;/p&gt;
&lt;p&gt;OR REPLACE and IF NOT EXISTS are mutually exclusive.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;IF NOT EXISTS&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;If a function with the same name and arguments exists, return without creating the function.&lt;/p&gt;
&lt;p&gt;OR REPLACE and IF NOT EXISTS are mutually exclusive.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;[&lt;/code&gt;&lt;em&gt;&lt;code&gt;database&lt;/code&gt;&lt;/em&gt;&lt;code&gt;.]&lt;/code&gt;&lt;em&gt;&lt;code&gt;schema&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Database and &lt;a href=&#34;../../../../../en/admin/configuring-db/designing-logical-schema/using-multiple-schemas/setting-search-paths/&#34;&gt;schema&lt;/a&gt;. The default schema is &lt;code&gt;public&lt;/code&gt;. If you specify a database, it must be the current database.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;function&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the function to create. This is the name used in SQL invocations of the function. It does not need to match the name of the factory, but it is less confusing if they are the same or similar.&lt;/p&gt;
&lt;p&gt;The function name must conform to the restrictions on &lt;a href=&#34;../../../../../en/sql-reference/language-elements/identifiers/#&#34;&gt;Identifiers&lt;/a&gt;.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;LANGUAGE &#39;&lt;/code&gt;&lt;em&gt;&lt;code&gt;language&lt;/code&gt;&lt;/em&gt;&lt;code&gt;&#39;&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;The language used to develop this function, currently &lt;code&gt;C++&lt;/code&gt; only (the default).&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;NAME &#39;&lt;/code&gt;&lt;em&gt;&lt;code&gt;factory&lt;/code&gt;&lt;/em&gt;&lt;code&gt;&#39;&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Name of the factory class that generates the function instance.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;LIBRARY &lt;/code&gt;&lt;em&gt;&lt;code&gt;library&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Name of the shared library that contains the function. This library must have already been loaded by &lt;a href=&#34;../../../../../en/sql-reference/statements/create-statements/create-library/#&#34;&gt;CREATE LIBRARY&lt;/a&gt;.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;NOT FENCED&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Indicates that the function runs in unfenced mode. Aggregate functions cannot be run in fenced mode.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;privileges&#34;&gt;Privileges&lt;/h2&gt;
&lt;p&gt;Non-superuser:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;CREATE privilege on the function&#39;s schema&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;USAGE privilege on the function&#39;s library&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;The following example demonstrates loading a library named &lt;code&gt;AggregateFunctions&lt;/code&gt; and then defining functions named &lt;code&gt;ag_avg&lt;/code&gt; and &lt;code&gt;ag_cat&lt;/code&gt;. The functions are mapped to the &lt;code&gt;AverageFactory&lt;/code&gt; and &lt;code&gt;ConcatenateFactory&lt;/code&gt; classes in the library:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE LIBRARY AggregateFunctions AS &amp;#39;/opt/vertica/sdk/examples/build/AggregateFunctions.so&amp;#39;;
CREATE LIBRARY
=&amp;gt; CREATE AGGREGATE FUNCTION ag_avg AS LANGUAGE &amp;#39;C++&amp;#39; NAME &amp;#39;AverageFactory&amp;#39;
   library AggregateFunctions;
CREATE AGGREGATE FUNCTION
=&amp;gt; CREATE AGGREGATE FUNCTION ag_cat AS LANGUAGE &amp;#39;C++&amp;#39; NAME &amp;#39;ConcatenateFactory&amp;#39;
   library AggregateFunctions;
CREATE AGGREGATE FUNCTION
=&amp;gt; \x
Expanded display is on.
select * from user_functions;
-[ RECORD 1 ]----------+------------------------------------------------------------------
schema_name            | public
function_name          | ag_avg
procedure_type         | User Defined Aggregate
function_return_type   | Numeric
function_argument_type | Numeric
function_definition    | Class &amp;#39;AverageFactory&amp;#39; in Library &amp;#39;public.AggregateFunctions&amp;#39;
volatility             |
is_strict              | f
is_fenced              | f
comment                |
-[ RECORD 2 ]----------+------------------------------------------------------------------
schema_name            | public
function_name          | ag_cat
procedure_type         | User Defined Aggregate
function_return_type   | Varchar
function_argument_type | Varchar
function_definition    | Class &amp;#39;ConcatenateFactory&amp;#39; in Library &amp;#39;public.AggregateFunctions&amp;#39;
volatility             |
is_strict              | f
is_fenced              | f
comment                |
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/statements/drop-statements/drop-aggregate-function/#&#34;&gt;DROP AGGREGATE FUNCTION&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/system-tables/v-catalog-schema/user-functions/#&#34;&gt;USER_FUNCTIONS&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/extending/developing-udxs/#&#34;&gt;Developing user-defined extensions (UDxs)&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/extending/developing-udxs/aggregate-functions-udafs/#&#34;&gt;Aggregate functions (UDAFs)&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: CREATE ANALYTIC FUNCTION</title>
      <link>/en/sql-reference/statements/create-statements/create-function-statements/create-analytic-function/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/statements/create-statements/create-function-statements/create-analytic-function/</guid>
      <description>
        
        
        &lt;p&gt;Adds a &lt;a href=&#34;../../../../../en/extending/developing-udxs/analytic-functions-udanfs/&#34;&gt;user-defined analytic function &lt;/a&gt; (UDAnF) to the catalog. The library containing the function must have been previously added using &lt;a href=&#34;../../../../../en/sql-reference/statements/create-statements/create-library/#&#34;&gt;CREATE LIBRARY&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;CREATE ANALYTIC FUNCTION automatically determines the function parameters and return value from data supplied by the factory class. OpenText™ Analytics Database supports overloading analytic functions. When you call the SQL function, the database passes the input table to the function in the library to process.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;CREATE [ OR REPLACE ] ANALYTIC FUNCTION [ IF NOT EXISTS ]
    [[&lt;span class=&#34;code-variable&#34;&gt;database&lt;/span&gt;.]&lt;span class=&#34;code-variable&#34;&gt;schema&lt;/span&gt;.]&lt;span class=&#34;code-variable&#34;&gt;function&lt;/span&gt; AS
    [ LANGUAGE &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;language&lt;/span&gt;&amp;#39; ]
    NAME &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;factory&lt;/span&gt;&amp;#39;
    LIBRARY &lt;span class=&#34;code-variable&#34;&gt;library&lt;/span&gt;
    [ FENCED | NOT FENCED ]
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;OR REPLACE&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;If a function with the same name and arguments exists, replace it. You can use this to change between fenced and unfenced modes, for example. If you do not use this directive and the function already exists, the CREATE statement returns with a rollback error.&lt;/p&gt;
&lt;p&gt;OR REPLACE and IF NOT EXISTS are mutually exclusive.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;IF NOT EXISTS&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;If a function with the same name and arguments exists, return without creating the function.&lt;/p&gt;
&lt;p&gt;OR REPLACE and IF NOT EXISTS are mutually exclusive.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;[&lt;/code&gt;&lt;em&gt;&lt;code&gt;database&lt;/code&gt;&lt;/em&gt;&lt;code&gt;.]&lt;/code&gt;&lt;em&gt;&lt;code&gt;schema&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Database and &lt;a href=&#34;../../../../../en/admin/configuring-db/designing-logical-schema/using-multiple-schemas/setting-search-paths/&#34;&gt;schema&lt;/a&gt;. The default schema is &lt;code&gt;public&lt;/code&gt;. If you specify a database, it must be the current database.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;function&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the function to create. This is the name used in SQL invocations of the function. It does not need to match the name of the factory, but it is less confusing if they are the same or similar.&lt;/p&gt;
&lt;p&gt;The function name must conform to the restrictions on &lt;a href=&#34;../../../../../en/sql-reference/language-elements/identifiers/#&#34;&gt;Identifiers&lt;/a&gt;.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;LANGUAGE &#39;&lt;/code&gt;&lt;em&gt;&lt;code&gt;language&lt;/code&gt;&lt;/em&gt;&lt;code&gt;&#39;&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Language used to develop this function, one of the following:
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;C++&lt;/code&gt; (default)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Java&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;NAME &#39;&lt;/code&gt;&lt;em&gt;&lt;code&gt;factory&lt;/code&gt;&lt;/em&gt;&lt;code&gt;&#39;&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Name of the factory class that generates the function instance.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;LIBRARY &lt;/code&gt;&lt;em&gt;&lt;code&gt;library&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Name of the library that contains the function. This library must already be loaded by &lt;a href=&#34;../../../../../en/sql-reference/statements/create-statements/create-library/#&#34;&gt;CREATE LIBRARY&lt;/a&gt;.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;FENCED | NOT FENCED&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Enables or disables &lt;a href=&#34;../../../../../en/extending/udxs/fenced-and-unfenced-modes/&#34;&gt;fenced mode&lt;/a&gt; for this function.
&lt;p&gt;&lt;strong&gt;Default:&lt;/strong&gt;  &lt;code&gt;FENCED&lt;/code&gt;&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;privileges&#34;&gt;Privileges&lt;/h2&gt;
&lt;p&gt;Non-superuser:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;CREATE privilege on the function&#39;s schema&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;USAGE privilege on the function&#39;s library&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;This example creates an analytic function named &lt;code&gt;an_rank&lt;/code&gt; based on the factory class named &lt;code&gt;RankFactory&lt;/code&gt; in the &lt;code&gt;AnalyticFunctions&lt;/code&gt; library:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE ANALYTIC FUNCTION an_rank AS LANGUAGE &amp;#39;C++&amp;#39;
   NAME &amp;#39;RankFactory&amp;#39; LIBRARY AnalyticFunctions;
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;a href=&#34;../../../../../en/extending/developing-udxs/analytic-functions-udanfs/#&#34;&gt;Analytic functions (UDAnFs)&lt;/a&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: CREATE FILTER</title>
      <link>/en/sql-reference/statements/create-statements/create-function-statements/create-filter/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/statements/create-statements/create-function-statements/create-filter/</guid>
      <description>
        
        
        &lt;p&gt;Adds a &lt;a href=&#34;../../../../../en/extending/developing-udxs/user-defined-load-udl/user-defined-filter/&#34;&gt;user-defined load filter function&lt;/a&gt; to the catalog. The library containing the filter function must have been previously added using &lt;a href=&#34;../../../../../en/sql-reference/statements/create-statements/create-library/#&#34;&gt;CREATE LIBRARY&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;CREATE FILTER automatically determines the function parameters and return value from data supplied by the factory class. OpenText™ Analytics Database supports overloading load filter functions. When you call the SQL function, the database passes the input table to the function in the library to process.

&lt;div class=&#34;admonition important&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Important&lt;/h4&gt;
Installing an untrusted UDL function can compromise the security of the server. UDxs can contain arbitrary code. In particular, user-defined parser functions can read data from any arbitrary location. It is up to the developer of the function to enforce proper security limitations. Superusers must not grant access to UDxs to untrusted users.
&lt;/div&gt;&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;CREATE [ OR REPLACE ] FILTER [ IF NOT EXISTS ]
   [[&lt;span class=&#34;code-variable&#34;&gt;database&lt;/span&gt;.]&lt;span class=&#34;code-variable&#34;&gt;schema&lt;/span&gt;.]&lt;span class=&#34;code-variable&#34;&gt;function&lt;/span&gt; AS
   [ LANGUAGE &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;language&lt;/span&gt;&amp;#39; ]
   NAME &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;factory&lt;/span&gt;&amp;#39; LIBRARY &lt;span class=&#34;code-variable&#34;&gt;library&lt;/span&gt;
   [ FENCED | NOT FENCED ]
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;OR REPLACE&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;If a function with the same name and arguments exists, replace it. You can use this to change between fenced and unfenced modes, for example. If you do not use this directive and the function already exists, the CREATE statement returns with a rollback error.&lt;/p&gt;
&lt;p&gt;OR REPLACE and IF NOT EXISTS are mutually exclusive.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;IF NOT EXISTS&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;If a function with the same name and arguments exists, return without creating the function.&lt;/p&gt;
&lt;p&gt;OR REPLACE and IF NOT EXISTS are mutually exclusive.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;[&lt;/code&gt;&lt;em&gt;&lt;code&gt;database&lt;/code&gt;&lt;/em&gt;&lt;code&gt;.]&lt;/code&gt;&lt;em&gt;&lt;code&gt;schema&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Database and &lt;a href=&#34;../../../../../en/admin/configuring-db/designing-logical-schema/using-multiple-schemas/setting-search-paths/&#34;&gt;schema&lt;/a&gt;. The default schema is &lt;code&gt;public&lt;/code&gt;. If you specify a database, it must be the current database.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;function&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the function to create. This is the name used in SQL invocations of the function. It does not need to match the name of the factory, but it is less confusing if they are the same or similar.&lt;/p&gt;
&lt;p&gt;The function name must conform to the restrictions on &lt;a href=&#34;../../../../../en/sql-reference/language-elements/identifiers/#&#34;&gt;Identifiers&lt;/a&gt;.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;LANGUAGE &#39;&lt;/code&gt;&lt;em&gt;&lt;code&gt;language&lt;/code&gt;&lt;/em&gt;&lt;code&gt;&#39;&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;The language used to develop this function, one of the following:
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;C++&lt;/code&gt; (default)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Java&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Python&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;NAME &#39;&lt;/code&gt;&lt;em&gt;&lt;code&gt;factory&lt;/code&gt;&lt;/em&gt;&lt;code&gt;&#39;&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Name of the factory class that generates the function instance. This is the same name used by the RegisterFactory class.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;LIBRARY &lt;/code&gt;&lt;em&gt;&lt;code&gt;library&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Name of the C++ library shared object file, Python file, or Java Jar file. This library must already have been loaded by &lt;a href=&#34;../../../../../en/sql-reference/statements/create-statements/create-library/#&#34;&gt;CREATE LIBRARY&lt;/a&gt;.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;FENCED | NOT FENCED&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Enables or disables &lt;a href=&#34;../../../../../en/extending/udxs/fenced-and-unfenced-modes/&#34;&gt;fenced mode&lt;/a&gt; for this function.
&lt;p&gt;&lt;strong&gt;Default:&lt;/strong&gt;  &lt;code&gt;FENCED&lt;/code&gt;&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;privileges&#34;&gt;Privileges&lt;/h2&gt;
&lt;p&gt;Superuser&lt;/p&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;The following example demonstrates loading a library named &lt;code&gt;iConverterLib&lt;/code&gt;, then defining a filter function named &lt;code&gt;Iconverter&lt;/code&gt; that is mapped to the &lt;code&gt;iConverterFactory&lt;/code&gt; factory class in the library:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE LIBRARY iConverterLib as &amp;#39;/opt/vertica/sdk/examples/build/IconverterLib.so&amp;#39;;
CREATE LIBRARY
=&amp;gt; CREATE FILTER Iconverter AS LANGUAGE &amp;#39;C++&amp;#39; NAME &amp;#39;IconverterFactory&amp;#39; LIBRARY IconverterLib;
CREATE FILTER FUNCTION
=&amp;gt; \x
Expanded display is on.
=&amp;gt; SELECT * FROM user_functions;
-[ RECORD 1 ]----------+--------------------
schema_name            | public
function_name          | Iconverter
procedure_type         | User Defined Filter
function_return_type   |
function_argument_type |
function_definition    |
volatility             |
is_strict              | f
is_fenced              | f
comment                |
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/statements/drop-statements/drop-filter/#&#34;&gt;DROP FILTER&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/system-tables/v-catalog-schema/user-functions/#&#34;&gt;USER_FUNCTIONS&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/extending/developing-udxs/user-defined-load-udl/#&#34;&gt;User-defined load (UDL)&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: CREATE FUNCTION (scalar)</title>
      <link>/en/sql-reference/statements/create-statements/create-function-statements/create-function-scalar/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/statements/create-statements/create-function-statements/create-function-scalar/</guid>
      <description>
        
        
        &lt;p&gt;Adds a &lt;a href=&#34;../../../../../en/extending/developing-udxs/scalar-functions-udsfs/&#34;&gt;user-defined scalar function&lt;/a&gt; (UDSF) to the catalog. The library containing the function must have been previously added using &lt;a href=&#34;../../../../../en/sql-reference/statements/create-statements/create-library/#&#34;&gt;CREATE LIBRARY&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;A UDSF takes in a single row of data and returns a single value. These functions can be used anywhere a native OpenText™ Analytics Database function or statement can be used, except CREATE TABLE with its PARTITION BY or any segmentation clause.&lt;/p&gt;
&lt;p&gt;CREATE FUNCTION automatically determines the function parameters and return value from data supplied by the factory class. The database supports overloading UDxs. When you call the function, the database passes the parameters to the function in the library to process.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;CREATE [ OR REPLACE ] FUNCTION [ IF NOT EXISTS ]
   [[&lt;span class=&#34;code-variable&#34;&gt;database&lt;/span&gt;.]&lt;span class=&#34;code-variable&#34;&gt;schema&lt;/span&gt;.]&lt;span class=&#34;code-variable&#34;&gt;function&lt;/span&gt; AS
   [ LANGUAGE &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;language&lt;/span&gt;&amp;#39; ]
   NAME &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;factory&lt;/span&gt;&amp;#39;
   LIBRARY &lt;span class=&#34;code-variable&#34;&gt;library&lt;/span&gt;
   [ FENCED | NOT FENCED ]
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;OR REPLACE&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;If a function with the same name and arguments exists, replace it. You can use this to change between fenced and unfenced modes, for example. If you do not use this directive and the function already exists, the CREATE statement returns with a rollback error.&lt;/p&gt;
&lt;p&gt;OR REPLACE and IF NOT EXISTS are mutually exclusive.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;IF NOT EXISTS&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;If a function with the same name and arguments exists, return without creating the function.&lt;/p&gt;
&lt;p&gt;OR REPLACE and IF NOT EXISTS are mutually exclusive.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;[&lt;/code&gt;&lt;em&gt;&lt;code&gt;database&lt;/code&gt;&lt;/em&gt;&lt;code&gt;.]&lt;/code&gt;&lt;em&gt;&lt;code&gt;schema&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Database and &lt;a href=&#34;../../../../../en/admin/configuring-db/designing-logical-schema/using-multiple-schemas/setting-search-paths/&#34;&gt;schema&lt;/a&gt;. The default schema is &lt;code&gt;public&lt;/code&gt;. If you specify a database, it must be the current database.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;function&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the function to create. This is the name used in SQL invocations of the function. It does not need to match the name of the factory, but it is less confusing if they are the same or similar.&lt;/p&gt;
&lt;p&gt;The function name must conform to the restrictions on &lt;a href=&#34;../../../../../en/sql-reference/language-elements/identifiers/#&#34;&gt;Identifiers&lt;/a&gt;.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;LANGUAGE &#39;&lt;/code&gt;&lt;em&gt;&lt;code&gt;language&lt;/code&gt;&lt;/em&gt;&lt;code&gt;&#39;&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Language used to develop this function, one of the following:
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;C++&lt;/code&gt; (default)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Python&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Java&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;R&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;NAME &#39;&lt;/code&gt;&lt;em&gt;&lt;code&gt;factory&lt;/code&gt;&lt;/em&gt;&lt;code&gt;&#39;&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Name of the factory class that generates the function instance.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;LIBRARY &lt;/code&gt;&lt;em&gt;&lt;code&gt;library&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Name of the C++ shared object file, Python file, Java Jar file, or R functions file. This library must already have been loaded by &lt;a href=&#34;../../../../../en/sql-reference/statements/create-statements/create-library/#&#34;&gt;CREATE LIBRARY&lt;/a&gt;.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;FENCED | NOT FENCED&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Enables or disables &lt;a href=&#34;../../../../../en/extending/udxs/fenced-and-unfenced-modes/&#34;&gt;fenced mode&lt;/a&gt; for this function. Functions written in Java and R always run in fenced mode.
&lt;p&gt;&lt;strong&gt;Default:&lt;/strong&gt; &lt;code&gt;FENCED&lt;/code&gt;&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;privileges&#34;&gt;Privileges&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;CREATE privilege on the function&#39;s schema&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;USAGE privilege on the function&#39;s library&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;The following example loads a library named &lt;code&gt;ScalarFunctions&lt;/code&gt; and then defines a function named &lt;code&gt;Add2ints&lt;/code&gt; that is mapped to the &lt;code&gt;Add2intsInfo&lt;/code&gt; factory class in the library:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE LIBRARY ScalarFunctions AS &amp;#39;/opt/vertica/sdk/examples/build/ScalarFunctions.so&amp;#39;;
CREATE LIBRARY
=&amp;gt; CREATE FUNCTION Add2Ints AS LANGUAGE &amp;#39;C++&amp;#39; NAME &amp;#39;Add2IntsFactory&amp;#39; LIBRARY ScalarFunctions;
CREATE FUNCTION
=&amp;gt; \x
Expanded display is on.
=&amp;gt; SELECT * FROM USER_FUNCTIONS;

-[ RECORD 1 ]----------+----------------------------------------------------
schema_name            | public
function_name          | Add2Ints
procedure_type         | User Defined Function
function_return_type   | Integer
function_argument_type | Integer, Integer
function_definition    | Class &amp;#39;Add2IntsFactory&amp;#39; in Library &amp;#39;public.ScalarFunctions&amp;#39;
volatility             | volatile
is_strict              | f
is_fenced              | t
comment                |

=&amp;gt; \x
Expanded display is off.
=&amp;gt; -- Try a simple call to the function
=&amp;gt; SELECT Add2Ints(23,19);
 Add2Ints
----------
       42
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The following example uses a scalar function that returns a ROW:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE FUNCTION div_with_rem AS LANGUAGE &amp;#39;C++&amp;#39; NAME &amp;#39;DivFactory&amp;#39; LIBRARY ScalarFunctions;

=&amp;gt; SELECT div_with_rem(18,5);
        div_with_rem
------------------------------
 {&amp;#34;quotient&amp;#34;:3,&amp;#34;remainder&amp;#34;:3}
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;a href=&#34;../../../../../en/extending/developing-udxs/#&#34;&gt;Developing user-defined extensions (UDxs)&lt;/a&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: CREATE FUNCTION (SQL)</title>
      <link>/en/sql-reference/statements/create-statements/create-function-statements/create-function-sql/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/statements/create-statements/create-function-statements/create-function-sql/</guid>
      <description>
        
        
        &lt;p&gt;Stores SQL expressions as functions for use in queries. User-defined SQL functions are useful for executing complex queries and combining the database built-in functions. You can call the function in a given query. If multiple SQL functions with the same name and argument types are in the search path, OpenText™ Analytics Database calls the first match that it finds.&lt;/p&gt;
&lt;p&gt;SQL functions do not support complex types for arguments or return values.&lt;/p&gt;
&lt;p&gt;SQL functions are flattened in all cases, including DDL.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;CREATE [ OR REPLACE ] FUNCTION [ IF NOT EXISTS ]
    [[&lt;span class=&#34;code-variable&#34;&gt;database&lt;/span&gt;.]&lt;span class=&#34;code-variable&#34;&gt;schema&lt;/span&gt;.]&lt;span class=&#34;code-variable&#34;&gt;function&lt;/span&gt;( [ &lt;span class=&#34;code-variable&#34;&gt;argname argtype&lt;/span&gt;[,...] ] )
    RETURN &lt;span class=&#34;code-variable&#34;&gt;return_type&lt;/span&gt;
    AS
    BEGIN
       RETURN &lt;span class=&#34;code-variable&#34;&gt;expression&lt;/span&gt;;
    END;
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;OR REPLACE&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;If a function of the same name and arguments exists, replace it. If you only change the function arguments, the database ignores this option and maintains both functions under the same name.
&lt;p&gt;OR REPLACE and IF NOT EXISTS are mutually exclusive.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;IF NOT EXISTS&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;If a function with the same name and arguments exists, return without creating the function.&lt;/p&gt;
&lt;p&gt;OR REPLACE and IF NOT EXISTS are mutually exclusive.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;[&lt;/code&gt;&lt;em&gt;&lt;code&gt;database&lt;/code&gt;&lt;/em&gt;&lt;code&gt;.]&lt;/code&gt;&lt;em&gt;&lt;code&gt;schema&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Database and &lt;a href=&#34;../../../../../en/admin/configuring-db/designing-logical-schema/using-multiple-schemas/setting-search-paths/&#34;&gt;schema&lt;/a&gt;. The default schema is &lt;code&gt;public&lt;/code&gt;. If you specify a database, it must be the current database.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;function&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Name of the function to create, which must conform to the conventions described in &lt;a href=&#34;../../../../../en/sql-reference/language-elements/identifiers/#&#34;&gt;Identifiers&lt;/a&gt;.&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;argname&lt;/code&gt;&lt;/em&gt; &lt;em&gt;&lt;code&gt;argtype&lt;/code&gt;&lt;/em&gt;[,...]&lt;/dt&gt;
&lt;dd&gt;A comma-delimited list of argument names and their &lt;a href=&#34;../../../../../en/sql-reference/data-types/&#34;&gt;data types&lt;/a&gt;. Complex types are not supported.&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;return_type&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;The data type that this function returns. Complex types are not supported.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;RETURN &lt;/code&gt;&lt;em&gt;&lt;code&gt;expression&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;The SQL function body, which can contain built-in functions, operators, and argument names specified in the CREATE FUNCTION statement. The expression must end with a semicolon.

&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

&lt;p&gt;CREATE FUNCTION allows only one RETURN expression. Return expressions do not support the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;FROM, WHERE, GROUP BY, ORDER BY, and LIMIT clauses&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Aggregation, analytics, and meta-functions&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/div&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;privileges&#34;&gt;Privileges&lt;/h2&gt;
&lt;p&gt;Non-superuser:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;CREATE privilege on the function&#39;s schema&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;USAGE privilege on the function&#39;s library&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&#34;strictness-and-volatility&#34;&gt;Strictness and volatility&lt;/h2&gt;
&lt;p&gt;The database infers the &lt;a class=&#34;glosslink&#34; href=&#34;../../../../../en/glossary/strict/&#34; title=&#34;Indicates that a function always returns null when any of its input arguments is null.&#34;&gt;strictness&lt;/a&gt; and volatility (&lt;a class=&#34;glosslink&#34; href=&#34;../../../../../en/glossary/stable-functions/&#34; title=&#34;See also Immutable (invariant) functions.&#34;&gt;stable&lt;/a&gt;, &lt;a class=&#34;glosslink&#34; href=&#34;../../../../../en/glossary/immutable-invariant-functions/&#34; title=&#34;&#34;&gt;immutable&lt;/a&gt;, or &lt;a class=&#34;glosslink&#34; href=&#34;../../../../../en/glossary/volatile-functions/&#34; title=&#34;&#34;&gt;volatile&lt;/a&gt;) of a SQL function from its definition. The database then determines the correctness of usage, such as where an immutable function is expected but a volatile function is provided.&lt;/p&gt;
&lt;h2 id=&#34;sql-functions-and-views&#34;&gt;SQL functions and views&lt;/h2&gt;
&lt;p&gt;You can &lt;a href=&#34;../../../../../en/sql-reference/statements/create-statements/create-view/&#34;&gt;create views&lt;/a&gt; on the queries that use SQL functions and then query the views. When you create a view, a SQL function replaces a call to the user-defined function with the function body in a view definition. Therefore, when the body of the user-defined function is replaced, the view should also be replaced.&lt;/p&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;See &lt;a href=&#34;../../../../../en/extending/user-defined-sql-functions/creating-user-defined-sql-functions/#&#34;&gt;Creating user-defined SQL functions&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/statements/alter-statements/alter-function-statements/alter-function-scalar/#&#34;&gt;ALTER FUNCTION (scalar)&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/statements/drop-statements/drop-function/#&#34;&gt;DROP FUNCTION&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/extending/user-defined-sql-functions/#&#34;&gt;User-defined SQL functions&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: CREATE PARSER</title>
      <link>/en/sql-reference/statements/create-statements/create-function-statements/create-parser/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/statements/create-statements/create-function-statements/create-parser/</guid>
      <description>
        
        
        &lt;p&gt;Adds a &lt;a href=&#34;../../../../../en/extending/developing-udxs/user-defined-load-udl/user-defined-parser/&#34;&gt;user-defined load parser function&lt;/a&gt; to the catalog. The library containing the function must have been previously added using &lt;a href=&#34;../../../../../en/sql-reference/statements/create-statements/create-library/#&#34;&gt;CREATE LIBRARY&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;CREATE PARSER automatically determines the function parameters and return value from data supplied by the factory class. OpenText™ Analytics Database supports overloading load parser functions. When you call the SQL function, the database passes the input table to the function in the library to process.

&lt;div class=&#34;admonition important&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Important&lt;/h4&gt;
Installing an untrusted UDL function can compromise the security of the server. UDxs can contain arbitrary code. In particular, user-defined parser functions can read data from any arbitrary location. It is up to the developer of the function to enforce proper security limitations. Superusers must not grant access to UDxs to untrusted users.
&lt;/div&gt;&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;CREATE [ OR REPLACE ] PARSER [ IF NOT EXISTS ]
   [[&lt;span class=&#34;code-variable&#34;&gt;database&lt;/span&gt;.]&lt;span class=&#34;code-variable&#34;&gt;schema&lt;/span&gt;.]&lt;span class=&#34;code-variable&#34;&gt;function&lt;/span&gt; AS
   [ LANGUAGE &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;language&lt;/span&gt;&amp;#39; ]
   NAME &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;factory&lt;/span&gt;&amp;#39;
   LIBRARY &lt;span class=&#34;code-variable&#34;&gt;library&lt;/span&gt;
   [ FENCED | NOT FENCED ]
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;OR REPLACE&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;If a function with the same name and arguments exists, replace it. You can use this to change between fenced and unfenced modes, for example. If you do not use this directive and the function already exists, the CREATE statement returns with a rollback error.&lt;/p&gt;
&lt;p&gt;OR REPLACE and IF NOT EXISTS are mutually exclusive.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;IF NOT EXISTS&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;If a function with the same name and arguments exists, return without creating the function.&lt;/p&gt;
&lt;p&gt;OR REPLACE and IF NOT EXISTS are mutually exclusive.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;[&lt;/code&gt;&lt;em&gt;&lt;code&gt;database&lt;/code&gt;&lt;/em&gt;&lt;code&gt;.]&lt;/code&gt;&lt;em&gt;&lt;code&gt;schema&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Database and &lt;a href=&#34;../../../../../en/admin/configuring-db/designing-logical-schema/using-multiple-schemas/setting-search-paths/&#34;&gt;schema&lt;/a&gt;. The default schema is &lt;code&gt;public&lt;/code&gt;. If you specify a database, it must be the current database.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;function&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the function to create. This is the name used in SQL invocations of the function. It does not need to match the name of the factory, but it is less confusing if they are the same or similar.&lt;/p&gt;
&lt;p&gt;The function name must conform to the restrictions on &lt;a href=&#34;../../../../../en/sql-reference/language-elements/identifiers/#&#34;&gt;Identifiers&lt;/a&gt;.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;LANGUAGE &#39;&lt;/code&gt;&lt;em&gt;&lt;code&gt;language&lt;/code&gt;&lt;/em&gt;&lt;code&gt;&#39;&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;The language used to develop this function, one of the following:
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;C++ (default)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Java&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Python&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;NAME &#39;&lt;/code&gt;&lt;em&gt;&lt;code&gt;factory&lt;/code&gt;&lt;/em&gt;&lt;code&gt;&#39;&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Name of the factory class that generates the function instance. This is the same name used by the RegisterFactory class.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;LIBRARY &lt;/code&gt;&lt;em&gt;&lt;code&gt;library&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Name of the C++ library shared object file, Python file, or Java Jar file. This library must already have been loaded by &lt;a href=&#34;../../../../../en/sql-reference/statements/create-statements/create-library/#&#34;&gt;CREATE LIBRARY&lt;/a&gt;.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;FENCED | NOT FENCED&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Enables or disables &lt;a href=&#34;../../../../../en/extending/udxs/fenced-and-unfenced-modes/&#34;&gt;fenced mode&lt;/a&gt; for this function.
&lt;p&gt;&lt;strong&gt;Default:&lt;/strong&gt;  &lt;code&gt;FENCED&lt;/code&gt;&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;privileges&#34;&gt;Privileges&lt;/h2&gt;
&lt;p&gt;Superuser&lt;/p&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;The following example demonstrates loading a library named &lt;code&gt;BasicIntegrerParserLib&lt;/code&gt;, then defining a parser function named &lt;code&gt;BasicIntegerParser&lt;/code&gt; that is mapped to the &lt;code&gt;BasicIntegerParserFactory&lt;/code&gt; factory class in the library:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE LIBRARY BasicIntegerParserLib as &amp;#39;/opt/vertica/sdk/examples/build/BasicIntegerParser.so&amp;#39;;
CREATE LIBRARY
=&amp;gt; CREATE PARSER BasicIntegerParser AS LANGUAGE &amp;#39;C++&amp;#39; NAME &amp;#39;BasicIntegerParserFactory&amp;#39; LIBRARY BasicIntegerParserLib;
CREATE PARSER FUNCTION
=&amp;gt; \x
Expanded display is on.
=&amp;gt; SELECT * FROM user_functions;
-[ RECORD 1 ]----------+--------------------
schema_name            | public
function_name          | BasicIntegerParser
procedure_type         | User Defined Parser
function_return_type   |
function_argument_type |
function_definition    |
volatility             |
is_strict              | f
is_fenced              | f
comment                |
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/statements/drop-statements/drop-parser/#&#34;&gt;DROP PARSER&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/system-tables/v-catalog-schema/user-functions/#&#34;&gt;USER_FUNCTIONS&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/extending/developing-udxs/user-defined-load-udl/#&#34;&gt;User-defined load (UDL)&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: CREATE SOURCE</title>
      <link>/en/sql-reference/statements/create-statements/create-function-statements/create-source/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/statements/create-statements/create-function-statements/create-source/</guid>
      <description>
        
        
        &lt;p&gt;Adds a &lt;a href=&#34;../../../../../en/extending/developing-udxs/user-defined-load-udl/user-defined-source/&#34;&gt;user-defined load source function&lt;/a&gt; to the catalog. The library containing the function must have been previously added using &lt;a href=&#34;../../../../../en/sql-reference/statements/create-statements/create-library/#&#34;&gt;CREATE LIBRARY&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;CREATE SOURCE automatically determines the function parameters and return value from data supplied by the factory class. OpenText™ Analytics Database supports overloading load source functions. When you call the SQL function, the database passes the input table to the function in the library to process.

&lt;div class=&#34;admonition important&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Important&lt;/h4&gt;
Installing an untrusted UDL function can compromise the security of the server. UDxs can contain arbitrary code. In particular, user-defined parser functions can read data from any arbitrary location. It is up to the developer of the function to enforce proper security limitations. Superusers must not grant access to UDxs to untrusted users.
&lt;/div&gt;&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;CREATE [ OR REPLACE ] SOURCE [ IF NOT EXISTS ]
    [[&lt;span class=&#34;code-variable&#34;&gt;database&lt;/span&gt;.]&lt;span class=&#34;code-variable&#34;&gt;schema&lt;/span&gt;.]&lt;span class=&#34;code-variable&#34;&gt;function&lt;/span&gt; AS
    [ LANGUAGE &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;language&lt;/span&gt;&amp;#39; ]
    NAME &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;factory&lt;/span&gt;&amp;#39;
    LIBRARY &lt;span class=&#34;code-variable&#34;&gt;library&lt;/span&gt;
    [ FENCED | NOT FENCED ]
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;OR REPLACE&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;If a function with the same name and arguments exists, replace it. You can use this to change between fenced and unfenced modes, for example. If you do not use this directive and the function already exists, the CREATE statement returns with a rollback error.&lt;/p&gt;
&lt;p&gt;OR REPLACE and IF NOT EXISTS are mutually exclusive.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;IF NOT EXISTS&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;If a function with the same name and arguments exists, return without creating the function.&lt;/p&gt;
&lt;p&gt;OR REPLACE and IF NOT EXISTS are mutually exclusive.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;[&lt;/code&gt;&lt;em&gt;&lt;code&gt;database&lt;/code&gt;&lt;/em&gt;&lt;code&gt;.]&lt;/code&gt;&lt;em&gt;&lt;code&gt;schema&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Database and &lt;a href=&#34;../../../../../en/admin/configuring-db/designing-logical-schema/using-multiple-schemas/setting-search-paths/&#34;&gt;schema&lt;/a&gt;. The default schema is &lt;code&gt;public&lt;/code&gt;. If you specify a database, it must be the current database.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;function&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the function to create. This is the name used in SQL invocations of the function. It does not need to match the name of the factory, but it is less confusing if they are the same or similar.&lt;/p&gt;
&lt;p&gt;The function name must conform to the restrictions on &lt;a href=&#34;../../../../../en/sql-reference/language-elements/identifiers/#&#34;&gt;Identifiers&lt;/a&gt;.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;LANGUAGE &#39;&lt;/code&gt;&lt;em&gt;&lt;code&gt;language&lt;/code&gt;&lt;/em&gt;&lt;code&gt;&#39;&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Language used to develop this function, one of the following:
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;C++ (default)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Java&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;NAME &#39;&lt;/code&gt;&lt;em&gt;&lt;code&gt;factory&lt;/code&gt;&lt;/em&gt;&lt;code&gt;&#39;&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Name of the factory class that generates the function instance. This is the same name used by the RegisterFactory class.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;LIBRARY &lt;/code&gt;&lt;em&gt;&lt;code&gt;library&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Name of the C++ library shared object file or Java Jar file. This library must already have been loaded by &lt;a href=&#34;../../../../../en/sql-reference/statements/create-statements/create-library/#&#34;&gt;CREATE LIBRARY&lt;/a&gt;.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;FENCED | NOT FENCED&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Enables or disables &lt;a href=&#34;../../../../../en/extending/udxs/fenced-and-unfenced-modes/&#34;&gt;fenced mode&lt;/a&gt; for this function.
&lt;p&gt;&lt;strong&gt;Default:&lt;/strong&gt; &lt;code&gt;FENCED&lt;/code&gt;&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;privileges&#34;&gt;Privileges&lt;/h2&gt;
&lt;p&gt;Superuser&lt;/p&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;The following example demonstrates loading a library named &lt;code&gt;curllib&lt;/code&gt;, then defining a source function named &lt;code&gt;curl&lt;/code&gt; that is mapped to the &lt;code&gt;CurlSourceFactory&lt;/code&gt; factory class in the library:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;o&#34;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;CREATE&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;LIBRARY&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;curllib&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;as&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;/opt/vertica/sdk/examples/build/cURLLib.so&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;CREATE&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;LIBRARY&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;CREATE&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;SOURCE&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;curl&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;AS&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;LANGUAGE&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;C++&amp;#39;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;NAME&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;CurlSourceFactory&amp;#39;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;LIBRARY&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;curllib&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;CREATE&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;SOURCE&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;err&#34;&gt;\&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;x&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;Expanded&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;display&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;is&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;on&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;SELECT&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;*&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;FROM&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;user_functions&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;-&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;RECORD&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;]&lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;----------+--------------------
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;schema_name&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;            &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;public&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;function_name&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;          &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;curl&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;procedure_type&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;         &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;User&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;Defined&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;Source&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;function_return_type&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;   &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;function_argument_type&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;function_definition&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;volatility&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;             &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;is_strict&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;              &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;f&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;is_fenced&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;              &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;f&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;comment&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;                &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/statements/drop-statements/drop-source/#&#34;&gt;DROP SOURCE&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/system-tables/v-catalog-schema/user-functions/#&#34;&gt;USER_FUNCTIONS&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/extending/developing-udxs/user-defined-load-udl/#&#34;&gt;User-defined load (UDL)&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: CREATE TRANSFORM FUNCTION</title>
      <link>/en/sql-reference/statements/create-statements/create-function-statements/create-transform-function/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/statements/create-statements/create-function-statements/create-transform-function/</guid>
      <description>
        
        
        &lt;p&gt;Adds a &lt;a href=&#34;../../../../../en/extending/developing-udxs/transform-functions-udtfs/&#34;&gt;user-defined transform function&lt;/a&gt; (UDTF) to the catalog. The library containing the function must have been previously added using &lt;a href=&#34;../../../../../en/sql-reference/statements/create-statements/create-library/#&#34;&gt;CREATE LIBRARY&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;CREATE TRANSFORM FUNCTION automatically determines the function parameters and return value from data supplied by the factory class. OpenText™ Analytics Database supports overloading transform functions. When you call the SQL function, the database passes the input table to the transform function in the library to process.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;CREATE [ OR REPLACE ] TRANSFORM FUNCTION [ IF NOT EXISTS ]
    [[&lt;span class=&#34;code-variable&#34;&gt;database&lt;/span&gt;.]&lt;span class=&#34;code-variable&#34;&gt;schema&lt;/span&gt;.]&lt;span class=&#34;code-variable&#34;&gt;function&lt;/span&gt; AS
    [ LANGUAGE &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;language&lt;/span&gt;&amp;#39; ]
    NAME &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;factory&lt;/span&gt;&amp;#39;
    LIBRARY &lt;span class=&#34;code-variable&#34;&gt;library&lt;/span&gt;
    [ FENCED | NOT FENCED ]
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;OR REPLACE&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;If a function with the same name and arguments exists, replace it. You can use this to change between fenced and unfenced modes, for example. If you do not use this directive and the function already exists, the CREATE statement returns with a rollback error.&lt;/p&gt;
&lt;p&gt;OR REPLACE and IF NOT EXISTS are mutually exclusive.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;IF NOT EXISTS&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;If a function with the same name and arguments exists, return without creating the function.&lt;/p&gt;
&lt;p&gt;OR REPLACE and IF NOT EXISTS are mutually exclusive.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;[&lt;/code&gt;&lt;em&gt;&lt;code&gt;database&lt;/code&gt;&lt;/em&gt;&lt;code&gt;.]&lt;/code&gt;&lt;em&gt;&lt;code&gt;schema&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Database and &lt;a href=&#34;../../../../../en/admin/configuring-db/designing-logical-schema/using-multiple-schemas/setting-search-paths/&#34;&gt;schema&lt;/a&gt;. The default schema is &lt;code&gt;public&lt;/code&gt;. If you specify a database, it must be the current database.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;function&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the function to create. This is the name used in SQL invocations of the function. It does not need to match the name of the factory, but it is less confusing if they are the same or similar.&lt;/p&gt;
&lt;p&gt;The function name must conform to the restrictions on &lt;a href=&#34;../../../../../en/sql-reference/language-elements/identifiers/#&#34;&gt;Identifiers&lt;/a&gt;.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;LANGUAGE &#39;&lt;/code&gt;&lt;em&gt;&lt;code&gt;language&lt;/code&gt;&lt;/em&gt;&lt;code&gt;&#39;&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;The language used to develop this function, one of the following:
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;C++&lt;/code&gt; (default)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Java&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;R&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Python&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;NAME &#39;&lt;/code&gt;&lt;em&gt;&lt;code&gt;factory&lt;/code&gt;&lt;/em&gt;&lt;code&gt;&#39;&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Name of the factory class that generates the function instance.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;LIBRARY &lt;/code&gt;&lt;em&gt;&lt;code&gt;library&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Name of the C++ shared object file, Python file, Java Jar file, or R functions file. This library must already have been loaded by &lt;a href=&#34;../../../../../en/sql-reference/statements/create-statements/create-library/#&#34;&gt;CREATE LIBRARY&lt;/a&gt;.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;FENCED | NOT FENCED&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Enables or disables &lt;a href=&#34;../../../../../en/extending/udxs/fenced-and-unfenced-modes/&#34;&gt;fenced mode&lt;/a&gt; for this function. Functions written in Java and R always run in fenced mode.
&lt;p&gt;&lt;strong&gt;Default:&lt;/strong&gt; &lt;code&gt;FENCED&lt;/code&gt;&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;privileges&#34;&gt;Privileges&lt;/h2&gt;
&lt;p&gt;Non-superuser:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;CREATE privilege on the function&#39;s schema&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;USAGE privilege on the function&#39;s library&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&#34;restrictions&#34;&gt;Restrictions&lt;/h2&gt;
&lt;p&gt;A query that includes a UDTF cannot:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Include statements other than the &lt;a href=&#34;../../../../../en/sql-reference/statements/select/#&#34;&gt;SELECT&lt;/a&gt; statement that calls the UDTF and a PARTITION BY expression unless the UDTF is marked as a &lt;a href=&#34;../../../../../en/extending/developing-udxs/transform-functions-udtfs/partitioning-options-udtfs/#One-to-Many UDTF&#34;&gt;one-to-many UDTF&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Call an &lt;a href=&#34;../../../../../en/sql-reference/functions/analytic-functions/&#34;&gt;analytic function&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Call another UDTF&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Include one of the following clauses:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../../../en/sql-reference/statements/select/timeseries-clause/&#34;&gt;TIMESERIES&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../../../en/sql-reference/functions/match-and-search-functions/match-clause-functions/&#34;&gt;Pattern matching&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../../../en/data-analysis/time-series-analytics/gap-filling-and-interpolation-gfi/&#34;&gt;Gap filling and interpolation&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;The following example loads a library named &lt;code&gt;TransformFunctions&lt;/code&gt; and then defines a function named &lt;code&gt;tokenize&lt;/code&gt; that is mapped to the &lt;code&gt;TokenFactory&lt;/code&gt; factory class in the library:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE LIBRARY TransformFunctions AS
   &amp;#39;/home/dbadmin/TransformFunctions.so&amp;#39;;
CREATE LIBRARY
=&amp;gt; CREATE TRANSFORM FUNCTION tokenize
   AS LANGUAGE &amp;#39;C++&amp;#39; NAME &amp;#39;TokenFactory&amp;#39; LIBRARY TransformFunctions;
CREATE TRANSFORM FUNCTION
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/statements/drop-statements/drop-function/#&#34;&gt;DROP FUNCTION&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/extending/developing-udxs/#&#34;&gt;Developing user-defined extensions (UDxs)&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
  </channel>
</rss>
