Java SQL Parser Library¶
JSQLParser is a SQL statement parser built from JavaCC. It translates SQLs in a traversable hierarchy of Java classes. The upcoming 5.0 release will depend on Java 11 and introduces new Visitors. Please see the Migration to 5.0 guide.
Latest stable release: JSQLFormatter-5.0.jar
Development version: JSQLFormatter-5.1-SNAPSHOT.jar
SELECT /*+ PARALLEL */
cfe.id_collateral_ref.nextval
, id_collateral
FROM ( SELECT DISTINCT
a.id_collateral
FROM cfe.collateral a
LEFT JOIN cfe.collateral_ref b
ON a.id_collateral = b.id_collateral
WHERE b.id_collateral_ref IS NULL )
;
SQL Dialects¶
JSqlParser is RDBMS agnostic and provides support for many dialects such as:
Oracle Database
MS SqlServer
MySQL and MariaDB
PostgreSQL
H2
Features¶
- Comprehensive support for statements:
QUERY:
SELECT ...
DML:
INSERT ... INTO ...
UPDATE ...
MERGE ... INTO ...
DELETE ... FROM ...
DDL:
CREATE ...
ALTER ...
DROP ...
Nested Expressions (e.g. Sub-Selects)
WITH
clausesOld Oracle
JOIN (+)
PostgreSQL implicit
CAST ::
SQL Parameters (e.g.
?
or:parameter
)Arrays vs. T-SQL Squared Bracket Quotes
Fluent API to create SQL Statements from java Code
Statement De-Parser to write SQL from Java Objects