X4 Produktdokumentation

Statement: Direktes SQL

Input

<Any element name>
   <statement resulttag="result element name" timezone="time zone"
    format="date format">
      <sql>  
         SQL statement
      </sql>
   </statement> 
</Any element name>

The following rules apply to each <statement/> element:

  • The optional attribute timezone specifies a timezone according to java.util.TimeZone, e. g. GMT+2, see http://docs.oracle.com/javase/1.5.0/docs/api/java/util/TimeZone.html.

  • The optional attribute format specifies a date format according to java.text.SimpleDateFormat.

  • It contains at least one <sql/> element with an SQL statement.


If you use characters within the SQL statement or for the values or data of the table columns that have a meaning in XML, mask the SQL statement with surrounding CDATA block, e.g. <![CDATA[ SELECT * FROM TABLE WHERE ID<1 ]]> or <rowset><row><name><!CDATA[ XML character “<“ in CDATA element]]></name></row></rowset>.

This ensures that the characters in the CDATA element are not interpreted as XML, but as data for the adapter.

Example

<select>
   <statement resulttag="result" timezone="UTC" format="dd.MM.yyyy">
      <sql>  
         <![CDATA[SELECT * FROM JMS_USERS]]>
      </sql>
   </statement> 
</select>

Output

If the SQL statement was executed successfully, the database connection component will output an XML document with the following structure containing the query response as a string:

<Data>
   <Result element name>
      <Feld1><!--Value--></Feld1>
      <Feldn><!--Value--></Feldn>
   </Result element name>
</Data>


For SELECT statements used to access database tables with column names that do not represent a valid XML name, synthetic element names are created within the result XML document, in order to ensure that the XML document is well-formed.