WITH clause | How to use it? [message #377569] |
Tue, 23 December 2008 09:38  |
umajava
Messages: 8 Registered: December 2008
|
Junior Member |
|
|
Hi,
I have performance issue with one of the VIEW so
I am trying to use Oracle WITH clause to call the view once and use the view for the whole session of the main SQL.
I have my main SQL in a function. Is it possible for me to create a procedure and populate the WITH clause? Later this WITH clause will be used in another function while computing values.
something like this
--main function
function x
begin
--call procedure to populate the WITH clause
populate_with_clause;
select my_another_func, x, y from z
end;
procedure populate_with_clause
with abc as (
select x, y from vw_myview
)
function my_another_func(p_a number) is
begin
select x from abc where abc.x = p_a;
end;
Right now I cannot use the WITH clause in a procedure. Its expecting me to have a SELECT clause on the WITH statement.
Any ideas?
|
|
|
|
|
|