1. select * from user_objects where object_type = 'SEQUENCE'2. select * from user_objects where object_type = 'SEQUENCE' and object_name = &name

解决方案 »

  1.   

    多谢楼上,再补充个小问题,如果我想实现如下功能: if (sequence_a存在) drop sequence_a,
    怎么写?我用sqlserver里的if exists() then 报错
      

  2.   

    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;
    /
      

  3.   

    'drop sequence &name' ^_^
      

  4.   

    select * from user_sequences;
      

  5.   

    请慎用'&'符号,:)
    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;
    /
      

  6.   

    好久没来看这个贴子,谢谢楼上的回复。不过我还是没太明白&符号的含义,哪位兄弟能给解释一下吗?周日就结贴