定義:儲存過程(stored procedure )是一組為了完成特定功能的sql 語句集,經編譯後儲存在資料庫中。使用者通過指定儲存過程的名字並給出引數
(如果該儲存過程帶有引數)來執行它。儲存過程是資料庫中的乙個重要
物件,任何乙個設計良好的資料庫應用程式都應該用到儲存過程。
儲存過程是由流控制和sql 語句書寫的過程,這個過程經編譯和優化後
儲存在資料庫伺服器中,應用程式使用時只要呼叫即可。在oracle 中,
若干個有聯絡的過程可以組合在一起構成程式包。
優點:儲存過程只在創造時進行編譯,以後每次執行儲存過程都不需再重新編譯,而一般sql語句每執行一次就編譯一次,所以使用儲存過程可提高資料庫執行速度。
2.當對資料庫進行複雜操作時(如對多個表進行update、insert、query、delete時),可將此複雜操作用儲存過程封裝起來與資料庫提供的事務處理結合一起使用。
3.儲存過程可以重複使用,可減少資料庫開發人
4.安全性高,可設定只有某使用者才具有對指定儲存過程的使用權。
oralce儲存過程的基本語法
1.基本結構 create or replace procedure 儲存過程名字 引數1 in number,引數2 in number is 變數1 integer 0 變數2 date begin end 儲存過程名字 2.select into statement 將select查詢的結果存...
oralce中儲存過程 Insert
create or replace procedure insert user information p user login name in varchar2,p user password in varchar2,p user name in varchar2,p user telephone...
oralce儲存過程使用動態sql
在儲存過程中,我想根據條件拼裝sql,這個時候select xx into v xx這樣就不行了,返回不了值。要使用 execute immediate v sql into v access number create or replace procedure p access user v st...