IBM Support

Inserting a Character String with an Apostrophe using SQL

Troubleshooting


Problem

This document explains how to insert a word that contains an apostrophe into a character field using SQL.

Resolving The Problem

How is a SQL statement coded to insert a character string that has an apostrophe in it?

The following shows how to insert an apostrophe using SQL:

INSERT INTO libname/filename VALUES('O''Hara')

This puts O'Hara in the first column in the file.

[{"Line of Business":{"code":"LOB68","label":"Power HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m0z0000001i4eAAA","label":"IBM i Db2-\u003ESQL Examples \/ DB Examples \/ Misc how to"}],"Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions","Type":"MASTER"}]

Historical Number

11790458

Document Information

More support for:
IBM i

Component:
IBM i Db2->SQL Examples / DB Examples / Misc how to

Software version:
All Versions

Operating system(s):
IBM i

Document number:
642671

Modified date:
05 December 2024

UID

nas8N1018365

Manage My Notification Subscriptions