Updated on 2025-09-04 GMT+08:00

Preparations

  • JDK version: 1.7 or later.
  • Database environment: GaussDB 503.0 or later.
  • JDBC driver environment:

    Refer to "Application Development Guide > Development Based on JDBC > Development Procedure > Obtaining the JAR Package of the Driver and Configuring the JDK Environment" in Developer Guide.

  • Data: Create a user-defined type and stored procedure, as follows:
    // Create a user-defined type, PUBLIC.COMPFOO, that includes two records.
    gaussdb=# CREATE TYPE PUBLIC.COMPFOO AS(
        ID INTEGER,
        NAME TEXT
    );
    CREATE TYPE
    // Create a user-defined table type, PUBLIC.COMPFOO_TABLE.
    gaussdb=# CREATE TYPE PUBLIC.COMPFOO_TABLE IS TABLE OF PUBLIC.COMPFOO;
    CREATE TYEP
    // Create the stored procedure public.test_proc with two input parameters of a user-defined type and two output parameters of a user-defined type.
    gaussdb=# CREATE OR REPLACE PROCEDURE public.test_proc(
        IN INPUT_COMPFOO PUBLIC.COMPFOO,
        IN INPUT_COMPFOO_TABLE PUBLIC.COMPFOO_TABLE,
        OUT OUTPUT_COMPFOO PUBLIC.COMPFOO,
        OUT OUTPUT_COMPFOO_TABLE PUBLIC.COMPFOO_TABLE
    )
    AS
    BEGIN
        OUTPUT_COMPFOO := INPUT_COMPFOO;
        OUTPUT_COMPFOO_TABLE := INPUT_COMPFOO_TABLE;
    END;
    /   
    CREATE PROCEDURE