Question : Views versus Queries

I have this huge query with a lot of JOINS. It is only used once in my code, however.

Is there a benefit to making it a VIEW and just selecting that view with the customized WHERE clause?
As opposed to just using the query itself?
(No stored procedure, just query within coding).

Are there any gotchas in regards to using a VIEW?

Using Oracle 11g. But  I  also use SQL Server 2008.
thanks!

Answer : Views versus Queries

There may be some performance tradeoffs since Oracle has the opportunity to pre-compile the view and the resulting execution plan is therefore more static.   But, IMHO, the larger issue is where you want to manage this "large" code object.  Storing it in a view puts it in the database where it is securable and dependencies are easier to track.  If there is a disadvantage to using views, then it simply the extra layer of complexity (one more "moving part"), but the isolation gained from that is also probably the greatest advantage.




Random Solutions  
 
programming4us programming4us