Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to pass parameter [bind variable or substitution variable] to a view?

BlaisApr 11 2013 — edited Apr 12 2013
How can I pass a parameter [bind variable or substitution variable] to a view in Oracle?

Some will tell me that this is not necessary, that I can only pass the parameter when I query the view, but I found some case where this cause performance issue. In long view where I use subquery factoring [WITH], it's necessary to pass the parameter many time through different subqueries and not only to the resulting view.

In other database (SQL Server, Access), we can pass parameters through query. I can't find how to do that in Oracle. Can some one tell me what is the approach suggest by Oracle on that subject?

Thank you in advance,


MB

What I can do:
CREATE VIEW "HR"."EMP_NAME" ("FIRST_NAME", "LAST_NAME")
AS
SELECT FIRST_NAME, LAST_NAME FROM EMPLOYEES;

What I want to do:

CREATE VIEW "HR"."EMP_NAME" ("FIRST_NAME", "LAST_NAME")(prmEMP_ID)
AS
SELECT FIRST_NAME, LAST_NAME FROM EMPLOYEES WHERE EMPLOYEE_ID IN (:prmEMP_ID);
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 10 2013
Added on Apr 11 2013
4 comments
15,609 views