How to pass parameter [bind variable or substitution variable] to a view?
BlaisApr 11 2013 — edited Apr 12 2013How 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);