function GET_OBJECT_CNT( v_object_name in user_objects.object_name%type , v_object_type in user_objects.object_type%type ) return number is n_cnt number := 0; begin select count(1) into n_cnt from user_objects where object_name = v_object_name and object_type = v_object_type; return n_cnt; exception when others then dbms_output.put_line (substr (sqlerrm, 1, 254)); raise; end GET_OBJECT_CNT;若要查表test是否存在,在procedure中, if FR_GET_OBJECT_CNT('TEST','TABLE') = 0
-- create table test then else -- insert condition end if
, v_object_type in user_objects.object_type%type
)
return number is n_cnt number := 0; begin select count(1)
into n_cnt
from user_objects
where object_name = v_object_name
and object_type = v_object_type; return n_cnt; exception
when others
then
dbms_output.put_line (substr (sqlerrm, 1, 254));
raise; end GET_OBJECT_CNT;若要查表test是否存在,在procedure中,
if FR_GET_OBJECT_CNT('TEST','TABLE') = 0
-- create table test
then
else
-- insert condition
end if