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

前端 未结 3 1003
旧时难觅i
旧时难觅i 2020-12-03 03:37

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 b

3条回答
  •  鱼传尺愫
    2020-12-03 04:40

    It is possible to define a kind of "parametrized" views in Oracle. The steps are:

    1. Define a package containing as public members that are in fact the needed parameters (there is no need for functions or procedures in that package),
    2. Define a view that is based on that package members.

    To use this mechanism one user should:

    1. open a session,
    2. assign the desired values to that package members,
    3. SELECT data from the view,
    4. do other stuff or close the session.

    REMARK: it is essential for the user to do all the three steps in only one session as the package members scope is exactly a session.

提交回复
热议问题