Search code examples
sqloracle-databaseinsertparentheses

"ORA-00907: missing right parenthesis" during inserting into table


insert into eas_citizen_text_info
    values(690102355714,'male','Shailendra','Baliram','Torane',('1995-06-02','yyyy-mm-dd'),21,'Bauddha','Single','Building no-E9, Room no-23, Rajarshi Shahu Nagar,Mahim(East),Mumbai-17','Buildin no-E9, Room no-23','Rajarshi Shahu Nagar','Shahu Nagar Police Station','Mahim','Mumbai','Shahu Nagar','Mumbai',null,400017,'Maharashtra','Baliram Shankar Torane','Sandhya Baliram Torane',null,'shailendra123456789'
    )

Solution

  • ('1995-06-02','yyyy-mm-dd')
    

    should be

    TO_DATE('1995-06-02','yyyy-mm-dd')
    

    You are not entering a date, you are entering a VARCHAR2 enclosed in parentheses which Oracle doesn't seem to handle.

    The VARCHAR2 alone might work and get implicitly converted to DATE if your session is configured correctly. It is better to not rely on this kind of configuration and do the conversion explicitly using the TO_DATE function.