oracle儲存過程學習

2021-08-31 17:57:57 字數 510 閱讀 8694

create or replace procedure 儲存過程名(param1 in type,param2 out type) 

as 變數1 型別(值範圍);

變數2 型別(值範圍);

begin

select count(*) into 變數1 from 表a where列名=param1;

if (判斷條件) then

select 列名 into 變數2 from 表a where列名=param1;

dbms_output。put_line(『列印資訊』);

elsif (判斷條件) then

dbms_output。put_line(『列印資訊』);

else

raise 異常名(no_data_found);

end if;

exception

when others then

rollback;

end;

Oracle儲存過程學習

儲存過程是一組為了完成特定功能的 sql 語句塊,經編譯後儲存在資料庫中,使用者通過指定儲存過程的名字並給出引數 如果該儲存過程帶有引數 來執行它。1 儲存過程和函式以命名的資料庫物件形式儲存於資料庫當中。儲存在資料庫中的優點是很明顯的,因為 不儲存在本地,使用者可以在任何客戶機上登入到資料庫,並呼...

Oracle儲存過程學習

儲存過程建立語法 create or replace procedure 儲存過程名 param1 in type,param2 out type as 變數1 型別 值範圍 變數2 型別 值範圍 begin select count into 變數1 from 表a where列名 param1 ...

Oracle儲存過程學習

儲存過程建立語法 create or replace procedure 儲存過程名 param1 in type,param2 out type as 變數1 型別 值範圍 變數2 型別 值範圍 begin select count into 變數1 from 表a where列名 param1 ...