How to Embed Single Quotation Marks in a PL/SQL String
The single quote character indicates the start or termination of an Oracle PL-SQL string. For this reason, you must add two single quotes to an Oracle string to indicate to the database engine that you want to insert a quote into the database. The process also avoids syntax errors that occur when you use single quotes incorrectly in your Oracle strings.
Instructions
-
-
1
Click the Windows "Start" button and select "All Programs." Click "Oracle," then click "Enterprise Manager" to open the SQL editor.
-
2
Log in to your Oracle server. After the software logs in to the database, open the PL-SQL editor to create the Oracle string.
-
-
3
Create the PL-SQL variable. The following code creates the Oracle string variable:
myvar varchar(50)
-
4
Assign a string with a single quote value to the variable. The following code shows you how to assign the literal single quote without causing syntax errors:
set myvar = 'O''Leery';
-
1