473,395 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

escaping those darn ' in a package/procedure

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 || % '''';
ELSE
retval := '1 = 1';
END IF;

but i can't figure out (and the error msgs don't help much) how
to balance the % and the 's to get it to parse. help?

i submit it from SQL*Plus, 8.1.7.

thanks,
robert
Jul 19 '05 #1
1 1579

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

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: bobbyballgame | last post by:
I am having a problem calling Stored Procedures: .... dim MyValue, MyOtherValue MyValue = "Bobby's value" MyOtherValue = Bobby's other value" rs.Open "exec MyStoredProc """ & MyValue &...
4
by: Mike | last post by:
Hello, I'm currently working on debugging a very large DTS package that was created by someone else for the purpose of importing data into my company's database. The data is mainly...
7
by: anilcool | last post by:
Hi all. I am running a stored procedure in a loop -- this Stored procedure inserts one record at a time. After inserting about 1326 records, my thread crashes and I get the following error:...
2
by: mivey4 | last post by:
Hi, I am not new to Oracle but I am new to creating packages. Trying to convert to Oracle from MSSQL and getting my feet wet I have created the following package that has 1 procedure in it. No...
0
debasisdas
by: debasisdas | last post by:
PACKAGE WITH LOCAL FUNCTION ============================= create or replace package my_pkg as procedure my_proc(arg1 in varchar2); function my_fun(arg1 in number) return varchar2; end my_pkg;...
2
AdusumalliGopikumar
by: AdusumalliGopikumar | last post by:
Procedure also stored in database and package also stored in a database, we can call the procedure to do the task , and same one using package.procedure name if it exists in that package. ...
0
debasisdas
by: debasisdas | last post by:
The following thread contains some useful tips/sample codes regarding PACKAGES in oracle, that the forum members may find useful. A package is a collection of procedures,functions,cursors,global...
0
debasisdas
by: debasisdas | last post by:
SAMPLE PACKAGE EX#3 ==================== PACKAGE SPECIFICATION -------------------------------------------- CREATE OR REPLACE PACKAGE MYPACK AS PROCEDURE SHOWENAME(EMPID IN NUMBER); FUNCTION...
0
debasisdas
by: debasisdas | last post by:
USE OF REF-CURSOR IN THE PACKAGE ================================ PACKAGE ----------------- create or replace package pack1 as type mycur is ref cursor; end;
3
by: ramorac | last post by:
hi all i am a new member to this forum.i am tryin to call a package from an anonymous pl/sql block(say a wrapper).the package is like(IS SPECIFIC TO OUR APPLICATION). create or replace...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.