Oracle 12C - JSON_TABLE 列中的 %TYPE 不起作用

Oracle 12C - %TYPE in JSON_TABLE column doesn't work

我正在尝试将 JSON 数组保存为数据库行:

   INSERT INTO log (
      "uuid",
      "date",
      "msg",
      "level"
   )
      WITH t ( log ) AS (
         SELECT
            JSON_QUERY('[{"uuid": "20000000-0000-0000-0000-000000000000", "date": "2021-10-17", "msg":"aaaa", "level": "debug" },
                     {"uuid": "20000000-0000-0000-0000-000000000000", "date": "2021-10-17", "msg":"bbbb", "level": "debug" }]'
            , '$')
         FROM
            dual
      )
      SELECT
         "uuid",
         "date",
         "msg",
         "level"
      FROM
         t
         CROSS JOIN
            JSON_TABLE ( log, '$'
               COLUMNS (
                  NESTED PATH '$[*]'
                     COLUMNS (
                        "uuid" VARCHAR2 ( 36 ) PATH '$.uuid',
                        "date" DATE PATH '$.date',
                        "msg" VARCHAR2 ( 1024 ) PATH '$.msg',
                        "level" VARCHAR2 ( 5 ) PATH '$.level'
                     )
               )
            )

当我尝试使用 %type:

                  NESTED PATH '$[*]'
                     COLUMNS (
                        "uuid" VARCHAR2 ( 36 ) PATH '$.uuid',
                        "date" my_table.date%type PATH '$.date',
                        "msg" VARCHAR2 ( 1024 ) PATH '$.msg',
                        "level" VARCHAR2 ( 5 ) PATH '$.level'
                     )

我收到一个错误:

SQL Error: ORA-40484: invalid data type for JSON_TABLE column
40484. 00000 -  "invalid data type for JSON_TABLE column"
*Cause:    A column in the provided JSON_TABLE had an unsupported data type.
*Action:   Provide a supported data type.

尽管列中的类型也是 date

类型char(36)也不起作用,所以我必须使用VARCHAR2(36)

在这种情况下可以使用%type吗?

JSON_TABLE documentation 给出了 JSON 查询列子句的语法:

从 link 到 JSON_value_return_type documentation 告诉您允许的数据类型:

鉴于此,不,您不能使用 %TYPECHAR,因为 JSON_TABLE 语法不允许。