0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

SQL Server Migration Assistant for Oracle による Oracle Database から Azure SQL Database への移行検証~DBMS_OUTPUT パッケージ編~

Last updated at Posted at 2023-04-09

概要

本記事の位置付けについて

Oracle Database から Azure SQL Database へ SQL Server Migration Assistant for Oracle (SSMA)によるプログラム移行検証結果の一部である。次の記事にて個別機能別記事へのリンクを整理している。

DBMS_OUTPUT パッケージについて

Oracle Database ドキュメントにて、次のように記載されている。

ストアド・プロシージャ、パッケージおよびトリガーからメッセージを送信できます。

引用元:120 DBMS_OUTPUT (oracle.com)

DBMS_OUTPUT.PUT後にDBMS_OUTPUT.NEW_LINEを実行しているコードは、DBMS_OUTPUT.PUT_LINEとほぼ同様の動作となる。

BEGIN
	DBMS_OUTPUT.PUT('START');
	DBMS_OUTPUT.NEW_LINE;
END;

参考リンク

  • ホワイトペーパー
    • Guide to Migrating from Oracle to SQL Server 2014 and Azure SQL Database

Azure SQL Database への移行

SSMA による変換

次の処理のみ変換をサポートしている。

  • PUT_LINE

変換例

Oracle SQL Developer のセットアップ

  1. Oracle SQL Developer 起動後、 表示 -> DBMS 出力を選択
  2. DBMS 出力タブにて、+を選択し、接続にて接続先を設定の上、OKを選択。

変換例 1 PUT_LINE

Oracle Database のコード
BEGIN
	DBMS_OUTPUT.PUT_LINE('START');
END;
Azure SQL Database への変換

SSMA により次のように変換される。

BEGIN
   PRINT 'START'
END
GO

変換例 2 PUT と NEWNEW_LINE

Oracle Database のコード
BEGIN
	DBMS_OUTPUT.PUT('START');
	DBMS_OUTPUT.NEW_LINE;
END;
Azure SQL Database への変換

SSMA により次のような Issues が発生する。

BEGIN

   /* 
   *   SSMA error messages:
   *   O2SS0050: Conversion of identifier 'DBMS_OUTPUT.PUT(CHAR)' is not supported.

   EXECUTE DBMS_OUTPUT.PUT('START')
   */



   /* 
   *   SSMA error messages:
   *   O2SS0050: Conversion of identifier 'DBMS_OUTPUT.NEW_LINE' is not supported.

   EXECUTE DBMS_OUTPUT.NEW_LINE
   */



   DECLARE
      @db_null_statement int

END
GO

次のように手動変換を行う。あるいは、Oracle database のコードを、DBMS_OUTPUT.PUT_LINEに書き換えて変換を実施する。

BEGIN
   PRINT 'START'
END
GO
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?