Account Options

  1. Sign in
Google Groups Home
« Groups Home
where JOB_ID IN (:JOB_ID)
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
probashi  
View profile  
 More options Sep 5 2006, 2:04 pm
Newsgroups: comp.databases.oracle.server
From: "probashi" <proba...@hotmail.com>
Date: 5 Sep 2006 11:04:34 -0700
Local: Tues, Sep 5 2006 2:04 pm
Subject: where JOB_ID IN (:JOB_ID)
Hi,

When I run q1 I get back 10 rows but when I run q2 (whit supplying
"'IT_PROG', 'FI_ACCOUNT'" in the parameter) I got zero records
back.

Can any body explain this!!!.

--q1:
select * from HR.EMPLOYEES where JOB_ID IN ('IT_PROG', 'FI_ACCOUNT')

--q2
select * from HR.EMPLOYEES where JOB_ID IN (:JOB_ID)

Thanks


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
DA Morgan  
View profile  
 More options Sep 5 2006, 2:28 pm
Newsgroups: comp.databases.oracle.server
From: DA Morgan <damor...@psoug.org>
Date: Tue, 05 Sep 2006 11:28:19 -0700
Local: Tues, Sep 5 2006 2:28 pm
Subject: Re: where JOB_ID IN (:JOB_ID)

Your second syntax is invalid. What Oracle will look for is a single
value in the column that looks like the full string including the
comma and the space.

If you want to use this type of construct you must cast the variable
as a table. See the example in Morgan's Library (www.psoug.org) under
CONDITIONS titled "COMPLEX IN DEMO."

Be forwarned that one part of the demo, duplicates what you did and
is intended to fail. The next example shows how to do it correctly.
--
Daniel Morgan
Puget Sound Oracle Users Group


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brian Peasland  
View profile  
 More options Sep 5 2006, 2:31 pm
Newsgroups: comp.databases.oracle.server
From: Brian Peasland <d...@nospam.peasland.net>
Date: Tue, 5 Sep 2006 18:31:14 GMT
Local: Tues, Sep 5 2006 2:31 pm
Subject: Re: where JOB_ID IN (:JOB_ID)

In Q2, ":JOB_ID" is a bind variable. This bind variable can only be used
to return one value in the IN clause. If you need two values in the IN
clause (as shown in Q1), then you need to have 2 bind variables, holding
the two different values you are searching for.

HTH,
Brian

--
===================================================================

Brian Peasland
d...@nospam.peasland.net
http://www.peasland.net

Remove the "nospam." from the email address to email me.

"I can give it to you cheap, quick, and good.
Now pick two out of the three" - Unknown


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
probashi  
View profile  
 More options Sep 5 2006, 4:50 pm
Newsgroups: comp.databases.oracle.server
From: "probashi" <proba...@hotmail.com>
Date: 5 Sep 2006 13:50:33 -0700
Local: Tues, Sep 5 2006 4:50 pm
Subject: Re: where JOB_ID IN (:JOB_ID)
Thanks for shedding some light on this issue.

So :JOB_ID was treated as one value not a comma separated values. (I
wish there was a support for touple)

I am getting this parameter from an application and the application may
select any number of values. Looks like JOB_ID IN (:JOB_ID) is not
going to work.

Since :JOB_ID is a single value, this might work too:

select * from HR.EMPLOYEES where instr(:JOB_ID,JOB_ID)>0

Thanks


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
DA Morgan  
View profile  
 More options Sep 5 2006, 8:21 pm
Newsgroups: comp.databases.oracle.server
From: DA Morgan <damor...@psoug.org>
Date: Tue, 05 Sep 2006 17:21:03 -0700
Local: Tues, Sep 5 2006 8:21 pm
Subject: Re: where JOB_ID IN (:JOB_ID)

probashi wrote:
> Thanks for shedding some light on this issue.

> So :JOB_ID was treated as one value not a comma separated values. (I
> wish there was a support for touple)

I posted information on how to do it. Did you miss my post?
--
Daniel Morgan
University of Washington
Puget Sound Oracle Users Group

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »