This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hello, I am writing a Java program which needs to insert names, which may contain commas, single quotes (') and so on. Currently I have a line which states as follows: "INSERT INTO TBNAMES VALUS ('clientNumber', 'name');" It is throwing an error when the name contains a single quote (ORA-00917 : missing comma) Then I changed the code as follows: "INSERT INTO TBNAMES VALUS (:clientNumber, :name);" Now it complains that not all variables defined (ORA-01008 : Not all variables defined). Can any one shead some light on this? Thanks Suresh
You'll have to create a method that will replace a single quote with two single quotes (escape sequence). ...OR make your life easier, and your code easier to read... use a PreparedStatement instead of statement. It takes care of the special characters(like single quotes) for you. No need for extra coding. Jamie [ January 25, 2002: Message edited by: Jamie Robertson ]