SQL parser library for Java - Retrieve the list of table names present in a SQL statement

后端 未结 4 959
Happy的楠姐
Happy的楠姐 2020-12-18 09:20

I am looking for a SQL Library that will parse an SQL statement and return some sort of Object representation of the SQL statement. My main objective is actually to be able

4条回答
  •  天涯浪人
    2020-12-18 10:14

    You needn't reinvent the wheel, there is already such a reliable SQL parser library there, (it's commerical, not free), and this article shows how to retrieve the list of table names present in the SQL statement (including subqueries, joins and unions) that is exactly what you are looking for.

    http://www.dpriver.com/blog/list-of-demos-illustrate-how-to-use-general-sql-parser/get-columns-and-tables-in-sql-script/

    This SQL parser library supports Oracle, SQL Server, DB2, MySQL, Teradata and ACCESS.

提交回复
热议问题