Q
Problem solve Get help with specific problems with your technologies, process and projects.

Inserting an apostrophe in PL/SQL

In PL/SQL, I cannot insert an apostrophe and I cannot retrieve data with apostrophes. If I select these columns it gives me the error "Quoted string not properly terminated." How can I correct this?

In PL/SQL, I cannot insert an apostrophe and I cannot retrieve data with apostrophes. If I select these columns it gives me the error "Quoted string not properly terminated." How can I correct this? Thank you.
To handle a sinqle quote in SQL or PL/SQL, you will need to escape it, as SQL and PL/SQL use the single quote as a string terminator. Use another single quote to escape the single quote. For instance, in PL/SQL, to assign a string to a variable with a single quote in the string, you might use something similar to the following:

my_var:='This isn''t the string you''re looking for';

Notice how there are consecutive single quotes for the word "isn't" and "don't". Without these, you will get the error you have received.

Dig Deeper on Oracle database design and architecture

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide.com

SearchDataCenter

SearchContentManagement

SearchHRSoftware

Close