运维联盟俱乐部

 找回密码
 立即注册
查看: 1837|回复: 0

[日常管理] too many parse errors

[复制链接]
  • TA的每日心情
    开心
    2023-8-9 11:05
  • 发表于 2023-3-7 16:52:50 | 显示全部楼层 |阅读模式
    Query With Resultset.TYPE_SCROLL_SENSITIVE Causes ORA-936 (Doc ID 2367548.1)
    Applies to:  JDBC - Version 11.2.0.1.0 and later
    Information in this document applies to any platform.
    SymptomsWhen an application using JDBC driver version 11.2. or later executes a query like:

    String sql =select * from <TABLE_NAME> where <COLUMN_NAME>=?";
    that is done on a statement of type:

      stmt =conn.prepareStatement(sql, ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY),
    the following parse error occurs :
    ORA-00936: missing expression

    Changes
    CauseThe issue is caused by SELECT * limitation when using JDBC "ResultSet.TYPE_SCROLL_SENSITIVE.

    It is intended behavior that when using JDBC "ResultSet.TYPE_SCROLL_SENSITIVE", a "ROWID" will be automatically added to the query.
    That is why the rowid as "__Oracle_JDBC_internal_ROWID__", is appended.

    Now, since your queries are of type "select *...", and these cannot have a rowid added to them without becoming syntactically incorrect, the parse fails and generates the ORA-00936: missing expression reported in the database traces:

    PARSE ERROR #140638236435256:len=109 dep=0 uid=<UID> oct=3 lid=<UID> tim=1021139536948 err=936
    select rowid as "__Oracle_JDBC_interal_ROWID__", * from TBL where TBL_CODE=:1
    WAIT #140638236435256: nam='SQL*Net break/reset to client' ela= 4 driver id=1952673792 break?=1 p3=0 obj#=67770 tim=1021139537026
    WAIT #140638236435256: nam='SQL*Net break/reset to client' ela= 29066 driver id=1952673792 break?=0 p3=0 obj#=67770 tim=1021139566105
    WAIT #140638236435256: nam='SQL*Net message to client' ela= 4 driver id=1952673792 #bytes=1 p3=0 obj#=67770 tim=1021139566166
    WAIT #140638236435256: nam='SQL*Net message from client' ela= 49792 driver id=1952673792 #bytes=1 p3=0 obj#=67770 tim=1021139615990
    CLOSE #140638236435256:c=0,e=4,dep=0,type=0,tim=1021139616056

    Reference: Document: 1566018.1 High Waits for 'library cache lock' and 'library cache: mutex X' Due to Parse Failures When Using JDBC ResultSet.TYPE_SCROLL_SENSITIVE.

    SolutionAs a workaround for the SELECT * limitation, use table aliases.
    For example, the query used by the application is:
    String sql = "select * from <TABLE_NAME> where <COLUMN_NAME>=?";

    Use a table alias , like:


    String sql = "select * from <TABLE_NAME> t where t.<COLUMN_NAME>=?";

    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    运维联盟俱乐部 ( 冀ICP备19036648号 )

    GMT+8, 2024-5-17 18:28 , Processed in 0.053662 second(s), 21 queries , Gzip On.

    Powered by Discuz! X3.4

    © 2001-2023 Discuz! Team.

    快速回复 返回顶部 返回列表