可用版本: Dev (3.21) | 最新 (3.20) | 3.19 | 3.18 | 3.17 | 3.16 | 3.15 | 3.14 | 3.13 | 3.12 | 3.11

Oracle 成员过程

适用于 ✅ 开源版   ✅ 专业版   ✅ 企业版

Oracle UDTs 可以具有面向对象的结构,包括成员函数和过程。 使用 Oracle,您可以执行以下操作

CREATE OR REPLACE TYPE u_author_type AS OBJECT (
  id NUMBER(7),
  first_name VARCHAR2(50),
  last_name VARCHAR2(50),

  MEMBER PROCEDURE LOAD,
  MEMBER FUNCTION counBOOKs RETURN NUMBER
)

-- The type body is omitted for the example

这些成员函数和过程可以简单地映射到 Java 方法

// Create an empty, attached UDT record from the DSLContext
UAuthorType author = create.newRecord(U_AUTHOR_TYPE);

// Set the author ID and load the record using the LOAD procedure
author.setId(1);
author.load();

// The record is now updated with the LOAD implementation's content
assertNotNull(author.getFirstName());
assertNotNull(author.getLastName());

有关 UDT 的代码生成的更多详细信息,请参阅手册中关于用户定义类型和代码生成的部分。

引用此页

反馈

您对此页面有任何反馈吗? 我们很乐意听到!

The jOOQ Logo