



下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、1、 函數(shù)的聲明及使用方法語法:create or replace function function_name(argumentin|out|in outtype,.argument in|out|in outtype)return return_type is|asfunction_body例子:例1:函數(shù)不帶參數(shù)CREATE OR REPLACE FUNCTION TEST1 return char isbeginreturn '0' end;運行方法1:在dos下運行步驟1:SQL> variable t1 char(1) /聲明變量步驟2:SQL> exe
2、c:t1:=test1 /傳入?yún)?shù)并執(zhí)行函數(shù)步驟3:SQL> print t1 /打印結(jié)果例2:(函數(shù)帶一個參數(shù))create or replace function test2(t1 char)return char ist char(1);begin t:=t1; return t;end;運行方法1:在dos下運行步驟1:SQL> variable t2 char(1) /聲明變量步驟2:SQL> exec:t2:=test2('5') /傳入?yún)?shù)并執(zhí)行函數(shù)步驟3:SQL> print t2 /打印結(jié)果例3:(函數(shù)帶多個參數(shù))create or r
3、eplace function test3(t1 number,t2 number)return number ast number;begint:=t1+t2;return t;end;運行方法1:在doc下運行步驟1:SQL> variable t3 number /聲明變量步驟2:SQL> exec:t3:=test3(2,3) /傳入?yún)?shù)并執(zhí)行函數(shù)步驟3:SQL> print t3 /打印結(jié)果2、 存儲過程的聲明及使用方法語法:create or replace procedure procedure_name(argumentin|out|in out)type,a
4、rgumentin|out|in |outtype)is|asprocedure_body例子:例1:(不帶參數(shù)的存儲過程)create or replace procedure test4isbegin null;DBMS_OUTPUT.put_line('dddddd');/輸出end;運行方法1:在doc下運行步驟1 SQL> set serveroutput on size 10000/用于打開輸入步驟2:SQL> exec test4 例2:(帶一個參數(shù)的存儲過程)create or replace procedure test5(t1 in varcha
5、r)ist varchar2(10);begint:=t1;end;運行方法1:在doc下運行步驟1:SQL> exec test5('0000')例3:(帶多個參數(shù)的存儲過程)create or replace procedure test6(t1 in varchar2,t2 out varchar2,t3 in out varchar2)ist varchar2(100);begin t:=111;end;運行方法1:在doc下運行步驟1:運行方法2:不在doc下運行set serveroutput on size 10000;/用于打開輸入declare tt v
6、archar2(10); ttt varchar2(10);beginttt:='1'test6('0000',tt,ttt);dbms_output.put_line(tt);/輸出end;3、觸發(fā)器的聲明及使用方法語法:create or replace trigger trigger_namebefore|alter trigger_event on table_namefor each rowwhen trigger_conditiontrigger_body例子:declare QYZCH VARCHAR2(26); count_zxjbxx numb
7、er;begin count_zxjbxx:=0; if :new.ZZJGDM is not null and :new.NSRSBH_G is not null and :new.NSRSBH_D is not null and :new.ZTDM='0000000000' and :new.YZXDM='0000000000' then select count(*) into count_zxjbxx from zx_jbxx where QYZCH=:new.QYZCH; if count_zxjbxx<=0 then insert into zx_jbxx values(:new.ZZJGDM,:new.QYZCH,:new.NSRSBH_G,:new.NSRSBH_D,:new.QYMC,:new.FDDBR,:new.SFZJHM,:new.ZS, :new.YZBM,:new.LXDH,:new.HY_DM,:new.QYLX_DM,:new.QZXKJYXM,:new.YBJYXM,:new.DJJG_DM,:new.SWDJRQ_G, :new.SWDJRQ_D,:new.SWDJJG_G,:new.SWDJJG_D,:new.GGBZ,:new.JGZCLX,:new.CLRQ,:new.BZRQ,'10
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 【正版授權(quán)】 ISO/IEC TS 7339:2024 EN Information technology - Cloud computing - Overview of platform capabilities type and platform as a service
- 【正版授權(quán)】 ISO 37111:2024 EN Sustainable cities and communities - Urban settlements - Guidance for a flexible approach to phased implementation of ISO 37101
- 2025年度大清包勞務(wù)合同(市政道路施工管理協(xié)議)
- 2025年度廢鐵進出口代理與運輸服務(wù)合同
- 2025年度科技展會場地布置及維護服務(wù)合同
- 2025年起動腳蹬桿項目建議書
- 2025年超低頻振動標準合作協(xié)議書
- 多元化教學(xué)方法實施方案計劃
- 倉庫工作總結(jié)計劃指引
- 社會媒體策略的實踐與回顧計劃
- 福建省醫(yī)院大全
- EPC項目質(zhì)量保證措施
- GB/T 16659-2024煤中汞的測定方法
- 2023-2024學(xué)年安徽省合肥市瑤海區(qū)八年級(下)期中數(shù)學(xué)試卷(含解析)
- 【體能大循環(huán)】聚焦體能循環(huán)-探索運動奧秘-幼兒園探究體能大循環(huán)有效開展策略課件
- 《Unit 10 You're supposed to shake hands》單元檢測題及答案
- 華為云DevSecOps質(zhì)量效能白皮書
- TSN 解決方案白皮書
- 完整2024年開工第一課課件
- 貨運車輛駕駛員安全培訓(xùn)內(nèi)容資料完整
- 風神汽車4S店安全生產(chǎn)培訓(xùn)課件
評論
0/150
提交評論