column names for an ad-hoc sql

懵懂的女人 提交于 2019-12-11 07:45:16

问题


My programm will get an input of a valid sql, and should return column names for the sql. And I want to do this with out executing the sql statement at all. I am looking for a java solution.

My dbms is oracle optimized for olap, and the tables are so big that result set restriction does not working. Actually execution time is not acceptable for my case. it takes longer than a minute


回答1:


Prepare the query, but rather than executing it, just call getMetaData on the prepared statement. Provided your driver supports it, this should return the result set meta data with the column descriptions without executing a query.



来源:https://stackoverflow.com/questions/9207073/column-names-for-an-ad-hoc-sql

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!