0
トリガーをテストするスクリプトを作成しますが、変更をロールバックすると奇妙なエラー・メッセージが表示されます。ここ はテーブルが蒸発するselect文によって返された行を約半分までスクロールした後、テスト・スクリプトoracle11gでロールバックした後に行を挿入するときに奇妙なエラーが発生する
insert into prescription values(
143, 115,
to_date('January 15, 1989, 11:00 A.M.',
'Month dd, YYYY, HH:MI A.M.',
'NLS_DATE_LANGUAGE = American'),
5, 12, 'hours', 12);
select * from prescription;
rollback;
であり、私は、エラーメッセージによって打撃を受ける:
ORA-01002: fetch out of sequence
01002. 00000 - "fetch out of sequence"
*Cause: This error means that a fetch has been attempted from a cursor
which is no longer valid. Note that a PL/SQL cursor loop
implicitly does fetches, and thus may also cause this error.
There are a number of possible causes for this error, including:
1) Fetching from a cursor after the last row has been retrieved
and the ORA-1403 error returned.
2) If the cursor has been opened with the FOR UPDATE clause,
fetching after a COMMIT has been issued will return the error.
3) Rebinding any placeholders in the SQL statement, then issuing
a fetch before reexecuting the statement.
*Action: 1) Do not issue a fetch statement after the last row has been
retrieved - there are no more rows to fetch.
2) Do not issue a COMMIT inside a fetch loop for a cursor
that has been opened FOR UPDATE.
3) Reexecute the statement after rebinding, then attempt to
fetch again.
私は、スクリプトを実行した場合ロールバックを行わずにロールバックを個別に発行することもできます。しかしそれは後で迷惑なテストユニットに向かうだろう。
挿入を文として実行し、文を文として実行し、グリッド・ビューからワークシートに戻し、ロールバックを文として実行してから、グリッド・ビューに戻ってスクロールします。スクリプトを書く場合は、個々のステートメントではなくスクリプトとして実行してみましょう。 –
私は1つのワークシートから実行するinsert、query、およびrollback文を持っています。私は何も切り替える必要はありません。 SQL開発者はクエリ結果をウィンドウに返します。私は、ワークシートに一連の文を書くことがスクリプトだと思った。 –
OK、3つのステートメントを選択/強調表示し、すべてのステートメントを一緒に実行(コントロール入力)します。その効果は同じです。クエリー結果ウィンドウを簡単に表示することもできます。 'スクリプト実行'(F5)を選択した場合、結果はクエリ結果ウィンドウではなくスクリプト出力ウィンドウに表示されます(デフォルトでは5000、ツール - >設定 - >データベース - >ワークシート)。すべてのフェッチが完了するまでロールバックは発行されないため、エラーは発生しません。特にグリッド出力が必要な場合があります。 –