@634

Oracle PL/SQL - 例外処理

Advertisement

exception ブロック

例外(エラー)が発生すると、処理は exception ブロックへと移動する
declare
    -- 定義
begin
    -- 処理
exception
    -- 例外
end;

when - then

発生した例外の種類ごとに処理を分離することが可能。
-- 略
exception
    when data_not_found then
        -- data_not_found 例外が発生した場合の処理
    when others then
        -- 上記以外の例外が発生した場合の処理
end;

ユーザ定義

declare
    user_exception exception; -- 例外変数
begin
    -- 略

    if 〜 then
        raise user_exception;-- 例外を発生させる
    end if;
exception
    when user_exception then
        -- 例外処理
end;

Advertisement

ショートカット

634トップページ
このカテゴリのトップページに戻る
634ラボ
   UIコレクションギャラリー

サイト検索

Google

Web サイト内

Y!ログール