--给用户授予权限
GRANT CREATE SYNONYM TO xiaohong;
GRANT SELECT ON SCOTT.EMP TO xiaohong;
GRANT DELETE ON SCOTT.EMP TO xiaohong;
GRANT UPDATE ON SCOTT.EMP TO xiaohong;
--创建同义词 别名(synonym)
create synonym mytable for scott.emp
select * from xiaohong.mytable
create user xiaolv IDENTIFIED BY 123456
GRANT CONNECT to xiaolv
select * from mytable
--创建公有同义词
create public synonym mytable3 for scott.emp
select * from mytable3
--创建序列
create sequence myseq
start with 1
increment by 1;
select * from java1018
delete from java1018
insert into java1018 values(myseq.nextval,‘小红‘,‘女‘,‘山东淄博‘,to_date(‘1998-08-08‘,‘yyyy-mm-dd‘));
--查询序列到几
select myseq.currval from dual
--删除序列
drop sequence myseq
--授权
grant create view to scott
--创建视图
create view myview
as
select empno,ename,job,mgr,hiredate,sal,comm,emp.deptno,dname,loc from emp join dept on emp.deptno=emp.deptno
select * from myview
--创建测试表
create table t_testseq
(
id number,
name varchar2(10)
);
--创建序列
create sequence seq_value
start with 1
increment by 1;
select * from t_testseq
--0.015
select * from t_testseq where id=88800;
--创建索引
--CREATE INDEX 索引名 ON 表明(索引字段)
create index myindex on t_testseq(id)
--0.014
select * from t_testseq where id=88800;
--调用存储过程
call hello();
call getmax(2,5);
原文:https://www.cnblogs.com/kun123/p/12582771.html