Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-02-05 : 15:39:39
|
s41nt writes "How to convert a list into a string using a single function; so I can pass it into another function?
Ex.
We have a table called X and Y, and a function Z(varchar2 Z1) return number, as the following:
Table X A|B --- 1|1 1|2 2|3 2|4 3|5 3|6
Table Y C|D --- 1|A 2|B 3|C 4|D 5|E 5|F 1|G 4|H 7|I 3|J
create function Z(ABC in varchar2) return number is de number; begin execute immediate 'select count(1) from Y where C in ('||ABC||')' into de; return de; end;
Now, when we do: select B from X where A in ('1','2'); we get: B - 1 2 3 4 What I want is to create a function K to get a single string: 1, 2, 3, 4 so I can do something like the following: select Z(select K(B) from X where A in ('1','2')) from dual; and the result is 7.
Thank You." |
|
|
|
|
|