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:
SQL> SELECT 'D''COSTA' name FROM DUAL; NAME ------- D'COSTA
An alternative is to use the newer (10g) quoting method:
SQL> SELECT q'$D'COSTA$' NAME FROM DUAL; NAME ------- D'COSTA
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!