Home » RDBMS Server » Server Administration » select statement ...
select statement ... [message #372073] |
Tue, 09 January 2001 02:14 |
jimmy
Messages: 21 Registered: November 2000
|
Junior Member |
|
|
Hi,
I have a select statement that looks like this;
select * from myTable where aColumn in (1, 3, 4);
This will return all records with the value 1, 3 and 4 in column aColumn.
My question;
Is it possible to write a pl/sql function that returns a list of numbers to the statement? Like this;
select * from myTable where aColumn in (getNumbers);
The function getNumbers should for exmaple return 1, 3, 4.
Thank you!
Jimmy
|
|
|
|
|
|
Re: select statement ... [message #372100 is a reply to message #372073] |
Wed, 10 January 2001 05:30 |
John R
Messages: 156 Registered: March 2000
|
Senior Member |
|
|
Sadly there is no way to return a list from Pl/Sql to an IN statement. (Or if there is, I don't know of it and would dearly like to be told)
What you can do is to create a function into which you pass the value from the database, which will then do a comparison between that value and the list, returnin a 'Y' if a match is found and a 'N' otherwise.
This will let you rewrite the query as
Select *
From MyTable
Where fn_in_list(aColumn) = 'Y'
|
|
|
Goto Forum:
Current Time: Sat Jan 11 04:59:41 CST 2025
|