15 pts.
0
Q:
4 to 5 sql statements in procedures
I want to create 5 sql statements in one procedures which are performing diff tasks. can u provide the pl/sql PROC which can be include 5 sql statements.
ASKED: Jun 29 2009  4:26 AM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
1820 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
You need to add more information to your question. ANY PL/SQL procedure can execute arbitrarily many independent SQL statements. Simple example:

create or replace procedure my_proc
is
begin
select sum(price) from sales;
update tax_rates set tax_percent = 0.0875 where state = 'CA';
delete from sales_history where sale_date < (sysdate() - 180);
...
end;

What are you really trying to accomplish?
Last Answered: Jun 29 2009  7:14 PM GMT by Kccrosser   1820 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Ggalla   15 pts.  |   Jul 1 2009  3:20AM GMT

I want to create 5 sql statements in one procedures which are performing diff tasks. can u provide the pl/sql PROC which can be include 5 sql statements. — Note: one time only one sql staement should execute depends on requirement not all sql statements.

 

Carlosdl   29340 pts.  |   Jul 1 2009  2:59PM GMT

The question is still very vague. What is exactly the problem ?

Another example:

create or replace procedure my_proc (p_mode in number)
is
	l_price number;
begin
	if p_mode = 1 then
		select sum(price) into l_price from sales;
	elsif p_mode = 2 then
		update tax_rates set tax_percent = 0.0875 where state = ‘CA’;
	elsif p_mode = 3 then
		delete from sales_history where sale_date < (sysdate() - 180);
	…
	end if;
…
end;

 
0