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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: How to pass string with a ' to PL/SQL

RE: How to pass string with a ' to PL/SQL

From: Jacques Kilchoer <Jacques.Kilchoer_at_quest.com>
Date: Tue, 10 Jun 2003 12:58:46 -0700
Message-ID: <F001.005AE8FA.20030610123954@fatcity.com>


I'm curious why I often see an extra string concatenation operation for putting a single-quote in a string. Is it for readability? Why not

   :b := 'and sub_account_no=''864240103''' ;

Note - there are no double quote characters in the string above, only single quote characters. Two single quotes inside a string become one single quote. e.g. try this

SQL> set serveroutput on
SQL> begin

  2     dbms_output.put_line ('WINNER TONY AWARD FOR BEST REVIVAL OF A PLAY') ;
  3     dbms_output.put_line ('Eugene O''Neill''s "Long Day''s Journey Into Night"') ;
  4 end ;
  5 /
WINNER TONY AWARD FOR BEST REVIVAL OF A PLAY Eugene O'Neill's "Long Day's Journey Into Night"

-----Original Message-----

try it this way:

   :b :='and sub_account_no=' || '''' || '864240103' || '''';

remember - 4 quotes gets you one.
--

Please see the official ORACLE-L FAQ: http://www.orafaq.net
--

Author: Jacques Kilchoer
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Tue Jun 10 2003 - 14:58:46 CDT

Original text of this message

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