【发布时间】: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 数据库,它肯定会失败。