Home > Database > Mysql Tutorial > How to Properly Handle Single Quotes in Oracle SQL Inserts?

How to Properly Handle Single Quotes in Oracle SQL Inserts?

Barbara Streisand
Release: 2025-01-16 19:06:12
Original
536 people have browsed it

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>
Copy after login

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>
Copy after login

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!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template