swapnil chorghe
swapnil chorghe

Reputation: 159

missing comma error in oracle query

I am getting error while inserting a row in database.

Error: ORA-00917: missing comma

But there is no comma missing in my query. Below is the query:

INSERT INTO Customer (NEED_BY_DATE) VALUES('|| 'to_date('|| ''''|| v_in_need_by_date|| ''''|| ','|| ''''|| 'MM-DD-YYYY'|| ''''|| ')'|| ');

Upvotes: 3

Views: 636

Answers (1)

Nir Alfasi
Nir Alfasi

Reputation: 53565

The quotes and pipes before to_date: ... VALUES('|| 'to_date... shouldn't be there, || is used to concatenate strings and ' is not a string. Same thing goes on further.

I believe that you want something like:
INSERT INTO Customer (NEED_BY_DATE) VALUES(to_date(v_in_need_by_date));

Upvotes: 1

Related Questions