gpt4 book ai didi

sql - 选择语句抛出 "ORA-00907: missing right parenthesis"

转载 作者:搜寻专家 更新时间:2023-10-30 23:29:10 26 4
gpt4 key购买 nike

我对 Oracle 有点陌生,似乎无法运行下面的查询。

SELECT user_key AS oldKey,
(SELECT
user_key
FROM
user_mapping AS u
WHERE lower(u.username) = u.lower_username
AND lower(u.username) = lower(um.username)
) AS newKey,
um.username,
um.lower_username
FROM user_mapping AS um
WHERE user_key IN (SELECT user_key
FROM user_mapping
WHERE (lower(username) != lower_username))
OR (lower_username is null)

它抛出“ORA-00907:缺少右括号”错误,但我没有看到任何语法错误,当我针对 MySQL 数据库运行查询时,查询工作正常。

正在检查与缺少括号相关的其他一些问题,但主要是关于未明确说明主键或将某些内容指定为非空,但我认为这似乎也不是这里的问题。

如果我在上面的任何地方遗漏或错误,请告诉我。

谢谢。

最佳答案

您在第 14 行有一个额外的 ) 而您在末尾(即第 15 行之后)缺少了一个 )

我已经解决了这两个问题。尝试以下操作

SELECT user_key AS oldKey,
(SELECT
user_key
FROM
user_mapping AS u
WHERE lower(u.username) = u.lower_username
AND lower(u.username) = lower(um.username)
) AS newKey,
um.username,
um.lower_username
FROM user_mapping AS um
WHERE user_key IN ( SELECT user_key
FROM user_mapping
WHERE (lower(username) != lower_username)
OR (lower_username is null)
)

关于sql - 选择语句抛出 "ORA-00907: missing right parenthesis",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51703295/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com