freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

oracle最全最有價值的知識點(diǎn)-在線瀏覽

2024-10-01 12:49本頁面
  

【正文】 程序舉例: 1* begin (39。)。 / 2* declare v_name varchar2(20)。guanghua39。 end。 begin num := 2/num。 exception when others then (39。)。 變量聲明的規(guī)則 1. 變量名不能夠使用保留字,如from,select等 2. 第一個字符必須是字母 3. 變量名最多包含30個字符 4. 不要與數(shù)據(jù)庫的表或者列同名 5. 每一行只能聲明一個變量 變量類型: * binary_integer: 整數(shù),用來記數(shù)而不是用來表示字段類型。 變量聲明:使用%type屬性 例: declare v_empno number(4)。 將v_empno2 的類型設(shè)置為 表emp字段empno的類型 v_empno3 v_empno2%type。test39。end。 declare type type_table_emp_empno is table of %type index by binary_integer 。 定義數(shù)組變量: v_empnos type_table_emp_empno 。 v_empnos(1) :=2345。 打印輸出。 Record 變量類型: declare type type_record_dept is record 聲明一種record類型 ,此類型中存放多個數(shù)據(jù) ( deptno %type, dname %type, loc %type )。 聲明一個type_record_dept類型的變量叫做:v_dept。 := 39。 :=39。 (||39。||||39。||)。 還可以使用%rowtype 聲明record變量; declare v_temp v_dept%rowtype。 使用查詢語句的時候返回且只返回一個值。 v_sal %type。 (v_ename ||39。|| v_sal)。 declare v_deptno %type :=10。 begin update emp2 set sal=sal/2 where deptno = v_deptno。條記錄被影響。)。(若是select 語句,有多少個值就有多少記錄被影響) mit。等語句后要提交數(shù)據(jù)。 中調(diào)用ddl語句(create table): begin execute immediate 39。39。39。 執(zhí)行 立即 創(chuàng)建表t 注意單引號里面的單引號要改為兩個單引號 end。 begin select sal into v_sal from emp where empno=7839。 elsif(v_sal2500) then update emp set sal=sal/2 where empno=7839。 end if。 end。 begin loop (i)。 exit when(i=11)。 end。 begin while i11 loop (i)。 end loop。for循環(huán) begin for k in 1..10 loop (k)。 for k in reverse 1..10 loop --倒序 (k)。 end。 begin select empno into v_temp from emp where deptno = 10。太多記錄了39。 when others then (39。)。 其它異常: no_date_found 沒有找到數(shù)據(jù); * 首先創(chuàng)建一個表 create table errorlog ( id number primary key, errcode number, errmsg varchar2(1024), errdate date )。declarev_temp number(4)。v_errcode number。beginselect empno into v_temp from emp where deptno=10。mit?;貪L v_errcode := SQLCODE。錯誤的原因insert into errorlog values(,v_errcode,v_errmsg,sysdate)。end。//聲明游標(biāo); v_emp c%rowtype。 loop fetch c into v_emp。 ()。 end loop。 end。 游標(biāo)用while循環(huán): 游標(biāo)遍歷中最實用的循環(huán)是for 循環(huán) 無須聲明v_emp for循環(huán)開始的時候自動聲明,并且打開游標(biāo)c, 而且不容易出錯。 begin for v_emp in c loop ()。 帶參數(shù)的游標(biāo) declare cursor c (v_deptno %type ,v_job %type) is select ename ,sal from emp where deptno = v_deptno and job = v_job。CLERK39。 END LOOP。//游標(biāo)C是儲存了ename,sal的記錄集,只是它帶了兩個參數(shù)(v_deptno,v_job,用于傳遞到where句后的參數(shù))相當(dāng)于函數(shù)。: 帶有名字的plsql的程序塊直接寫名字就能執(zhí)行了 創(chuàng)建一個過程 例: create or replace procedure p is (程序的過程,pl/sql 語句塊) / 執(zhí)行完后此時只是創(chuàng)建了存儲過程,期間沒有執(zhí)行內(nèi)部的程序代碼 執(zhí)行存儲過程p: exec p。 end。存儲過程有錯oracle也會創(chuàng)建的,但是會報錯,得改。默認(rèn)是in is begin if(v_av_b) then v_ret := v_a。 end if。* end。 v_a number :=4。 v_temp number :=5。 (v_ret)。* end。 elsif(v_sal2750) then return 。 end if。 / 創(chuàng)建完函數(shù)后,用法和max(),min()等在 sql中的用法一樣。 然后創(chuàng)建一個觸發(fā)器 trigger emp2_trig。 觸發(fā)器可用于數(shù)據(jù)的一致性。(deptno有被其他表參考,改了其他表此字段就沒意義了,也得跟著改,用觸發(fā)器)如下: create trigger trig。 end。 創(chuàng)建完觸發(fā)器后,執(zhí)行數(shù)據(jù)庫操作后會被記錄在emp2_log里。 v_prestr varchar2(100) := 39。 begin for i in 1..v_level loop v_prestr := v_prestr || 39。||是連接上的意思。 for v_article in c loop (v_prestr || )。 end if。 end。 求部門的平均新水表1 》 求部門的平均薪水等級表2 》 求部門的平均薪水最低的部門編號3 ——》求部門的平均薪水最低的部門名稱4; *表1. select deptno , avg(sal) avg_sal from emp group by deptno *表2. select ,grade from salgrade join (select deptno , avg(sal) avg_sal from emp group by deptno) avg_sal_t on ( between and ) *表3.select deptno ,grade from ( select ,grade from salgrade join (select deptno , avg(sal) avg_sal from emp group by deptno) avg_sal_t on ( between and ))wheregrade = ( select min(grade) from( select ,grade from salgrade join (select deptno , avg(sal) avg_sal from emp group by deptno) avg_sal_t on ( between and ) )) *表4.select ,from dept join ( select deptno ,grade from ( select ,grade from salgrade join (select deptno , avg(sal) avg_sal from emp group by deptno) avg_sal_t on ( between and ) ) where grade = ( select min(grade) from( select ,grade from
點(diǎn)擊復(fù)制文檔內(nèi)容
環(huán)評公示相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1