简体   繁体   中英

Additional information: ORA-00917: missing comma

I am kinda lost, I dont know what to try next.

com.CommandText =@"insert into TDESADV_H_T (spplr_mailbox,message_id,asn_no,TO_DATE('message_date', 'YYYY/MM/DD HH24:MI'))"
                    + " VALUES(:spplr_mailbox,:message_id,:asn_no,:message_date)";

It is definetly on the message date. The query recieves:

com.Parameters.AddWithValue("message_date", edi.MESSAGE_SEND_DATE);

which is: 2017/10/23 18:01. I am not sure what is wrong

TO_DATE('message_date', 'YYYY/MM/DD HH24:MI') in INSERT statement should be a column name rather. That's what it's complaining about

Your SQL syntax is off, and the insert should look something like this:

INSERT INTO TDESADV_H_T (spplr_mailbox, message_id, asn_no, message_date)
VALUES (:spplr_mailbox, :message_id, :asn_no, :message_date);

Regarding your call to TO_DATE , if that happens at all, it should be when you bind the parameter in your C# code. You should ideally be able to bind a C# type which the API can automatically marshall over to the message_date column, so that call to TO_DATE might not even be needed.

As @LasseVågsætherKarlsen navigated me. I was trying to use TO_DATE for column name. All I had to do was to use the function in values (). Thanks a lot guys.

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