新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Oracle數(shù)據(jù)庫包的構(gòu)造過程實例
Oracle數(shù)據(jù)庫包的構(gòu)造過程是沒有任何名稱的,它是在實現(xiàn)了包的其他過程之后,以begin開始,以end結(jié)束的部分。本文我們就介紹了一個構(gòu)造過程的實例,接下來就讓我們一起來了解一下這部分內(nèi)容吧。

創(chuàng)新互聯(lián)-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價比蓮湖網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式蓮湖網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋蓮湖地區(qū)。費用合理售后完善,10年實體公司更值得信賴。
1.包頭
- create or replace package pkg_emp is
- minsal number(6, 2);
- maxsal number(6, 2);
- procedure add_employee(eno number,
- name varchar2,
- salary number,
- dno number);
- procedure upd_sal(eno number, salary number);
- procedure upd_sal(name varchar2, salary number);
- end pkg_emp;
2.包體
- create or replace package body pkg_emp is
- procedure add_employee(eno number,
- name varchar2,
- salary number,
- dno number) is
- begin
- if salary between minsal and maxsal then
- insert into emp
- (empno, ename, sal, deptno)
- values
- (eno, name, salary, dno);
- else
- raise_application_error(-20001, '工資不在范圍內(nèi)');
- end if;
- exception
- when dup_val_on_index then
- raise_application_error(-20002, '該雇員已經(jīng)存在');
- end;
- procedure upd_sal(eno number, salary number) is
- begin
- if salary between minsal and maxsal then
- update emp set sal = salary where empno = eno;
- if sql%notfound then
- raise_application_error(-20003, '不存在該雇員號');
- end if;
- else
- raise_application_error(-20001, '工資不在范圍內(nèi)');
- end if;
- end;
- procedure upd_sal(name varchar2, salary number) is
- begin
- if salary between minsal and maxsal then
- update emp set sal = salary where upper(ename) = upper(name);
- if sql%notfound then
- raise_application_error(-20004, '不存在該雇員號');
- end if;
- else
- raise_application_error(-20001, '工資不在范圍內(nèi)');
- end if;
- end;
3.構(gòu)造過程
- begin
- select min(sal), max(sal) into minsal, maxsal from emp;
- end;
關(guān)于Oracle數(shù)據(jù)庫包的構(gòu)造過程實例的知識就介紹到這里了,希望本次的介紹能夠?qū)δ兴斋@!
【編輯推薦】
- 介紹六個有用的MySQL的SQL語句
- MySQL大數(shù)據(jù)量快速插入方法和語句優(yōu)化
- MySQL數(shù)據(jù)庫完整備份與增量備份的原理簡介
- 六條比較有用的MySQL數(shù)據(jù)庫操作的SQL語句
- 詳解xtrabackup對MySQL進行備份和恢復的全過程
標題名稱:Oracle數(shù)據(jù)庫包的構(gòu)造過程實例
網(wǎng)站路徑:http://www.fisionsoft.com.cn/article/dpcocdj.html


咨詢
建站咨詢
