Alex Rivera | Logout

Table-Valued Functions in ORACLE 11g ? ( parameterized views )

Asked 2010-01-13T18:45:21.180
12

I've seen discussions about this in the past, such as here. But I'm wondering if somewhere along the line, maybe 10g or 11g (we are using 11g), ORACLE has introduced any better support for "parameterized views", without needing to litter the database with all sorts of user-defined types and/or cursor definitions or sys_context variables all over.

I'm hoping maybe ORACLE's added support for something that simply "just works", as per the following example in T-SQL:

CREATE FUNCTION [dbo].[getSomeData] (@PRODID ROWID)  
RETURNS TABLE AS  
    RETURN SELECT PRODID, A, B, C, D, E  
    FROM MY_TABLE  
    WHERE PRODID = @PRODID

Then just selecting it as so:

SELECT * FROM dbo.getSomeData(23)
Edit
Report

1 Answer

-3

There are TWO types of table-valued functions in SQL SERVER:

  1. Inline table-valued function: For an inline table-valued function, there is no function body; the table is the result set of a single SELECT statement. This type can be named as 'parameterized view' and it has no equivalent in ORACLE as I know.

  2. Multistatement table-valued function: For a multistatement table-valued function, the function body, defined in a BEGIN...END block, contains a series of Transact-SQL statements that build and insert rows into the table that will be returned.

The above sample (By Gary Myers) creates a table function of the second type and it is NOT a 'parameterized view'.

answered 2011-10-27T12:33:41.223

Your Answer