Home >Database >Mysql Tutorial >How to Properly Handle Single Quotes in Oracle SQL Inserts?
Handling single quotes in Oracle SQL
When inserting varchar column records containing single quotes, special care must be taken to ensure accuracy.
To insert a single quote into a column, double it. For example, if you want to insert "D'COSTA" as a last name:
<code class="language-sql">SQL> SELECT 'D''COSTA' name FROM DUAL; NAME ------- D'COSTA</code>
An alternative is to use the newer (10g) quoting method:
<code class="language-sql">SQL> SELECT q'$D'COSTA$' NAME FROM DUAL; NAME ------- D'COSTA</code>
The above is the detailed content of How to Properly Handle Single Quotes in Oracle SQL Inserts?. For more information, please follow other related articles on the PHP Chinese website!