SlopeIron
04-13-2005, 11:58 AM
Hi all,
I have a user function in SQL Server like the following.
CREATE FUNCTION myTableFunction (@myParam int)
RETURNS @myOutputTable table (idCol int, txtCol varchar(50))
as begin
... bunch of procedural code...
end
return
END
I can select from this function as if it were a table:
SELECT * FROM myTableFunction(12345)
WHERE idCol IN (6,7)
-----
Returns something like-
idCol txtCol
6 ABC
7 DEF
I know this example doesn't make a whole lot of sense, just trying to show the general idea - pass a parameter to the function and get some records back. Then also be able to further filter the output using a 'where' clause. Anyone know how to write this as an Oracle function?
Thanks,
Russ.
I have a user function in SQL Server like the following.
CREATE FUNCTION myTableFunction (@myParam int)
RETURNS @myOutputTable table (idCol int, txtCol varchar(50))
as begin
... bunch of procedural code...
end
return
END
I can select from this function as if it were a table:
SELECT * FROM myTableFunction(12345)
WHERE idCol IN (6,7)
-----
Returns something like-
idCol txtCol
6 ABC
7 DEF
I know this example doesn't make a whole lot of sense, just trying to show the general idea - pass a parameter to the function and get some records back. Then also be able to further filter the output using a 'where' clause. Anyone know how to write this as an Oracle function?
Thanks,
Russ.