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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Procedure to delete table

Status
Not open for further replies.

Diogo

Technical User
Mar 22, 2001
143
PT
I have create a procedure but, it doesn't run.
Someone can help me?

CREATE PROCEDURE DB2ADMIN.DELETE_TABLE
(IN TABLE CHARACTER(50)
)
SPECIFIC DB2ADMIN.DELETE_TABLE
LANGUAGE SQL
NOT DETERMINISTIC
CALLED ON NULL INPUT
MODIFIES SQL DATA
INHERIT SPECIAL REGISTERS
begin
declare v_stmt varchar(200);
SET v_stmt = 'alter table ' || TABLE || ' activate not logged initially with empty table';
PREPARE s1 from v_stmt;
EXECUTE s1;
end;


Thanks any way...
 
I used
db2 -td@ -f file1.sql

where file1.sql is

CREATE PROCEDURE DELETE_TABLE
(IN TABLE CHARACTER(50)
)
SPECIFIC DELETE_TABLE
LANGUAGE SQL
NOT DETERMINISTIC
CALLED ON NULL INPUT
MODIFIES SQL DATA
-- INHERIT SPECIAL REGISTERS
begin
declare v_stmt varchar(200);
SET v_stmt = 'alter table ' || TABLE || ' activate not logged initially with empty table';
PREPARE s1 from v_stmt;
EXECUTE s1;
end
@


You cannot end a proc with ; .. So I have used @ ..

Once created, this proc works

If you have problems, please post the error code also

cheers
Sathyaram

For db2 resoruces visit More DB2 questions answered at &
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top