Re: how do i create a view within a procedure that uses a variable defined in the procedure

From: lindawie (lindawie_at_my-deja.com)
Date: 06/09/04


Date: Wed, 9 Jun 2004 08:18:29 -0700

Anith,

> What would be the point of such an endeavor? Please post your
> overall requirements & someone may be able to point to the right
> direction.
>
> In absolutely no data management contexts does a real need arise
> to create a view dynamically within a stored procedure.

You need to get out more. :)
Of course there is a real need in the real world. Partitioned views
come to mind immediately.

Our daily pipeline process creates hourly, daily, weekly, and
monthly partitions as needed. Every day the partitioned views need
to be dropped and recreated to include the new partitions. We have
several hundred partitioned views in our database. The whole process
is automated. Tables and view are created at runtime by stored
procedures. Without this automation, the whole process would be
unmanageable.

Linda