JDBC escape syntax

You can use JDBC escape syntax from any JDBC application, including Interactive SQL. This escape syntax allows you to call stored procedures regardless of the database management system you are using. The general form for the escape syntax is

{ keyword parameters }

The set of keywords includes the following:

  • {d date-string}   The date string is any date value accepted by SQL Anywhere.

  • {t time-string}   The time string is any time value accepted by SQL Anywhere.

  • {ts date-string time-string}   The date/time string is any timestamp value accepted by SQL Anywhere.

  • {guid uuid-string}   The uuid-string is any valid GUID string, for example, 41dfe9ef-db91-11d2-8c43-006008d26a6f.

  • {oj outer-join-expr}   The outer-join-expr is a valid OUTER JOIN expression accepted by SQL Anywhere.

  • {? = call func(p1,...)}   The function is any valid function call accepted by SQL Anywhere.

  • {call proc(p1,...)}   The procedure is any valid stored procedure call accepted by SQL Anywhere.

  • {fn func(p1,...)}   The function is any one of the library of functions listed below.

You can use the escape syntax to access a library of functions implemented by the JDBC driver that includes number, string, time, date, and system functions.

For example, to obtain the current date in a database management system-neutral way, you would execute the following:

SELECT { FN CURDATE() }

The functions that are available depend on the JDBC driver that you are using. The following tables list the functions that are supported by the SQL Anywhere JDBC driver and by the jConnect driver.

 SQL Anywhere JDBC driver supported functions
 jConnect supported functions