<html>
<head>
    <base href="https://docs.jboss.org/author">
            <link rel="stylesheet" href="/author/s/en/2172/19/5/_/styles/combined.css?spaceKey=TEIID&amp;forWysiwyg=true" type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://docs.jboss.org/author/display/TEIID/System+Procedures">System Procedures</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://docs.jboss.org/author/display/~van.halbert">Van Halbert</a>
    </h4>
        <br/>
                         <h4>Changes (2)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;"> <br>h1. SYSADMIN.loadMatView <br>The loadMatView is used to perform a complete refresh of the materialized table. <br> <br>Returns integer RowsInserted. \-1 indicates the materialized table is currently invalid.  And-3 indicates there was an exception when performing the load.  See the Caching Guide for more. <br> <br>{code:SQL} <br>SYSADMIN.loadMatView(IN schemaName string NOT NULL, IN viewName string NOT NULL, IN invalidate boolean NOT NULL DEFAULT &#39;false&#39;) RETURNS integer <br>{code} <br> <br></td></tr>
            <tr><td class="diff-unchanged" >h1. SYSADMIN.refreshMatView <br>Returns integer RowsUpdated. \-1 indicates a load is in progress, otherwise the cardinality of the table is returned.  See the [Caching Guide] for more. <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">h1. SYSADMIN.updateMatView <br>The updateMatView procedure is used to update a subset of a materialized table based on the refresh criteria. <br> <br>Returns integer RowsUpdated. \-1 indicates the materialized table is currently invalid.  And-3 indicates there was an exception when performing the update.  See the Caching Guide for more. <br> <br>{code:SQL} <br>SYSADMIN.updateMatView(IN schemaName string NOT NULL, IN viewName string NOT NULL, IN refreshCriteria string) RETURNS integer <br>{code} <br> <br> <br></td></tr>
            <tr><td class="diff-unchanged" >h1. Metadata Procedures <br>{note}A MetadataRepository must be configured to make a non\-temporary metadata update persistent. See the [Developer&#39;s Guide] Runtime Metadata Updates section for more. <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h1><a name="SystemProcedures-SYS.getXMLSchemas"></a>SYS.getXMLSchemas</h1>
<p>Returns a resultset with a single column, schema, containing the schemas as xml.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">SYS.getXMLSchemas(IN document string NOT NULL) RETURNS TABLE (schema xml)</pre>
</div></div>


<h1><a name="SystemProcedures-SYSADMIN.logMsg"></a>SYSADMIN.logMsg</h1>
<p>Log a message to the underlying logging system.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SYSADMIN.logMsg(OUT logged boolean NOT NULL RESULT, IN level string NOT NULL DEFAULT 'DEBUG', IN context string NOT NULL DEFAULT 'org.teiid.PROCESSOR', IN msg object NOT NULL)
</pre>
</div></div>

<p>Returns true if the message was logged.  level can be one of the log4j levels: OFF, FATAL, ERROR, WARN, INFO, DEBUG, TRACE.  level defaults to 'DEBUG' and context defaults to 'org.teiid.PROCESSOR'</p>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>Example logMsg</b></div><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">CALL SYSADMIN.logMsg(msg=&gt;'some debug', context=&gt;'org.something')</pre>
</div></div>
<p>This will log the message 'some debug' at the default level DEBUG to the context org.something.</p>


<h1><a name="SystemProcedures-SYSADMIN.isLoggable"></a>SYSADMIN.isLoggable</h1>
<p>Tests if logging is enabled at the given level and context.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SYSADMIN.isLoggable(OUT loggable boolean NOT NULL RESULT, IN level string NOT NULL DEFAULT 'DEBUG', IN context string NOT NULL DEFAULT 'org.teiid.PROCESSOR')
</pre>
</div></div>

<p>Returns true if logging is enabled.  level can be one of the log4j levels: OFF, FATAL, ERROR, WARN, INFO, DEBUG, TRACE.  level defaults to 'DEBUG' and context defaults to 'org.teiid.PROCESSOR'</p>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>Example isLoggable</b></div><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
IF ((CALL SYSADMIN.isLoggable(context=&gt;'org.something'))
BEGIN
   DECLARE STRING msg;
   // logic to build the message ...
   CALL SYSADMIN.logMsg(msg=&gt;msg, context=&gt;'org.something')
END
</pre>
</div></div>


<h1><a name="SystemProcedures-SYSADMIN.loadMatView"></a>SYSADMIN.loadMatView</h1>
<p>The loadMatView is used to perform a complete refresh of the materialized table.</p>

<p>Returns integer RowsInserted. &#45;1 indicates the materialized table is currently invalid.  And-3 indicates there was an exception when performing the load.  See the Caching Guide for more.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SYSADMIN.loadMatView(IN schemaName string NOT NULL, IN viewName string NOT NULL, IN invalidate boolean NOT NULL DEFAULT 'false') RETURNS integer
</pre>
</div></div>

<h1><a name="SystemProcedures-SYSADMIN.refreshMatView"></a>SYSADMIN.refreshMatView</h1>
<p>Returns integer RowsUpdated. &#45;1 indicates a load is in progress, otherwise the cardinality of the table is returned.  See the <a href="/author/display/TEIID/Caching+Guide" title="Caching Guide">Caching Guide</a> for more.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SYSADMIN.refreshMatView(OUT RowsUpdated integer NOT NULL RESULT, IN ViewName string NOT NULL, IN Invalidate boolean NOT NULL DEFAULT 'false')
</pre>
</div></div>


<h1><a name="SystemProcedures-SYSADMIN.refreshMatViewRow"></a>SYSADMIN.refreshMatViewRow</h1>
<p>Returns integer RowsUpdated. &#45;1 indicates the materialized table is currently invalid. 0 indicates that the specified row did not exist in the live data query or in the materialized table.  See the Caching Guide for more.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SYSADMIN.refreshMatViewRow(OUT RowsUpdated integer NOT NULL RESULT, IN ViewName string NOT NULL, VARIADIC Key object NOT NULL)
</pre>
</div></div>

<h1><a name="SystemProcedures-SYSADMIN.refreshMatViewRows"></a>SYSADMIN.refreshMatViewRows</h1>
<p>Returns integer RowsUpdated. &#45;1 indicates the materialized table is currently invalid. Any row that does not exist in the live data query or in the materialized table will not count toward the RowsUpdated.  See the Caching Guide for more.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SYSADMIN.refreshMatViewRows(OUT RowsUpdated integer NOT NULL RESULT, IN ViewName string NOT NULL, VARIADIC Key object[] NOT NULL)
</pre>
</div></div>

<h1><a name="SystemProcedures-SYSADMIN.updateMatView"></a>SYSADMIN.updateMatView</h1>
<p>The updateMatView procedure is used to update a subset of a materialized table based on the refresh criteria.</p>

<p>Returns integer RowsUpdated. &#45;1 indicates the materialized table is currently invalid.  And-3 indicates there was an exception when performing the update.  See the Caching Guide for more.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SYSADMIN.updateMatView(IN schemaName string NOT NULL, IN viewName string NOT NULL, IN refreshCriteria string) RETURNS integer
</pre>
</div></div>


<h1><a name="SystemProcedures-MetadataProcedures"></a>Metadata Procedures</h1>
<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>A MetadataRepository must be configured to make a non&#45;temporary metadata update persistent. See the <a href="/author/display/TEIID/Developer%27s+Guide" title="Developer&#39;s Guide">Developer's Guide</a> Runtime Metadata Updates section for more.</td></tr></table></div>

<h2><a name="SystemProcedures-SYSADMIN.setTableStats"></a>SYSADMIN.setTableStats</h2>
<p>Set statistics for the given table.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SYSADMIN.setTableStats(IN tableName string NOT NULL, IN cardinality long NOT NULL)
</pre>
</div></div>

<h2><a name="SystemProcedures-SYSADMIN.setColumnStats"></a>SYSADMIN.setColumnStats</h2>
<p>Set statistics for the given column.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SYSADMIN.setColumnStats(IN tableName string NOT NULL, IN columnName string NOT NULL, IN distinctCount long, IN nullCount long, IN max string, IN min string)
</pre>
</div></div>

<p>All stat values are nullable. Passing a null stat value will leave corresponding metadata value unchanged.</p>


<h2><a name="SystemProcedures-SYSADMIN.setProperty"></a>SYSADMIN.setProperty</h2>
<p>Set an extension metadata property for the given record.  Extension metadata is typically used by <a href="/author/display/TEIID/Translators" title="Translators">Translators</a>.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SYSADMIN.setProperty(OUT OldValue clob NOT NULL RESULT, IN UID string NOT NULL, IN Name string NOT NULL, IN "Value" clob)
</pre>
</div></div>

<p>Setting a value to null will remove the property.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>Example Property Set</b></div><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
CALL SYSADMIN.setProperty(uid=&gt;(SELECT uid FROM TABLES WHERE name='tab'), name=&gt;'some name', value=&gt;'some value')
</pre>
</div></div>
<p>This will set the property 'some name'='some value' on table tab.</p>

<p>The use of this procedure will not trigger replanning of associated prepared plans.</p>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;" class="grey">
                        <a href="https://docs.jboss.org/author/users/removespacenotification.action?spaceKey=TEIID">Stop watching space</a>
            <span style="padding: 0px 5px;">|</span>
                <a href="https://docs.jboss.org/author/users/editmyemailsettings.action">Change email notification preferences</a>
</div>
        <a href="https://docs.jboss.org/author/display/TEIID/System+Procedures">View Online</a>
        |
        <a href="https://docs.jboss.org/author/pages/diffpagesbyversion.action?pageId=18646283&revisedVersion=6&originalVersion=5">View Changes</a>
                |
        <a href="https://docs.jboss.org/author/display/TEIID/System+Procedures?showComments=true&amp;showCommentArea=true#addcomment">Add Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>