Oracle学习(5)--存储过程、索引、同义词

1 创建存储过程

例:创建一个根据员工号删除员工信息的存储过程

create or replace procedure delempno(empid in number) is    ----创建或替换存储过程,参数为empid,参数类型为empid

begin

    delete from emp where empno=empid;

    commit;

end delempno;

 

2 如何在pl/sql developer中执行存储过程

在pl/sql developer的菜单栏中选择 文件→新建→命令窗口,将会弹出一个命令窗口,

在命令窗口中输入  execute delempno(7566); 

7566为员工号,系统会提示存储过程执行完成。

 

3 创建索引

create index index_test_id on test_index(id);

 4 同义词(Synonym)

同义词是现有对象的一个别名分为私有同义词和公共同义词;

例:给scott用户赋予创建同义词的权限

grant create any synonym to scott;

例:创建scott用户下的salgrade表的同义词,名称为sg

create synonym sg for scott.salgrade;

例:创建公共同义词

create public synonym emp for scott.emp;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值