Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ORA-01756 with 10g's "q" String Literal Syntax

273435May 7 2007 — edited May 7 2007
OK, this one's got me confused.

In 10g, you're supposed to be able to get around the awkward doubling up of single quotes within string literals by defining your own delimiter.

This works when my string literal has two single quotes in it, but not when I have just one! Can someone please explain this to me?

scott@XE_10g> SELECT banner FROM v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production

scott@XE_10g> VARIABLE x VARCHAR2(80);
scott@XE_10g> EXEC :x := q'!I've got an idea; let's use two single quotes.!';

PL/SQL procedure successfully completed.

scott@XE_10g> EXEC :x := q'!Now, we'll use just one.!';
ERROR:
ORA-01756: quoted string not properly terminated


scott@XE_10g>

Is this a bug?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 4 2007
Added on May 7 2007
5 comments
820 views