Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to write a stored procedure in Oracle 1

Status
Not open for further replies.

shyamal

Programmer
Aug 14, 2000
79
US
Hello,

How can I run this SQL stored procedure in Oracle?

declare @i integer
set @i = 1
while @i <= 5000
begin
insert into T00 values (@1)
insert into T50 values (@1)
set @i = @i + 1
end
commit

Thanks in advance!
 
CREATE OR REPLACE PROCEDURE <proc_name> IS
i NUMBER := 1;
BEGIN
WHILE ( i <= 5000)
LOOP
INSERT INTO t00 values(i);
INSERT INTO t50 values(i);
i := i + 1;
END LOOP;
COMMIT;
END;
/

executing the procedure from sqlplus---
SQL> exec <proc_name>

or
using pl/sql
begin
<proc_name>
end;
/

 
Thanks! you solved the next problem as well!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top