ORA-00923 ORACLE ERROR
本文关键字:ERROR ORACLE ORA-00923 | 更新日期: 2023-09-27 18:05:02
INSERT INTO FCR.TRANSACTION (TRX_UNIT, TRX_DATE, TRX_USR,
TRX_USR_SN, TRANSACTION_CODE,
PRODUCT_CODE, CURRENCY_SHORT_DESCRIPTION,
AMOUNT_FC, EXCHANGE_RATE, AMOUNT_DC)
SELECT SOURCE_SYSTEM_CHANNEL_CODE, to_char(TRANSACTION_DATE), 'dd/mm/yyyy'),
USER_CODE, USER_TRANSACTION_SERIAL_NUMBER, TRANSACTION_CODE,
PROFITS_PRODUCT_CODE, SHORT_DESCRIPTION, SOURCE_AMOUNT_FC,
SOURCE_EXCHANGE_RATE, SOURCE_AMOUNT_EUR
FROM FCR.ORION_FCR_TRANSACTION
WHERE TRANSACTION_DATE = 'to_char(" + date + ", 'dd/mm/yyyy')'
上面的查询是给我ORA-00923 ERROR. FROM KEYWORD NOT FOUND IN POSITION.
谁能帮我解决上面的问题?
我认为这个错误与我的c#代码中的行有关:
WHERE TRANSACTION_DATE = 'to_char(" + date + ", 'dd/mm/yyyy')'
这是因为TRANSACTION_DATE后面的右括号。
事实上,你把to_char放在一个字符串的WHERE中也没有帮助。:)
我不确定,但如果你使用一点缩进可能会有所帮助。如果你的查询以一种更易读的方式列出,就会更容易发现这样的错别字。
INSERT INTO FCR.TRANSACTION (
TRX_UNIT,
TRX_DATE,
TRX_USR,
TRX_USR_SN,
TRANSACTION_CODE,
PRODUCT_CODE,
CURRENCY_SHORT_DESCRIPTION,
AMOUNT_FC,
EXCHANGE_RATE,
AMOUNT_DC)
SELECT
SOURCE_SYSTEM_CHANNEL_CODE,
to_char(TRANSACTION_DATE), 'dd/mm/yyyy'),
USER_CODE,
USER_TRANSACTION_SERIAL_NUMBER,
TRANSACTION_CODE,
PROFITS_PRODUCT_CODE,
SHORT_DESCRIPTION,
SOURCE_AMOUNT_FC,
SOURCE_EXCHANGE_RATE,
SOURCE_AMOUNT_EUR
FROM
FCR.ORION_FCR_TRANSACTION
WHERE
TRANSACTION_DATE = 'to_char(" + date + ", 'dd/mm/yyyy')'
我猜是这样的:
to_char(TRANSACTION_DATE), 'dd/mm/yyyy'),
应该是这样的:
to_char(TRANSACTION_DATE, 'dd/mm/yyyy'),
:
WHERE TRANSACTION_DATE = 'to_char(" + date + ", 'dd/mm/yyyy')'
应该是这样的:
WHERE TRANSACTION_DATE = to_char(date, 'dd/mm/yyyy')'
格式化后,使它更清晰,看起来你已经在选择部分添加了a)
有SELECT SOURCE_SYSTEM_CHANNEL_CODE, to_char(TRANSACTION_DATE), 'dd/mm/yyyy'),
我想你在TRANSACTION_DATE之后为to_char添加了一个额外的结束括号它可能是
SELECT SOURCE_SYSTEM_CHANNEL_CODE, to_char(TRANSACTION_DATE, 'dd/mm/yyyy'),
它有助于清晰地格式化代码,并使用匹配括号的编辑器。