Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ORA-00922: 选项缺失或无效 #432

Closed
ifooling opened this issue Aug 8, 2022 · 3 comments · Fixed by #434
Closed

ORA-00922: 选项缺失或无效 #432

ifooling opened this issue Aug 8, 2022 · 3 comments · Fixed by #434

Comments

@ifooling
Copy link
Contributor

ifooling commented Aug 8, 2022

环境信息

  • 系统: Windows 11
  • JDK: 1.8.0_17
  • 数据库: Oracle 12C
  • APIJSON: 5.1.0

问题描述

查询时使用性能分析关键字 @explain 报错

查询参数

{
  "Access": {
    "id": 1
  },
  "@explain": true
}

错误信息

"ORA-00922: 选项缺失或无效"

生成的 SQL 如下:

SET STATISTICS PROFILE ON  SELECT * FROM (SELECT "Access".*, ROWNUM RN FROM (SELECT * FROM "CRUD_ACCESS" WHERE  (  ("id" = 1)  ) ) "Access"  WHERE ROWNUM <= 1) WHERE RN > 0

如上sql在oracle中手动执行也报 <选项缺失或无效> 错误,怀疑 oracle 不支持 SET STATISTICS PROFILE ON 参数

是不是我oracle哪里没设置对或者其他问题?

@TommyLemon
Copy link
Collaborator

TommyLemon commented Aug 8, 2022

@ifooling 感谢反馈。
看官网文档应该是
"EXPLAIN PLAN FOR ..."
https://docs.oracle.com/cd/B10501_01/server.920/a96533/ex_plan.htm
image

可以在 AbstractSQLConfig.getSQL 改一行代码来兼容
https://github.com/Tencent/APIJSON/blob/master/APIJSONORM/src/main/java/apijson/orm/AbstractSQLConfig.java#L3982
image

可以帮忙改下发个 Pull Request,谢谢。开源要大家一起参与贡献才会更美好~
image

https://github.com/Tencent/APIJSON/blob/master/CONTRIBUTING.md#%E4%B8%BA%E4%BB%80%E4%B9%88%E4%B8%80%E5%AE%9A%E8%A6%81%E8%B4%A1%E7%8C%AE%E4%BB%A3%E7%A0%81

#406

ifooling added a commit to ifooling/APIJSON that referenced this issue Aug 9, 2022
解决数据源为Oracle时,使用性能分析关键字 @Explain,查询报 "ORA-00922: 选项缺失或无效"问题

issue Tencent#432
closes Tencent#432
@ifooling
Copy link
Contributor Author

@TommyLemon 我改了两个bug 一个@Explain 一个oracle 使用自增主键报错问题

@TommyLemon
Copy link
Collaborator

TommyLemon commented Aug 12, 2022

@TommyLemon 我改了两个bug 一个@Explain 一个oracle 使用自增主键报错问题

感谢贡献,已合并~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants