JDBC语句可以在查询字符串上运行解释计划吗?

问题描述 投票:0回答:1

JDBC语句可以在查询字符串上运行解释计划吗?

该代码引发SQL异常错误消息:关键字'plan'附近的语法不正确。

conn = getEntityManager().unwrap(java.sql.Connection.class);
stmt = conn.createStatement();         
stmt.execute("explain plan for SELECT 1"); // throws sql exception
rs = stmt.executeQuery("select plan_table_output from table(dbms_xplan.display())");
while (rs.next()) 
{
  System.out.println(rs.getString(1));
}
java sql jdbc sqlexception executequery
1个回答
0
投票

您尝试过:stmt.execute("EXPLAIN PLAN FOR SELECT 1 FROM DUAL");

© www.soinside.com 2019 - 2024. All rights reserved.