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));
}
您尝试过:stmt.execute("EXPLAIN PLAN FOR SELECT 1 FROM DUAL");