SQL 2016 MATCH RECOGNIZE JDBC parameter Marker / Escape Characters

Douglas Surber douglas.surber at oracle.com
Mon Oct 8 20:41:11 UTC 2018


As the following example is written as Java String literals, the backslashes must be doubled.

> On Oct 8, 2018, at 1:20 PM, Lance Andersen <lance.andersen at oracle.com> wrote:
> 
> String sql =
>    "select T.firstW, T.lastZ, ? " +  // use of parameter marker
>    "from tkpattern_S11 " +
>    "MATCH_RECOGNIZE ( " +
>    "    MEASURES A.c1 as firstW, last(Z.c1) as lastZ " +
>    "    ALL MATCHES " +
>    "    PATTERN(A{\?\} X{\*?\} Y{\+?\} Z{\??\}) " +  // use of escape sequence
   "    PATTERN(A{\\?\\} X{\\*?\\} Y{\\+?\\} Z{\\??\\}) " +  // use of escape sequence
>    "    DEFINE " +
>    "        X as X.c2 > prev(X.c2), " +
>    "        Y as Y.c2 < prev(Y.c2), " +
>    "        Z as Z.c2 > prev(Z.c2)" +
>    ") as T";



More information about the jdbc-spec-discuss mailing list