<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/~shawkins">Steven Hawkins</a>
    </h4>
        <div id="versionComment">
        <b>Comment:</b>
        updating ddl and stats are now longs<br />
    </div>
        <br/>
                         <h4>Changes (17)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-unchanged" >h1. SYS.getXMLSchemas <br></td></tr>
            <tr><td class="diff-changed-lines" >Returns a resultset with a single column, schema, containing the schemas as <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">clobs.</span> <span class="diff-added-words"style="background-color: #dfd;">xml.</span> <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">{code:SQL}SYS.getXMLSchemas(document in string) returns schema string{code} <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">{code:SQL}SYS.getXMLSchemas(IN document string NOT NULL) RETURNS TABLE (schema xml){code} <br></td></tr>
            <tr><td class="diff-unchanged" > <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >Log a message to the underlying logging system. <br>{code:SQL} <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">SYSADMIN.logMsg(logged RETURN boolean, level IN string, context IN string, msg IN object) <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">SYSADMIN.logMsg(OUT logged boolean NOT NULL RESULT, IN level string NOT NULL DEFAULT &#39;DEBUG&#39;, IN context string NOT NULL DEFAULT &#39;org.teiid.PROCESSOR&#39;, IN msg object NOT NULL) <br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >Tests if logging is enabled at the given level and context. <br>{code:SQL} <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">SYSADMIN.isLoggable(loggable RETURN boolean, level IN string, context IN string) <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">SYSADMIN.isLoggable(OUT loggable boolean NOT NULL RESULT, IN level string NOT NULL DEFAULT &#39;DEBUG&#39;, IN context string NOT NULL DEFAULT &#39;org.teiid.PROCESSOR&#39;) <br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > <br>{code:SQL} <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">SYSADMIN.refreshMatView(RowsUpdated return integer, ViewName in string, Invalidate in boolean) <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">SYSADMIN.refreshMatView(OUT RowsUpdated integer NOT NULL RESULT, IN ViewName string NOT NULL, IN Invalidate boolean NOT NULL DEFAULT &#39;false&#39;) <br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > <br>{code:SQL} <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">SYSADMIN.refreshMatViewRow(RowsUpdated return integer, ViewName in string, Key in object) <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">SYSADMIN.refreshMatViewRow(OUT RowsUpdated integer NOT NULL RESULT, IN ViewName string NOT NULL, IN Key object NOT NULL) <br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >Set statistics for the given table. <br>{code:SQL} <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">SYSADMIN.setTableStats(TableName in string, Cardinality in integer) <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">SYSADMIN.setTableStats(IN tableName string NOT NULL, IN cardinality long NOT NULL) <br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br> <br></td></tr>
            <tr><td class="diff-unchanged" >h2. SYSADMIN.setColumnStats <br>Set statistics for the given column. <br>{code:SQL} <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">SYSADMIN.setColumnStats(TableName in string, ColumnName in string, DistinctCount in integer, NullCount in integer, Max in string, Min in string) <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">SYSADMIN.setColumnStats(IN tableName string NOT NULL, IN columnName string NOT NULL, IN distinctCount long, IN nullCount long, IN max string, IN min string) <br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > <br>{code:SQL} <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">SYSADMIN.setProperty(OldValue return clob, Uid in string, Name in string, Value in clob) <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">SYSADMIN.setProperty(OUT OldValue clob NOT NULL RESULT, IN UID string NOT NULL, IN Name string NOT NULL, IN &quot;Value&quot; clob) <br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br> <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.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, IN Key object NOT NULL)
</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=3&originalVersion=2">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>