Oracle索引、视图、存储过程、触发器

发表于:2010-7-27 10:39

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:未知    来源:51Testing软件测试网采编

  Oracle索引

  目地:更快地检索数据。

  特点:读取数据速度快,但添加数据速度慢.。

  语法:

create index idx_stu_email on stu (email) ;
drop index idx_stu_email ;
select index_name from user_indexs ;

  Oracle视图

  特点:视图相当于子查询。

  语法:

create view v$;
select view_name from user_views ;
desc v$_dept_avg_sal_info ;
create view v$_stu as select id,name from stu;

  Oracle存储过程

  语法:

  1.创建不带参数的存储过程

create or replace procedure p
as
cursor c is
select * from emp for update;
begin
for v_emp in c loop
if(v_emp.deptno = 10) then
update emp set sal = sal +10 where current of c;
elsif (v_emp.deptno = 20) then
update emp set sal = sal + 20 where current of c;
else
update emp set sal = sal + 50 where current of c;
end if;
end loop;
commit;
end;

  // 执行存储过程(两种方式)

· exec p;
· begin
p;
end;

21/212>
《2023软件测试行业现状调查报告》独家发布~

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计 发展历程

法律顾问:上海兰迪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2024
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号