Oracle视图+序列+触发器+访问控制
来源:互联网 发布:java格式化毫秒时间戳 编辑:程序博客网 时间:2024/06/05 16:35
一、视图
--创建简单视图(查询一个表)
CREATE or replace VIEW emp_view asSELECT e.EMPLOYEE_ID,e.FIRST_NAME,e.SALARY from EMPLOYEES e;
CREATE or replace VIEW emp_view(emp_id,e_name,e_salary)
as
SELECT e.EMPLOYEE_ID,e.FIRST_NAME,e.SALARY from EMPLOYEES e;
--查询视图
SELECT * from emp_view ev;
--创建复杂视图(查询多个表)
CREATE VIEW stu_score_view
AS
select STU."s_id",STU."s_name",s."score" from student stu,SC s
where STU."s_id"=s."s_id"
--简单视图的DML操作(复杂视图不可进行DML操作)
DELETE from emp_view e where e.emp_id=106;
二、序列
--创建一个序列
CREATE sequence emp_seq
INCREMENT by 1
start with 10
maxvalue 20
nocycle
nocache
--使用序列
insert into SC values(emp_seq.nextval,2,10);
--创建索引
CREATE index sname_index
on STUDENT("s_name","s_sex");
--删除索引
drop index sname_index;
三、触发器
--触发器
--语法
create or replace Trigger tname
timing
event1 [or event2,event3....]
on TABLE
trigger_body
--复制student表的结构
create table stu_copy
as select * from student where 1=2;
--定义触发器
create or replace trigger student_dml_trigger
before
DELETE
on STUDENT
for each ROW
BEGIN
insert into stu_copy("s_id","s_name","s_sex","s_age","s_birthday")
values(:old."s_id",:old."s_name",:old."s_sex",:old."s_age",:old."s_birthday");
end;
四、访问控制
--创建用户
CREATE USER damon
IDENTIFIED by damon 123;
--授权用户
grant create session,create table
to damon;
--修改用户密码
alter user damon identified by 123;
--创建角色
create role developer;
--给角色授权
grant create session,create table,create view,create sequence,create procedure to developer;
--角色赋予
grant developer to damon;
--对象权限
--hr 用户给Damon用户授权查看
grant select
on employees
to damon;
--登录Damon 查看
select * from hr.employees;
--只有查看权限
delete from hr.employees where employee_id=100;
--撤销授权
revoke select
on employees
from damon;
- Oracle视图+序列+触发器+访问控制
- Oracle 视图 序列 索引 触发器 定时器
- oracle创建视图触发器
- 视图、序列、同义词、触发器 、事务
- Oracle 触发器,序列用途
- oracle序列及触发器
- oracle建表、序列、触发器
- oracle视图更新,替代触发器
- oracle 创建表,序列,索引,视图,触发器,函数,存储过程,定时器,包体
- 关于oracle的函数,存储过程,触发器,序列,视图,左右连接一些的应用 带案例
- Oracle创建表,注释,视图,序列,同义词,触发器,存储过程举例
- oracle视图、同义词、序列
- oracle 视图、同义词、序列
- oracle 视图 序列 同义词
- oracle同义词、序列、视图
- Oracle(序列 视图)
- oracle 序列 视图
- Oracle,视图,序列,索引
- ipc通信常见函数
- 关于matlab与C++混合编程,关于接口函数MexFunction的编写,特别是结构体数组的传出到matlab的方法
- AngularJS学习笔记(2)——与用户交互的动态清单列表
- 微信第三方登录接口
- 拦截器和过滤器的区别
- Oracle视图+序列+触发器+访问控制
- 使用fileread将img转化为base64
- 将本地代码上传到Github(超详细)
- 例4.9 含有多个对象成员的派生类构造函数的执行顺序
- 数据库的集合操作
- spring
- OpenCMS学习笔记
- The SDK platform-tools version 23 is too old to check APIs compiled with API 24... ...
- mybatis学习总结