You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

执行SQL更新语句时遇Command not ended properly错误求助

排查Oracle SQL更新语句的'Command not ended properly'错误
  • 直接原因:非法的引号字符
    你SQL语句里的日期值’07-SEP-22’和条件值‘STANDARD’使用了中文全角单引号,Oracle数据库仅支持英文半角单引号'作为字符串/日期的边界符,全角引号会导致语法解析中断,触发"Command not ended properly"错误。

修正后的SQL语句

update fare_strategy set sales_date_to = '07-SEP-22' 
  where dep_date_to is not null 
  and market_id in 
   (select market_id 
     from fare_strategy_markets 
     where set_type = 'STANDARD'
   );

额外建议:避免日期格式问题

如果数据库的NLS_DATE_FORMAT参数和'07-SEP-22'格式不匹配,可能会触发日期转换错误,建议用显式转换函数确保兼容性:

update fare_strategy set sales_date_to = TO_DATE('07-SEP-22', 'DD-MON-RR') 
  where dep_date_to is not null 
  and market_id in 
   (select market_id 
     from fare_strategy_markets 
     where set_type = 'STANDARD'
   );

内容的提问来源于stack exchange,提问作者Aakash Gupta

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.20 19:48:23