-
查詢員工姓名、月薪和職位查看全部
-
創(chuàng)建存儲過程查看全部
-
1.調(diào)試存儲過程最好放到Oracle數(shù)據(jù)庫所在的系統(tǒng)或虛擬機(jī)上,解壓SQL developer ,雙擊運(yùn)行。 2.為了確保存儲過程或函數(shù)是可調(diào)試的,右鍵“以編譯并進(jìn)行調(diào)試”,點(diǎn)擊紅色按鈕“調(diào)試” 3.利用已寫好的調(diào)用函數(shù)進(jìn)行調(diào)試。查看全部
-
存儲函數(shù)與存儲過程的區(qū)別就是存儲函數(shù)有return 返回值。查看全部
-
數(shù)據(jù)庫對象查看全部
-
create or replace procedure query (eno in numbr, pename out varchar2, psal out number, pjob out varchar2 ) as begin select ename,sal,empjob into pename,psal,pjob from emp where mpno=eno; end查看全部
-
create or replace function queryempincom(eno in numbr) as --定義變量保存員工的薪水和獎金 psal emp.sal%type; pcomm emp.comm%type; begin select sal,comm into pasl,pcomm from emp where empno=eno; return psal*12+pcomm; end;查看全部
-
create or replace procedure raisesalary (eno in number) is --定義一個變量保存漲錢的薪水 psal emp.sal%type; begin select sal into psal from emp where empno=eno; update emp set sal=sal+100 where mpno=eno; 需要提交?--注意 一般不在存儲過程或者存儲函數(shù)中,commit 和 rollback dbms_outut.put_line('漲前:'||psal|| '漲后:'||(psal+100)); end查看全部
-
調(diào)用存儲過程: 1.exec 2.begin查看全部
-
create or reaplace produrce money(eno in number) as psal emp.sal%type; select sal into pasal from emp where empno=eno; dbms_output.put_line('漲前:'||pasal||'漲后:'||(pasal+100)); begin money(1666); commit; end;查看全部
-
指存儲在數(shù)據(jù)庫中供所有用戶程序調(diào)用的子程序叫存儲過程、存儲函數(shù)。查看全部
-
數(shù)據(jù)庫對象:表、視圖、索引、序列、同義詞、存儲過程、存儲函數(shù)…… ·存儲過程和存儲函數(shù):指存儲在數(shù)據(jù)庫中供所有用戶程序調(diào)用的子程序叫存儲過程、存儲函數(shù)。 ·相同點(diǎn):完成特定功能的程序 ·不同點(diǎn):是否用return語句返回值。存儲函數(shù)可以return返回值。存儲過程不可以通過return語句返回函數(shù)值。查看全部
-
create or replace procedure 過程名(參數(shù)列表) as查看全部
-
create or replace procedure raisesalary(eno in number) as psal emp.sal%type; begin select sal into psal from emp where empno=eno; dbms_output.put_line('漲前:'||psal||' 漲后:'||(psal+100)); end; / begin raisesalary(7839); end;查看全部
-
在out參數(shù)中使用光標(biāo) ·申明包結(jié)構(gòu) 包頭(申明) 包體(實(shí)現(xiàn)) ·案例:查詢某個部門中所有員工的所有信息 //ref(reference引用) cursor(光標(biāo)) #包頭 create or replace package mypackage as type empcursor is ref cursor; procedure queryEmpList(dno in number,empList out empcursor); end mypackage; #包體 create or replace package body mypackage as procedure queryEmpList(dno in number,empList out empcursor) as begin open empList for select * from emp where deptno=dno; end queryEmpList; end mypackage; ***********包體需要實(shí)現(xiàn)包頭中聲明的所有方法*********************查看全部
舉報(bào)
0/150
提交
取消