Re: escaping those darn ' in a package/procedure

From: D Rolfe <dwrolfeFRUITBAT_at_orindasoft.com>
Date: Tue, 08 Jun 2004 21:32:01 +0100
Message-ID: <40C62241.4070906_at_orindasoft.com>


Robert,

> this block is from a (successful) implementation of FGAC. that is
> a good thing.
>
> IF l_context <> 'FOOBAR' THEN
> retval := 'user_id = '' ' || USER || '''';
> ELSE
> retval := '1 = 1';
> END IF;
>
> now, they want this:
>
> IF l_context <> 'FOOBAR' THEN
> retval := 'user_id like '' ' || USER || % '''';

          retval := 'user_id like '' ' || USER || ' % ''';

You do realise that there are leading and trailing spaces on either side of USER?

For example:

SQL> r

   1 select
   2 'user_id like '' ' || USER || ' % '''    3* from dual

'USER_IDLIKE'''||USER||'%'''



user_id like ' SCOTT % '

> ELSE
> retval := '1 = 1';
> END IF;
>

David Rolfe
Orinda Software
Dublin, Ireland Received on Tue Jun 08 2004 - 22:32:01 CEST

Original text of this message