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

Home -> Community -> Usenet -> c.d.o.misc -> Re: simple PL/SQL syntax question.

Re: simple PL/SQL syntax question.

From: Steven Jelfs <S.Jelfs_at_btinternet.com>
Date: 1997/12/24
Message-ID: <67rjl7$6cj$1@plutonium.btinternet.com>#1/1

Rich Davies wrote in message
<01bd0f02$0030eec0$af01010a_at_msppc060.retek.com>...
>Can someone explain why this works, please?
>
>I want to set the value of one local string variable in PL/SQl to:
>
> USER_ID = 'another_local_string'
>
>including the single ticks. Through trial and error I've found the
>following assignment statement works.
>
>a_local_string := 'USER_ID = ''' || another_local_string || '''' ;
>
>In case this is hard to read with your typeface, that is: one single tick
>at the beginning, three single ticks in the middle, and four single ticks
>at the end.
>
>Does this make sense to anyone? If so please enlighten me. Thanks in
>advance.
>--
>richard_davies_at_retek.com

Perfectly,

the first 'tick' identifies it a a string, in order to insert a ' you need to put them twice i.e. ''. The third ' in the group closes the string variable and || concatanates the following variable to it, this is then itself concatented to, the first ' in the group of four opens the string variable, the following two ('') inserts a ' and the final ' closes the string.

QED Steve Jelfs Received on Wed Dec 24 1997 - 00:00:00 CST

Original text of this message

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