I am currently working on a script in Java to import a bunch of books from a lengthy plain text file to a database. I have all of the books parsed into book objects and am trying to write them to the database. However, I get a missing comma exception "ORA-00917: missing comma" on the Following String:
INSERT INTO THE_TABLE VALUES( 'Yes' , '50388,50389' , 'Humanities and Performing Arts' , 'Required' , 'Ember, Carol & Ember, Melvin' , 'Human Culture' , '2nd' , '2012' , 'Pearson' , 'This is for CRN's 4879 & 2486' , '9780205251438' , '50' , 'null' , 'null' , 'null' , 'Spring 2013' , 'ROTN 4270' , 'Required' , 'Ember, Carol & Ember, Melvin,' , 'Human Culture' , 'Pearson,' , '2nd' , 'Edition,' , '2012.' , 'null' , 'Not Applicable' , 'Not Applicable' , 'Not Applicable' , 'Spring 2013' , 'ANTH 270' , '50388,50389' , 'Humanities and Performing Arts' , 'Required' , 'This is for CRN's 15454 & 48456, 'Ember, Carol & Ember, Melvin,' , 'Human Culture' , 'Pearson,' , '2nd' , 'Edition,' , '2012.' , '9780205251438' , '50' , 'null' , 'null' , 'Not Applicable' , 'Not Applicable' , 'Not Applicable' , 'null' , 'null' , 'null' )
I cannot see where there is a comma missing. Could there be another reason for this exception?
解决方案
, 'This is for CRN's 15454 & 48456,
Right there.
Notice how you missed a tick after (48456). Probably because the (CRN's) part.
Also, I recommend using a record for ease of programming. Inserting values like that is just messy. :) Keep up the good work.