Sie sind auf Seite 1von 2

List no 10):- To study synonym,indexes and sequences.

Roll no ------ 06 SEQUENCE : SQL> select * from dept; DEPTNO DNAME LOC ---------- -------------- ------------10 ACCOUNTING NEW YORK 20 RESEARCH DALLAS 30 SALES CHICAGO 40 OPERATIONS BOSTON SQL> conn Enter user-name: system Enter password: ****** Connected. SQL> select * from dept; select * from dept * ERROR at line 1: ORA-00942: table or view does not exist SQL> select * from scott.dept; DEPTNO DNAME LOC ---------- -------------- ------------10 ACCOUNTING NEW YORK 20 RESEARCH DALLAS 30 SALES CHICAGO 40 OPERATIONS BOSTON SQL> create public synonym dept for scott.dept; Synonym created. SQL> select * from dept; DEPTNO DNAME LOC ---------- -------------- ------------10 ACCOUNTING NEW YORK

20 RESEARCH DALLAS 30 SALES CHICAGO 40 OPERATIONS BOSTON INDEX : SQL> create index emp_name_idx 2 on emp(ename); Index created. SEQUENCE : SQL> create sequence testseq 2 increment by 1 3 start with 1 4 nomaxvalue 5 nocycle 6 cache 10 7 / Sequence created. SQL> select testseq.nextval from dual; NEXTVAL ---------1 SQL> / NEXTVAL ---------2 SQL> select testseq.currval from dual; CURRVAL ---------2

Das könnte Ihnen auch gefallen