使用oracle数据库,pl\sql developer开发环境,system用户登入输入以下代码后,会提示
“ora-02289:序列号不存在,ora-06512:在line5"
为什么会出现这种情况,怎么解决,请高手指教!
declare
v_sql varchar2(200);
begin
v_sql:='drop sequence cxexam_tmp_id';
execute immediate v_sql;
v_sql:='create sequence cxexam_tmp_id increment by 1 start with 1 maxvalue 9999999 nocycle nocache';
execute immediate v_sql;
end;
“ora-02289:序列号不存在,ora-06512:在line5"
为什么会出现这种情况,怎么解决,请高手指教!
declare
v_sql varchar2(200);
begin
v_sql:='drop sequence cxexam_tmp_id';
execute immediate v_sql;
v_sql:='create sequence cxexam_tmp_id increment by 1 start with 1 maxvalue 9999999 nocycle nocache';
execute immediate v_sql;
end;
解决方案 »
- 如何将Aqua Data Studio完全卸载(包括注册表项)
- 安装oracle8.17时出现" 写入文件:d:\oracle\ora81\jis\lib\full_orb.jar时出现错误,"
- 我想把B表中的fristname,lastname字段插到A表中的fristname,lastname字段中,咋办?
- Oracle中查询前10条记录
- 一字段含有逗号分隔的串,把这条记录按逗号分隔分成多条记录,具体如下,在线等
- ORACLE 高手进来练习一下SQL语句。
- 救命!windows2000或xp下的ORACLE数据库启动问题
- 看看吧,这可恶的排序,我已经晕倒。
- 在线请教sql:select rownum,a from tbl where rownum>10 and rownum<200
- 如何完全卸载oracle8i!
- Date类型相减,差值为分钟,如何去处理
- 请问如何定义存储过程中的一个dml语句超时?
所以不能删除。
v_sql varchar2(200);
begin
v_sql:='create or replace sequence cxexam_tmp_id increment by 1 start with 1 maxvalue 9999999 nocycle nocache';
execute immediate v_sql;
end;
v_sql varchar2(200);
begin
v_sql:='drop sequence cxexam_tmp_id';
execute immediate v_sql;
exception when others then null; ---加上这句即可
v_sql:='create sequence cxexam_tmp_id increment by 1 start with 1 maxvalue 9999999 nocycle nocache';
execute immediate v_sql;
end;
declare
type cursor_t is ref cursor;
cursor_s cursor_t;
v_seqname varchar2(36);
begin
v_seqname := '';
open cursor_s for 'select sequence_name from user_sequences where sequence_name=''CXEXAM_TMP_ID''';
loop
fetch cursor_s into v_seqname;
exit when cursor_s%notfound;
end loop;
close cursor_s;
if v_seqname='' then
execute immediate 'create sequence cxexam_tmp_id increment by 1 start with 1 maxvalue 9999999 nocycle nocache';
else
dbms_output.put_line('此序列已经存在');
end if;
end;
/方法2:
declare
v_i integer;
begin
select count(*) into v_i from user_sequences where sequence_name='SEQ_ID1';
if v_i>0 then
execute immediate 'create sequence SEQ_ID1 increment by 1 start with 1 maxvalue 9999999';
end if;
end;
/