Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

view with parameters?

Do I suppose correctly that it is not possible to create view with parameters?

I've got a query with sub-query and in its where clause I need to specify parameter. Specifying where clause of view would not help. I would like to call simple view with parameters instead of the sending to the database complicated sql query. How would it be possible to do this?

N.

like image 989
noo Avatar asked Jun 21 '10 12:06

noo


1 Answers

You mention "specifying where clause of view would not help". Why not? My advice is to just create a view without the parameters, and use a "select * from view where [your predicates with your parameters]".

If you really want to continue with parametrized views, then you can use application contexts in your where clause. You can read about them here in the documentation: http://download.oracle.com/docs/cd/E11882_01/network.112/e10574/app_context.htm#DBSEG011

And here is an example.

Regards, Rob.

like image 196
Rob van Wijk Avatar answered Sep 17 '22 13:09

Rob van Wijk