Home » SQL & PL/SQL » SQL & PL/SQL » DML usage in a sp
DML usage in a sp [message #1327] Mon, 22 April 2002 05:52 Go to next message
sateesh
Messages: 8
Registered: April 2000
Junior Member
How can I use DML in a stored procedure?
THe documentation says DBMS_SQL.EXECUTE is for dynamic sql.

Thank you
DDL usage in a sp [message #1328 is a reply to message #1327] Mon, 22 April 2002 06:07 Go to previous messageGo to next message
sateesh
Messages: 8
Registered: April 2000
Junior Member
Sorry, I meant DDL
Re: DDL usage in a sp [message #1335 is a reply to message #1327] Mon, 22 April 2002 09:01 Go to previous message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
yes you can.
following is a sample using dynamic sql for rebuilding the indexes.
NOTE on EXECUTE IMMEDIATE.

create or replace procedure index_rebuild
AUTHID CURRENT_USER
is
cursor c1 is select index_name from user_indexes where blevel>=3;
str varchar2(200);
begin
for mag in c1 loop
exit when c1%notfound;
str:='alter index '||mag.index_name || ' rebuild online';
EXECUTE IMMEDIATE str;
end loop;
end;
Previous Topic: Obtaining values of multiple Records in a single row
Next Topic: How to create table in Stored Procedure?
Goto Forum:
  


Current Time: Thu Apr 25 00:01:22 CDT 2024