Hallo,
meine Procedure bringe ich nicht zu laufen.
Die Proc soll prüfen, ob eine Tabelle existiert und wenn ja dann löschen.
Wer kann mir helfen.
Danke.
Reinhold P.
ERROR at line 9: PLS-00487: Ungültige Referenz auf Variable 'ASCHEMNAME'
7.
8. if TabAnz > 0 then begin
9. execute immediate 'drop table' + aSchemName.aTabName; exception when others then null; end;
10. end if;
11. commit;
meine Procedure bringe ich nicht zu laufen.
Die Proc soll prüfen, ob eine Tabelle existiert und wenn ja dann löschen.
Wer kann mir helfen.
Danke.
Reinhold P.
ERROR at line 9: PLS-00487: Ungültige Referenz auf Variable 'ASCHEMNAME'
7.
8. if TabAnz > 0 then begin
9. execute immediate 'drop table' + aSchemName.aTabName; exception when others then null; end;
10. end if;
11. commit;
Code:
create or replace procedure asDropTableIfExists(aTabName in VarChar2, aSchemName in VarChar2) is TabAnz Number; begin select count(*) into TabAnz from all_tables where TABLE_NAME = aTabName and OWNER = aSchemName; if TabAnz > 0 then begin execute immediate 'drop table' + aSchemName.aTabName; exception when others then null; end; end if; commit; end asDropTableIfExists;
Comment