Oracle 檢測表過程

2021-06-02 05:50:58 字數 1925 閱讀 6914

create or replace procedure proc_drop_table(t_name in varchar2) is

c_type varchar2(20);

t_count int;

v_count int;

i_count int;

s_count int;

begin

begin

select object_type

into c_type

from all_objects

where object_name = upper(t_name);

exception

when others then

dbms_output.put_line('the ' || t_name ||

' is not in this database !');

end;

select count(*)

into t_count

from user_tables

where table_name = upper(t_name);

select count(*)

into v_count

from user_views

where view_name = upper(t_name);

select count(*)

into i_count

from user_indexes

where index_name = upper(t_name);

select count(*)

into s_count

from user_sequences

where sequence_name = upper(t_name);

-----------table

if c_type = 'table' then

if t_count > 0 then

execute immediate 'drop table ' || t_name || ' purge';

dbms_output.put_line('the table :' || t_name || ' is drop !');

end if;

commit;

end if;

--------- view

if c_type = 'view' then

if v_count > 0 then

execute immediate 'drop view ' || t_name;

dbms_output.put_line('the view :' || t_name || ' is drop !');

end if;

end if;

--------- sqe

if c_type = 'sequence' then

if s_count > 0 then

execute immediate 'drop sequence ' || t_name;

dbms_output.put_line('the sequence :' || t_name || ' is drop !');

end if;

end if;

-------- index

if c_type = 'index' then

if i_count > 0 then

execute immediate 'drop index ' || t_name;

dbms_output.put_line('the index :' || t_name || ' is drop !');

end if;

end if;

end proc_drop_table;

Oracle 建立表,儲存過程

1.首先建立乙個customer 表 create table customer customerid varchar2 10 primary key,customername varchar2 20 custoemr varchar2 8 custoemrage int 2.插入四行資料 inse...

oracle 儲存過程 建立表

需求 儲存過程完成一年建立乙個表實現 如下 create or replace procedure test123456 as suffix year varchar 5 tablename varchar 40 begin select to char sysdate,yyyy into suff...

安全檢測Oracle注入點全過程

對於oracle注入點的檢測比較特殊,不像其它注入點一樣,需要經過多個步驟檢測確認注入 點所使用的資料庫型別是否為oracle。oracle注入點判斷 首先,需要判斷是否為oracle注入點,可提交如下幾步查詢 and 1 1 and 1 2 返回不一樣的頁面,則說明存在注入 漏洞,繼續在注入 點處...