How to insert data that contain single quotes into NCLOB column?(From DBMR1711)

~ 0 min
2016-03-07 10:07

The NCLOB data type is a variable length data type that can contain any Unicode character.When entering NCLOB data, it needs to enclose the Unicode character with single quotes and prefix the quotes with 'N'.

So if the NCLOB data you want to enter contains single quotes ('), it needs use the escape character.  In DBMaker, the escape character is single quotes ('). I.e. add another single quote before the single quotes in the data, then that will be ok.

For example:

dmSQL> def table tta;

create table SYSADM.TTA (

 C1  NCLOB default null )

 in DEFTABLESPACE  lock mode page  fillfactor 100 ;

Entering the 'a'b' to NCLOB column:

dmSQL> insert into tta values(N'a''b');

1 rows inserted

dmSQL> select * from tta;

C1

========================

610027006200

1 rows selected

dmSQL> select cast(c1 as char(40))from tta;

CAST(C1 AS CHAR(40))

========================

a'b

1 rows selected

Average rating 0 (0 Votes)

You cannot comment on this entry

Tags