日期:2014-05-16  浏览次数:20455 次

Oracle 练习用(2)
-- 1. sequence excise
create sequence myseq start with 1 increment by 1 order cache 20 nocycle;

select myseq.nextval from dual; -- currval

drop sequence myseq;

-- 2. Synonyms
select * from dual;

select table_name from all_tables where lower(table_name) = 'dual';

select table_name from user_tables;

create public synonym USER_INFO for admin.USER_INFO;

drop public synonym USER_INFO;

-- 3. procedure
create or replace procedure myproc
as
i number;
begin
i := 100;
dbms_output.put_line('i='||i);
end;
/

exec myproc;

drop procedure myproc;

-- 4. trigger
create or replace trigger tr_USER_INFO
before insert or update or delete on USER_INFO
begin
raise_application_error(-20001,'can t modify');
end;
/

delete from USER_INFO;

drop trigger tr_USER_INFO;

-- 5. back up & recovery
-- a) imp & exp
-- b) sql loader

?