473,396 Members | 1,678 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,396 software developers and data experts.

Problems with "IN"

Can someeone help! This works:

SELECT * FROM sometable
WHERE 1 IN (1, 2, 3) ;

But if I want something like this:

s_mylist VARCHAR2(20) := '1, 2, 3';

SELECT * FROM sometable
WHERE 1 IN ( s_mylist ) ;

It doesn't work. Can't I do this?

Thanks
Lisa
Jul 19 '05 #1
4 2389

You can allways ask tom at:

http://asktom.oracle.com/pls/ask/f?p...950_P8_DISPLA-
YID,F4950_P8_CRITERIA:110612348061,
--
Posted via http://dbforums.com
Jul 19 '05 #2
"Lisa S." <lj******@vac-acc.gc.ca> wrote in message
news:ba**************************@posting.google.c om...
Can someeone help! This works:

SELECT * FROM sometable
WHERE 1 IN (1, 2, 3) ;

But if I want something like this:

s_mylist VARCHAR2(20) := '1, 2, 3';

SELECT * FROM sometable
WHERE 1 IN ( s_mylist ) ;

It doesn't work. Can't I do this?

Thanks
Lisa


It does not work because s_mylist is one thing the string '1, 2, 3' instead
of
where 1 in (1,2,3)
Also you are comparing numbers and strings - not good. compare numbers and
numbers.
Jim
Jul 19 '05 #3
"Jim Kennedy" <kennedy-down_with_spammers@no_spam.comcast.net> wrote in message news:<WKmjb.782313$Ho3.208508@sccrnsc03>...
"Lisa S." <lj******@vac-acc.gc.ca> wrote in message
news:ba**************************@posting.google.c om...
Can someeone help! This works:

SELECT * FROM sometable
WHERE 1 IN (1, 2, 3) ;

But if I want something like this:

s_mylist VARCHAR2(20) := '1, 2, 3';

SELECT * FROM sometable
WHERE 1 IN ( s_mylist ) ;

It doesn't work. Can't I do this?

Thanks
Lisa


It does not work because s_mylist is one thing the string '1, 2, 3' instead
of
where 1 in (1,2,3)
Also you are comparing numbers and strings - not good. compare numbers and
numbers.
Jim


Hi Jim

Sorry, I guess I wasn't clear - What we are trying to do is to format
a string with the 'IN' items to check elsewhere and pass it into the
stored procedure. I guess my question is - can't I use a variable with
the 'IN' Operator ?
Thanks
Lisa
Jul 19 '05 #4

"Lisa S." <lj******@vac-acc.gc.ca> wrote in message
news:ba**************************@posting.google.c om...
"Jim Kennedy" <kennedy-down_with_spammers@no_spam.comcast.net> wrote in

message news:<WKmjb.782313$Ho3.208508@sccrnsc03>...
"Lisa S." <lj******@vac-acc.gc.ca> wrote in message
news:ba**************************@posting.google.c om...
Can someeone help! This works:

SELECT * FROM sometable
WHERE 1 IN (1, 2, 3) ;

But if I want something like this:

s_mylist VARCHAR2(20) := '1, 2, 3';

SELECT * FROM sometable
WHERE 1 IN ( s_mylist ) ;

It doesn't work. Can't I do this?

Thanks
Lisa


It does not work because s_mylist is one thing the string '1, 2, 3' instead of
where 1 in (1,2,3)
Also you are comparing numbers and strings - not good. compare numbers and numbers.
Jim


Hi Jim

Sorry, I guess I wasn't clear - What we are trying to do is to format
a string with the 'IN' items to check elsewhere and pass it into the
stored procedure. I guess my question is - can't I use a variable with
the 'IN' Operator ?
Thanks
Lisa

Not that way. go to asktom.oracle.com and do a search. You will find
something there that will help you.
Jim
Jul 19 '05 #5

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

Similar topics

5
by: Paul Miller | last post by:
We've run into minidom's inabilty to handle large (20+MB) XML files, and need a replacement that can handle it. Unfortunately, we're pretty dependent on a DOM, so a pulldom or SAX replacement is...
4
by: RK | last post by:
Hi, In my application, I need to copy data from an Excel file into a SQL table. The article related to this can be found at http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B306572 ...
17
by: black tractor | last post by:
HI there.. l was just wondering, if l place a "table" in the "editable region" of my template, will the text, graphics placed inside the this "table" MOVE BY ITSELF?? l mean, recently l had a...
4
by: Marcin Dobrucki | last post by:
I've been having some problems with a parse error that I can't figure out (PHP 4.3.11 on Solaris9). Sample code: <?php // getting strange parse errors on this class A { var $value; function...
2
by: John Baker | last post by:
Hi: I have two systems, one a W98 and the other XP Home. I have Access 2000 installed on both, and have run into a difference in the way the two behave. I have a table on which I wish to reset...
43
by: markryde | last post by:
Hello, I saw in some open source projects a use of "!!" in "C" code; for example: in some header file #define event_pending(v) \ (!!(v)->vcpu_info->evtchn_upcall_pending & \...
6
by: Chris Stankevitz | last post by:
At link time, MSVC determines some of my libraries are unused and doesn't link them into my exe. This undesirable feature causes problems when I employ the factory pattern. With the factory...
1
by: Electric Co. | last post by:
Hello, I have two questions: 1.) Could I create a custom server control in 2005 in order to leverage the CompositeControl base class and then use that control in 2003? (fingers crossed but...
9
by: Robbie Hatley | last post by:
Greetings, group. I just found a weird problem in a program where a variable declared in a {block} after a "case" keyword was being treated as having value 0 even though its actual value should...
4
by: fran7 | last post by:
Hi, from help in the javascript forum I found the error in some code but need help. This bit of code works perfectly, trouble is I am writing it to a javascript function so the height needs to be in...
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
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.