SQL handle Punctuation?
Posted on 2004-10-15
I have a question about handling punctuation in SQL..
I want the SQL to be able to handle phrases such as "Dean's List" (including the apostrophe).
My current sql string is:
sql = new String("select distinct DIVISION_NAME from people_db.V_DEPARTMENT where DEPARTMENT_NAME="' + someDeptString()"' and
sql = sql +"order by DIVISION_NAME";
I keep getting this error:
EvaluateExpression failed: <com.webobjects.jdbcadaptor.OraclePlugIn$OracleExpression: "select distinct DIVISION_NAME from people_db.V_DEPARTMENT where DEPARTMENT_NAME= 'Dean's Office' and INSTITUTION_LABEL= 'HR' ">: Next exception:SQL State:42000 -- error code: 933 -- msg: ORA-00933: SQL command not properly ended
How can I handle the apostrophes properly?
Any advice or guidance would be greatly appreciated!