简体   繁体   中英

ORA-00923 ORACLE ERROR

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')'

The above query is giving me ORA-00923 ERROR. FROM KEYWORD NOT FOUND IN POSITION. ORA-00923 ERROR. FROM KEYWORD NOT FOUND IN POSITION.

Can anyone please help me to solve the above problem.

I think that the error has something to do with the line in my C# code:

WHERE TRANSACTION_DATE = 'to_char(" + date + ", 'dd/mm/yyyy')'

It's because of the closing parentheses after TRANSACTION_DATE.

And the fact that you put the to_char in the WHERE within a string doesn't help either. :)

I'm not sure, but it might help if you use just a little indentations. It will be easier to spot typo's like this if your query is outlined in a more readable fashion.

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')'

I'm guessing this:

to_char(TRANSACTION_DATE), 'dd/mm/yyyy'), 

should be this:

to_char(TRANSACTION_DATE, 'dd/mm/yyyy'), 

and this:

WHERE TRANSACTION_DATE = 'to_char(" + date + ", 'dd/mm/yyyy')'

should be this:

WHERE TRANSACTION_DATE = to_char(date, 'dd/mm/yyyy')'

After formatting to make it clearer it appears that you have added a ) in he select part

You have SELECT SOURCE_SYSTEM_CHANNEL_CODE, to_char(TRANSACTION_DATE), 'dd/mm/yyyy'),

I think you have added an extra end bracket for the to_char after TRANSACTION_DATE it might be

SELECT SOURCE_SYSTEM_CHANNEL_CODE, to_char(TRANSACTION_DATE, 'dd/mm/yyyy'),

It helps to format code clearly and to use an editor that matches brackets.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM