jdbc single quote problem ( how to escape)

Posted on 2004-11-09
Last Modified: 2008-01-09
Hi ,
I have a Store Precodure wich takes a varchar input parameters .
I am passing a String like   '20' enquoted in the double quotes like this.
exec sp_GetSearchedDeals @Country = " '09' " .
This Statement works from the DB ( I am using Rapid SQL) . But in my java Program it gives a exception like this

ERROR:com.sybase.jdbc2.jdbc.SybSQLException: Invalid column name ''09''.
I have to pass the single quotes in my String ( the varchar I am passing to the Store Procedure ) . How can i escape the single quotes inside the varchar data i am passing ?
Any help will be greatly appreciated..
Question by:moonoo
    1 Comment
    LVL 24

    Accepted Solution

    You can indicate nested quotes with a part of quotes for the inner set, i.e.

    exec sp_GetSearchedDeals @Country = '''09'''

    (that's 3 single quotes).

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    Suggested Solutions

    Great sound, comfort and fit, excellent build quality, versatility, compatibility. These are just some of the many reasons for choosing a headset from Sennheiser.
    In the modern office, employees tend to move around the workplace a lot more freely. Conferences, collaborative groups, flexible seating and working from home require a new level of mobility. Technology has not only changed the behavior and the expe…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now