472,805 Members | 3,850 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,805 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 1557

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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.