This content has been marked as final. Show 4 replies
However, you need to explain more on ID/ IDs_ from a dropdown list. If it is a list, the above code will not work.
select * from myTable where myID = 0 or UsersID in (myID) /
You'll have to make the function return something,
so maybe something like this:
function GetStuff (myID in varchar2) return number as l_Cnt number; begin select count(*) into l_Cnt from myTable where 0 != myID and UserID = myID; return l_Cnt; end GetStuff;
Give some example values of myID. Since you are passing it as a string, how are you passing multiple values? Are the values separated by blank or comma?
Select * from myTableI think you just need to put it in your where clause:
if myID != 0 Then
where UsersID in (myID)
but as others said - if myid contains multiple values, you need to process it differently depending on whether it's one string or a collection etc.
select * from myTable where myid != 0 -- myid doesn't have to be a column of the table to be included in the where clause and usersID in (myID);
edit: I just realised that other people had answered with the exact same statement as I just did..... that's what I get for not reading replies thouroughly.
Edited by: WhiteHat on Dec 24, 2010 9:01 AM