OK, so the best would do something like this
No because even if you manage to develop your office with your "select group by", it would be pointless since you can not use the parameter returned by the function as if its acting in a list of values separated by commas that you would type by hand. SQL sees that one value equal to your nickname list and not a list of values separated by commas as you think. I hope to make it clear on this one
I think you just want to avoid having to type the list values in the WHERE and that you count on your function to do it for you. If that's it, I drop the function and simply would create a new table showing the values of all rows (records) that there is value in the list in your WHERE predicate. For example, insert in this table a line with "ES" line with "N" and a line with "VA"
Code:
CREATE TABLE MYBIB.MYTABLE (DOSGQDO CHAR ( 2) NOT NULL WITH DEFAULT)
INSERT INTO MYBIB.MYTABLE VALUES('ES')
INSERT INTO MYBIB.MYTABLE VALUES('SO')
INSERT INTO MYBIB.MYTABLE VALUES('VA')
Then, if I want "ALL", I would type directly:
Code:
SELECT a.*
FROM PROD.DOSLIEF a
JOIN MYBIB.MYTABLE b
ON a.dosggdo = b.dosggdo
Otherwise, I will indicate directly value in the WHERE:
Code:
SELECT *
FROM PROD.DOSLIEF
WHERE dosggdo = 'MyValue'
Note: wildcard characters have nothing to see here. For simplicity say a wildcard is a character whose nickname is taken into account the position but not the value. It is usually represented by a ?.
Example :
?ut searches all values such as but, rut, nut, mut, etc..
Bookmarks