RE: How does one escape special characters

  • From: "Roger Xu" <roger_xu@xxxxxxxxxxx>
  • To: "Mladen Gogala" <mgogala@xxxxxxxxxxxxxxxxxxxx>
  • Date: Tue, 25 Jan 2005 12:43:10 -0600

Thanks.

Could=20you=20tell=20me=20what=20is=20wrong=20with=20the=20following=20sta=
tements?

SQL>=20l
=20=201=20=20declare
=20=202=20=20cmd=20varchar2(128);
=20=203=20=20begin
=20=204=20=20=20=20cmd:=3D'SELECT=20id=20FROM=20emp=20WHERE=20name=20=3D=20=
''ROGER=20XU'';';
=20=205=20=20=20=20dbms_output.put_line(cmd);
=20=206=20=20=20=20execute=20immediate=20cmd;
=20=207*=20end;
SQL>=20/
SELECT=20id=20FROM=20emp=20WHERE=20name=20=3D=20'ROGER=20XU';
declare
*
ERROR=20at=20line=201:
ORA-00911:=20invalid=20character
ORA-06512:=20at=20line=206


SQL>
-----Original=20Message-----
From:=20Mladen=20Gogala=20[mailto:mgogala@xxxxxxxxxxxxxxxxxxxx]
Sent:=20Monday,=20January=2024,=202005=209:01=20PM
To:=20Roger=20Xu
Cc:=20Oracle-L@Freelists.=20Org=20(E-mail)
Subject:=20Re:=20How=20does=20one=20escape=20special=20characters


Roger=20Xu=20wrote:

>=20
>How=20do=20I=20do=20it=20if=20I=20want=20to=20build=20the=20SQL=20first=20=
in=20a=20variable=20for=20a=20PL/SQL=20statement?
>=20
>=20
>cmd:=3D'SELECT'=20||=20l_column=20||=20'FROM=20emp=20WHERE=20name=20LIKE=20=
'%=20O/'REAR'=20ESCAPE=20'/';
>=20=20
>
What=20are=20you=20to=20do=20with=20the=20forward=20slash?=20Slay=20the=20=
engine?=20Roger,=20the=20
RDBMS=20slayer?=20=20Here=20it=20is,=20right=20from=20the=20manual:

cmd:=3D'SELECT'=20||=20l_column=20||=20'FROM=20emp=20WHERE=20name=20LIKE=20=
'%=20O''REAR';=20

It's=20from=20the=20SQL=20reference,=20section=20called=20"text=20literals=
".


--=20
Mladen=20Gogala
Oracle=20DBA


For=20technical=20support=20please=20email=20tech_support@xxxxxxxxxxx=20or=
=20you=20can
call=20(972)721-8257.=20
This=20email=20has=20been=20scanned=20for=20all=20viruses=20by=20the=20Mes=
sageLabs=20Email=20Security=20System.

This=20e-mail=20is=20intended=20solely=20for=20the=20person=20or=20entity=20=
to=20which=20it=20is=20addressed=20and=20may=20contain=20confidential=20an=
d/or=20privileged=20information.=20Any=20review,=20dissemination,=20copyin=
g,=20printing=20or=20other=20use=20of=20this=20e-mail=20by=20persons=20or=20=
entities=20other=20than=20the=20addressee=20is=20prohibited.=20If=20you=20=
have=20received=20this=20e-mail=20in=20error,=20please=20contact=20the=20s=
ender=20immediately=20and=20delete=20the=20material.=20
____________________________________________________________________
This=20email=20has=20been=20scanned=20for=20all=20viruses=20by=20the=20Mes=
sageLabs=20Email=20Security=20System.=20Any=20questions=20please=20call=20=
972-721-8257=20or=20email=20your=20request=20to=20tech_support@xxxxxxxxxxx=
.
--
//www.freelists.org/webpage/oracle-l

Other related posts: