| SELECT Records based on an array of values [message #259152] |
Tue, 14 August 2007 09:27  |
hdogg
Messages: 94 Registered: March 2007
|
Member |
|
|
I create the array userid[]
usersid[1] = 1231
usersid[2] = 455
usersid[3] = 1251
usersid[4] = 1291
The array is populated by form check box's submitted.
I want to SELECT items from a database with those userid's
SELECT USER_ID FROM USERS WHERE USERID = "userid"
How do I get that to work?
|
|
|
|
| Re: SELECT Records based on an array of values [message #259157 is a reply to message #259152] |
Tue, 14 August 2007 09:41   |
MarcL
Messages: 455 Registered: November 2006 Location: Connecticut, USA
|
Senior Member |
|
|
Something like this should work:
declare
type userid_tab is table of varchar2(10) index by binary_integer;
userids userid_tab;
v_userid marc_user_test.userid%type;
begin
userids(1) := 'USER1';
select userid
into v_user_id
from marc_user_test
where userid = userids(1);
end;
|
|
|
|
|
|
|
|
|
|
|
|
| Re: SELECT Records based on an array of values [message #259399 is a reply to message #259368] |
Wed, 15 August 2007 09:17  |
hdogg
Messages: 94 Registered: March 2007
|
Member |
|
|
The array is populated from a php checkbox form...
Hence the array
is populated when a user checks the boxes and hits submit.
So I need to bring the external array and find a way to through it in the sql and select those specific userids that were selected.
|
|
|
|