Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Escape character inside a select

Re: Escape character inside a select

From: Kevin Michael Vail <kevin_at_vailstar.com>
Date: Sun, 5 Sep 1999 00:03:04 -0400
Message-ID: <1dxmstw.1eblb8alitz6oN@[192.168.0.4]>


<screwbai_at_my-deja.com> wrote:

> I am making an "sql from and sql" and need to "reproduce" the single
> quotation mark: '. Like this.
>
> I put SET ESCAPE ON or SET ESCAPE \ before I do the select. Then the
> select statement:
>
> select 'select \'Fred is \' || age from test2 ' from test1;
>
> The hard workaround to this is to use double quotes " instead of single
> '. And then do a searh and replease from the file that I spool this sql
> statement to. Trying to avoid that. Using Oracle release 7.3
>
> Any ideas?

select 'select ''Fred is '' || age from test2 ' from test1;

In other words, use two single quotes (not a double quote!) to represent a quote inside a quoted string.
--
Kevin Michael Vail | I would rather have a mind opened by wonder kevin_at_vailstar.com | than one closed by belief. -- Gerry Spence Received on Sat Sep 04 1999 - 23:03:04 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US