473,782 Members | 2,513 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2412

You can allways ask tom at:

http://asktom.oracle.com/pls/ask/f?p...950_P8_DISPLA-
YID,F4950_P8_CR ITERIA:11061234 8061,
--
Posted via http://dbforums.com
Jul 19 '05 #2
"Lisa S." <lj******@vac-acc.gc.ca> wrote in message
news:ba******** *************** ***@posting.goo gle.com...
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_spamm ers@no_spam.com cast.net> wrote in message news:<WKmjb.782 313$Ho3.208508@ sccrnsc03>...
"Lisa S." <lj******@vac-acc.gc.ca> wrote in message
news:ba******** *************** ***@posting.goo gle.com...
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.goo gle.com...
"Jim Kennedy" <kennedy-down_with_spamm ers@no_spam.com cast.net> wrote in

message news:<WKmjb.782 313$Ho3.208508@ sccrnsc03>...
"Lisa S." <lj******@vac-acc.gc.ca> wrote in message
news:ba******** *************** ***@posting.goo gle.com...
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.c om 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
2517
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 likely out of the question for now. Has someone done a more efficient minidom replacement module that we can just drop in? Preferrably written in C?
4
11313
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 Using this,I am first extracting data from given excel file into a temporary DataTable. After making some operations on that DataTable (like splitting one column into two), I am saving the data into actual
17
3890
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 "table" insert in my "editable region", have it placed in the "center" of the page.. while it display correctly on my browser, with setting at 1024x768 (IE6),
4
2684
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 A() { $this->value = 1; }
2
1974
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 an "auto number" field so the counter goes back to zero. The procedure I have used is to copy the contents of the table to a temp table, empty the table and then compress the files. After that I copy back the data to the table without the...
43
2753
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 & \ !(v)->vcpu_info->evtchn_upcall_mask) whereas evtchn_upcall_pending is of type unsigned char (and also evtchn_upcall_mask is of type unsigned char).
6
2581
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 pattern, the app decides at run time which code to use. Is there a link option to turn of this feature? MSVC 7.1 .net 2003 69462-270-0000007-18536 Thanks,
1
1284
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 guessing aboslutely not) 2.) How good does ASP.NET 2005 handle a custom composite control inside of a custom composite control ?
9
2113
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 have been something else. An extremely stripped-down version: int Function (int something) { switch(something) { case WHATEVER:
4
3896
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 &quot;&quot; instead of "" otherwise I get an error message. Can anyone suggest how to write it so that it writes &quot; instead of "". I have tried all combinations of adding &quot; to the code but as soon as I think I am there I get throw out again. if...
0
10311
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10146
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10080
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8967
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7492
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5509
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3639
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2874
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.