【问题标题】:SQL Error [909] [42000]: ORA-00909: invalid number of arguments [duplicate]SQL 错误 [909] [42000]:ORA-00909:参数数量无效 [重复]
【发布时间】:2021-06-10 12:50:40
【问题描述】:

我正在尝试将报告从 postgreSQL 数据库检索到 Oracle 数据库,但它并没有像我想象的那样工作。我试图在Oracle数据库中找到相关的表,发现它们是SOR表,一些数据在Datamarts中。

SQL 错误 [909] [42000]:ORA-00909:参数数量无效

在 postgreSQL 中运行良好的 SQL 语句:

`SELECT
    'loan' as product, 
   count(cc.id), 
   cc."type", 
   cc.topic, 
   cc.direction, 
   TRIM(cc.subject) AS subject,
   case when EXISTS (SELECT caf.communication_id
    FROM serp_bigmoney_lv.comm_attachment_files caf where cc.id = caf.communication_id) then 
'yes' 
    else 'no' end as file_attached, 
   concat(us."name",' ',us.surname) as user_name, 
   cc.createdat::date
from erp_bigmoney_lv.comm_communication cc
left join erp_bigmoney_lv.erp_users us on us.user_id = cc.created_by
where cc."type" = 'note' 
GROUP BY cc.createdat::date, user_name, file_attached, cc.direction, cc.topic, cc."type", 
product, cc.subject`

【问题讨论】:

  • 认为 Oracle 的 concat 只需要 2 个参数。我会尝试us."name" || ' ' || us.surname,ANSI SQL 方式!
  • 这是什么'::date'? Oracle 没有这样的语法。如果您将其发送到 Oracle 数据库,它肯定会失败。

标签: sql oracle


【解决方案1】:

CONCAT 函数只接受两个参数使用 ||连接如下字段:

FIELD_1 || ‘ ‘ || FIELD_2

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-01-02
    • 2018-12-04
    • 1970-01-01
    • 2018-03-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多