×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Ref Cursor query containing IN operator as parameter

Ref Cursor query containing IN operator as parameter

Ref Cursor query containing IN operator as parameter

(OP)
Hello,

I have a ref cursor report which works fine apart from one line of the query:

CODE

and    e.org_id in (:p_orgs)

After asking on the Oracle 8i forum I understand that this is not possible, and that I need to concatenate the bind variable with the rest of the query.
http://www.tek-tips.com/viewthread.cfm?qid=1395504&page=1 thanks to Dagon.

However after creating a varchar "l_query" to hold my query as a string (concatenated with my bind variables), when I try to open the ref cursor I get an error.

CODE

open temp_evdesc for l_query;

Error: Encountered the symbol "L_QUERY" when expecting one of the following:
Select

Is it not possible to do this?

I've also tried to use a function to produce my IN list rather than the bind variable, but that didn't work either:

CODE

and    e.org_id in (getOrgs(1))

I'm using reports 6i. Let me know if there's any other information that would be useful.

Many thanks in advance,
Hazel

RE: Ref Cursor query containing IN operator as parameter

(OP)
I managed to solve the problem using lexical parameters, replacing the statement

CODE

and    e.org_id in (:p_orgs)

with

CODE

&org

and passing the parameter &org as a string constructed using a function in my application.

So in the end I didn't need to use a ref cursor query.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close