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 への移行検証~Oracle ユーザー定義データ型編~

Last updated at Posted at 2023-04-09

概要

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

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

ユーザー定義データ型について

ユーザー定義データ型を作成することができる。

ユーザー定義データ型を、次のユースケースで利用されることがある。

  1. テーブル関数

参考リンク

Azure SQL Database への移行

SSMA による変換

ユーザー定義データ型の変換をサポートしておらず、手動での変換が必要となる。

移行方針

特になし。

変換例

変換例 1 レコードのサンプル

Oracle Database のコード
CREATE OR REPLACE TYPE nested_type IS TABLE OF NVARCHAR2(10);
/
CREATE OR REPLACE FUNCTION table_funciton_001
RETURN nested_type
IS
  nest nested_type := nested_type();
BEGIN
  FOR i IN 1..5 LOOP
    nest.extend;
    nest(i) := i || 'つ目の処理を実施';
  END LOOP;
RETURN nest;
END;
SELECT * FROM table(table_funciton_001);
Azure SQL Database への変換

次の SSMA Issues が発生する。

ID	Message	Description
O2SS0456	User defined types conversion is not supported	O2SS0456: Conversion of 'USER_DEF_TYPE_001' failed because user defined type is not supported.
CREATE PROCEDURE SSMA.TABLE_FUNCITON_001$IMPL  
   @return_value_argument ssma_oracle.CollectionIndexString  OUTPUT
AS 
   BEGIN

      DECLARE
         @NEST ssma_oracle.CollectionIndexString 
            /* 
            *   SSMA error messages:
            *   O2SS0339: Cannot convert usage of standalone user-defined type SSMA.NESTED_TYPE.
= SSMA.NESTED_TYPE
            */



      DECLARE
         @I int

      SET @I = 1

      WHILE @I <= 5
      
         BEGIN

            EXECUTE ssma_oracle.ExtendCollection @NEST  OUTPUT

            SET @NEST = ssma_oracle.SetCollection_varchar_varchar(@NEST, @I, ISNULL(CAST(@I AS nvarchar(max)), '') + 'つ目の処理を実施')

            SET @I = @I + 1

         END

      SET @return_value_argument = @NEST

      RETURN 

   END
GO
/* 
*   SSMA error messages:
*   O2SS0200: Select list item * cannot be converted.
*   O2SS0482: Conversion of following TABLE expression is not supported: TABLE(table_funciton_001)

SELECT 
FROM  AS fci
*/
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?