473,385 Members | 1,647 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,385 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 1578

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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.