Possible Duplicate:
How to handle a single quote in Oracle SQL
My Senario:
I want to save the query(not result set) in the database.
I am using Java as the front end;
My Table(Querytab) has the following Fields:
sno VARCHAR2(1024)
QUERY VARCHAR2(4000)
The problem is when I insert a query which has conditions
e.g insert into querytab values('100','select * from querytab where sno ='100'');
ERROR at line 1:
ORA-00933: SQL command not properly ended
Problem is: The Queryvalue gets terminated when it finds the '
How to solve this.
Thanks in advance.
Use
PreparedStatementto escape the string.Something like this: