Available in versions: Dev (3.20) | Latest (3.19) | 3.18 | 3.17 | 3.16 | 3.15 | 3.14 | 3.13 | 3.12 | 3.11

SQL Parser CLI

Applies to ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

The Parser API can be used as a translator between source and target dialects programmatically, as we've seen in the previous section about the parser API. This functionality can also usefully be accessed on the command line as shown below:

$ java -cp jooq-3.17.31.jar:reactive-streams-1.0.3.jar:r2dbc-spi-0.9.0.RELEASE.jar org.jooq.ParserCLI -h
Usage:
  -f / --formatted                                                    Format output SQL
  -h / --help                                                         Display this help
  -k / --keyword                                  <RenderKeywordCase> Specify the output keyword case (org.jooq.conf.RenderKeywordCase)
  -i / --identifier                               <RenderNameCase>    Specify the output identifier case (org.jooq.conf.RenderNameCase)
  -Q / --quoted                                   <RenderQuotedNames> Specify the output identifier quoting (org.jooq.conf.RenderQuotedNames)
  -F / --from-dialect                             <SQLDialect>        Specify the input dialect (org.jooq.SQLDialect)
  -T / --to-dialect                               <SQLDialect>        Specify the output dialect (org.jooq.SQLDialect)
  -S / --schema                                   <String>            Specify the input SQL schema
  -s / --sql                                      <String>            Specify the input SQL string

Additional flags:
  --parse-date-format                             <String>
  --parse-locale                                  <Locale>
  --parse-name-case                               <ParseNameCase>
  --parse-named-param-prefix                      <String>
  --parse-retain-comments-between-queries
  --parse-set-commands
  --parse-timestamp-format                        <String>
  --parse-unknown-functions                       <ParseUnknownFunctions>
  --parse-unsupported-syntax                      <ParseUnsupportedSyntax>
  --render-optional-inner-keyword                 <RenderOptionalKeyword>
  --render-optional-outer-keyword                 <RenderOptionalKeyword>
  --render-optional-as-keyword-for-field-aliases  <RenderOptionalKeyword>
  --render-optional-as-keyword-for-table-aliases  <RenderOptionalKeyword>

Commercial distribution only features:
  --render-coalesce-to-empty-string-in-concat
  --transform-patterns
  --transform-ansi-join-to-table-lists
  --transform-qualify                             <Transformation>
  --transform-rownum                              <Transformation>
  --transform-table-lists-to-ansi-join
  --transform-unneeded-arithmetic                 <TransformUnneededArithmeticExpressions>

  -I / --interactive                                               Start interactive mode

$ java -cp jooq-3.17.31.jar:reactive-streams-1.0.3.jar:r2dbc-spi-0.9.0.RELEASE.jar org.jooq.ParserCLI -T ORACLE -s "SELECT substring('abcde', 2, 3)"
select substr('abcde', 2, 3) from dual;

Windows users: Please replace : by ; in the above examples.

Another way to use this API is the https://www.jooq.org/translate website.

References to this page

Feedback

Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo