Subject | Cannot use sp in a view. What are my options? |
---|---|
Author | sugi |
Post date | 2005-03-16T22:04:28Z |
Hello again everyone :D,
In this particular application, most of the data that my users see
are presented via a view, with most of the 'data formatting' done on the
server side, making the presentation layer's code very simple.
...
create view my_view (...)
as select ...
//some data massaging here...
from my_table
left join other_table on (...); //if any
...
select first 1000 from my_view;
...
This was all nice and clean, but unfortunately some data requires some
rather complex/convoluted processing logic. No problem, I thought, I'd
just write a stored procedure to do the processing, and then create a
view using a join from the original table with the sp...
Oh, wait. That wouldn't work :)
At this point, I'm sorely tempted to dump the views altogether and
replacing them all with selectable stored procedure.... Any suggestions
on work-arounds or alternative approach ?
Thank you very much in advance,
sugi.
PS: Is there a documented rationale behind this design decision?
In this particular application, most of the data that my users see
are presented via a view, with most of the 'data formatting' done on the
server side, making the presentation layer's code very simple.
...
create view my_view (...)
as select ...
//some data massaging here...
from my_table
left join other_table on (...); //if any
...
select first 1000 from my_view;
...
This was all nice and clean, but unfortunately some data requires some
rather complex/convoluted processing logic. No problem, I thought, I'd
just write a stored procedure to do the processing, and then create a
view using a join from the original table with the sp...
Oh, wait. That wouldn't work :)
At this point, I'm sorely tempted to dump the views altogether and
replacing them all with selectable stored procedure.... Any suggestions
on work-arounds or alternative approach ?
Thank you very much in advance,
sugi.
PS: Is there a documented rationale behind this design decision?