你好,我在oracle数据库中的sql查询出错。上面写着“ORA-00906:缺少左括号”
下面是我的SQL语句:
insert into UBTB_ACCOUNTTRANSLIMIT(
UBACCTTRANSLIMITID,
UBACCOUNTID,
UBTRANSACTIONGROUPID,
UBISACTIVE,
UBEXPOSUREAMOUNT,
UBEXPOSURECOUNT,
UBEXPOSUREREVIEWFREQ,
UBTRANSACTIONLIMITCOUNT,
UBTRANSACTIONLIMITAMT,
UBLIMITEXCESSACTION,
UBLASTREVIEWDATE,
UBTRANSACTIONLIMITYPE,
UBTRANSACTIONLIMITID,
UBREVIEWMONTH,
UBREVIEWDAY,
VERSIONNUM
)
SELECT UBACCTTRANSLIMITID,
ACCOUNTID,
UBTRANSACTIONGROUPID,
UBISACTIVE,
UBEXPOSUREAMOUNT,
UBEXPOSURECOUNT,
UBEXPOSUREREVIEWFREQ,
UBTRANSACTIONLIMITCOUNT,
UBTRANSACTIONLIMITAMT,
UBLIMITEXCESSACTION,
UBLASTREVIEWDATE,
UBTRANSACTIONLIMITYPE,
UBTRANSACTIONLIMITID,
UBREVIEWMONTH,
UBREVIEWDAY,
VERSIONNUM
FROM (
SELECT UB_CONCAT(
'20230503184525443',
cast(ROW_NUMBER() OVER (ORDER BY ACCOUNTID) as varchar)
) as UBACCTTRANSLIMITID,
ACCOUNTID,
'Y' AS UBEXPOSUREREVIEWFREQ,
0 AS UBLIMITEXCESSACTION,
'0' AS UBTRANSACTIONLIMITYPE,
'TRANSGROUP1' AS UBTRANSACTIONGROUPID,
1000.000000 AS UBTRANSACTIONLIMITAMT,
0 AS UBTRANSACTIONLIMITCOUNT,
'LIMITJPY1' AS UBTRANSACTIONLIMITID,
'Y' AS UBISACTIVE,
{d '2023-05-03'} AS UBLASTREVIEWDATE,
0 AS UBEXPOSUREAMOUNT,
0 AS UBEXPOSURECOUNT,
'01' AS UBREVIEWMONTH,
'3' AS UBREVIEWDAY,
0 AS VERSIONNUM
FROM ACCOUNT
WHERE PRODUCTCONTEXTCODE = ?
) VALUELIST
我期待什么可能是错误的原因我的sql语句似乎罚款
2条答案
按热度按时间46qrfjad1#
这是错误的:
在Oracle中,使用日期文字:
其他值看起来不可疑,所以-尝试使用它,并说如果它仍然不工作,但然后提供一些更多的信息(和测试用例)。
wko9yo5t2#
可以使用
||
运算符代替UB_CONCAT
(除非UB_CONCAT
是用户定义的函数),使用CAST
和日期文字代替{d '2023-05-03'}
。您也不需要使用子查询(可以在SELECT
查询中删除AS column_alias
,因为它们是不必要的,但可以保留它们以帮助记录代码):