SQL 中用于处理来自 Oracle 的嵌套用户定义 table 类型的选项是什么?
What is the option in SQL to handle nested user defined table type from Oracle?
我们正在从 Oracle 迁移到 Azure SQL。在 Oracle 中有用户定义的 table 嵌套类型。例如,Manager Table Type 将 Employee Table
Type 作为列之一。
据我所知 SQL server
不允许嵌套 table 类型。也许是因为它打破了正常形式,但 Oracle
允许它。
现在的挑战是 table 类型对象之一需要作为参数从 Java 传递到存储过程。我们如何在 SQL server
中处理这个问题而不展平 Java
中的结构。
我想传递所有 table 对象,包括父对象和子对象,然后声明各种 sql tables 类型以在 SQL SP 中接收它们。但挑战在于父级将在传入参数中引用子级,我如何在 SQL?
中处理它
Now the challenge is one of the table type object needs to be passed on to a stored procedure as a parameter from Java. How can we handle this in SQL server without flattening the structure in Java.
使用JSON. JSON documents (and XML too for that matter) allow arbitrary data shapes to be passed from the client to the SQL Server and consumed there with OPENJSON。并且不需要为要传递给服务器的每个不同数据形状创建用户定义的 table 类型。
如果 Java 开发人员更愿意使用 XML,那也行。
我们正在从 Oracle 迁移到 Azure SQL。在 Oracle 中有用户定义的 table 嵌套类型。例如,Manager Table Type 将 Employee Table
Type 作为列之一。
据我所知 SQL server
不允许嵌套 table 类型。也许是因为它打破了正常形式,但 Oracle
允许它。
现在的挑战是 table 类型对象之一需要作为参数从 Java 传递到存储过程。我们如何在 SQL server
中处理这个问题而不展平 Java
中的结构。
我想传递所有 table 对象,包括父对象和子对象,然后声明各种 sql tables 类型以在 SQL SP 中接收它们。但挑战在于父级将在传入参数中引用子级,我如何在 SQL?
Now the challenge is one of the table type object needs to be passed on to a stored procedure as a parameter from Java. How can we handle this in SQL server without flattening the structure in Java.
使用JSON. JSON documents (and XML too for that matter) allow arbitrary data shapes to be passed from the client to the SQL Server and consumed there with OPENJSON。并且不需要为要传递给服务器的每个不同数据形状创建用户定义的 table 类型。
如果 Java 开发人员更愿意使用 XML,那也行。