初学oracle关于sequence的一点疑问:
1 如何取得当前用户的所有sequence的名称?
2 如何判断某个sequence是否存在?
------解决方法--------------------------------------------------------
1. select * from user_objects where object_type = 'SEQUENCE'
2. select * from user_objects where object_type = 'SEQUENCE' and object_name = &name
------解决方法--------------------------------------------------------
declare
v_count int;
begin
select count(*) into v_ount from user_objects
where object_type = 'SEQUENCE' and object_name = &name;
if v_int >0 then
execute immediate 'drop sequence &name';
end if ;
end;
/
------解决方法--------------------------------------------------------
楼上的比较阴险阿,哈哈
------解决方法--------------------------------------------------------
'drop sequence &name' ^_^
------解决方法--------------------------------------------------------
^_^
------解决方法--------------------------------------------------------
呵呵!
------解决方法--------------------------------------------------------
select * from user_sequences;
------解决方法--------------------------------------------------------
执行就玩完
------解决方法--------------------------------------------------------
有趣
------解决方法--------------------------------------------------------
请慎用'&'符号,:)
declare
v_count int;
begin
select count(*) into v_ount from user_objects
where object_type = 'SEQUENCE' and object_name = 'MY_SEQ_NAME';
if v_int >0 then
execute immediate 'drop sequence MY_SEQ_NAME';
end if ;
end;
/