Re: Insert an apostrophe into a string?

From: Tan La <TLa_at_mtl.marconi.ca>
Date: 1996/07/12
Message-ID: <4s6hto$p2p_at_gateway.marconi.ca>#1/1


In article <4s65lv$712_at_frazier.uoknor.edu>, pdensmore_at_oklaosf.state.ok.us says...

In order to get an apostrophe ' in a string, you need two single quotes ''. because a single quote is used to begin and end the sting. Since your string is in the quotes, therefore you need 4 quotes.

example:

                 
     v_script := 'select tablespace_name.....where segment_name = '
                 || '''' v_tbl || '''';
                      

Tan.
>
>
>I am attempting to insert an ' into a string and can't seem to get
>the results I want. Here are the details:
>
>v_script := 'select tablespace_name from user_segments
>where segment_name = ' || v_tbl || ';';
>
>this results in:
>
>select tablespace_name from user_segments
>where segment_name = ITEM;
>
>If I try:
>v_script := 'select tablespace_name from user_segments
>where segment_name = ' || ''' v_tbl ''' || ';';
>
>this results in:
>
>select tablespace_name from user_segments
>where segment_name = ' v_tbl ';
>
>The first example evaluates the variable but no apostrophes, the
>second example gets apostrophes but does not evaluate the variable.
>
>The result I need is:
>
>select tablespace_name from user_segments
>where segment_name = 'ITEM';
>
>Any ideas? Thanks for any responses.
Received on Fri Jul 12 1996 - 00:00:00 CEST

Original text of this message