CREATE TYPE o AS OBJECT (...);CREATE TYPE t AS TABLE OF OBJECT (...);
--
You received this message because you are subscribed to the Google Groups "jOOQ User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
create or replace TYPE NUMBER_22_TABLE
AS TABLE OF NUMBER( 22 )
Function get_flattened_roles( p_staffMemberId In Integer )
Return number_22_table
Is
Object field = AuthUtil.getFlattenedRoles( context.configuration(), BigInteger.valueOf(1));
Exception in thread "main" org.jooq.exception.DataAccessException: SQL [begin ? := "IRIS"."AUTH_UTIL"."GET_FLATTENED_ROLES"("P_STAFFMEMBERID" => ?); end;]; Ungültiger Spaltentyp: 1111 at org.jooq.impl.Utils.translate(Utils.java:1477) at org.jooq.impl.DefaultExecuteContext.sqlException(DefaultExecuteContext.java:505) at org.jooq.impl.AbstractRoutine.executeCallableStatement(AbstractRoutine.java:312) at org.jooq.impl.AbstractRoutine.execute(AbstractRoutine.java:261) at org.jooq.impl.AbstractRoutine.execute(AbstractRoutine.java:218) at com.ge.med.medora.services.dbaccess.iris.packages.AuthUtil.getFlattenedRoles(Unknown Source) at Test.<init>(Test.java:36) at Test.main(Test.java:41)Caused by: java.sql.SQLException: Ungültiger Spaltentyp: 1111 at oracle.jdbc.driver.OracleStatement.getInternalType(OracleStatement.java:3916) at oracle.jdbc.driver.OracleCallableStatement.registerOutParameterInternal(OracleCallableStatement.java:135) at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:304) at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:393) at oracle.jdbc.driver.OracleCallableStatementWrapper.registerOutParameter(OracleCallableStatementWrapper.java:1568) at org.jooq.tools.jdbc.DefaultCallableStatement.registerOutParameter(DefaultCallableStatement.java:85) at org.jooq.impl.AbstractRoutine.registerOutParameters(AbstractRoutine.java:589) at org.jooq.impl.AbstractRoutine.executeCallableStatement(AbstractRoutine.java:298) ... 5 more
BEGINEXECUTE IMMEDIATE 'DROP PACKAGE p';EXCEPTION WHEN OTHERS THEN NULL;END;/BEGINEXECUTE IMMEDIATE 'DROP TYPE NUMBER_22_TABLE';EXCEPTION WHEN OTHERS THEN NULL;END;/CREATE OR REPLACE TYPE NUMBER_22_TABLEASTABLE OF NUMBER( 22 );/CREATE PACKAGE pASFUNCTION get_flattened_roles(p_staffMemberId IN INTEGER )RETURN number_22_table;END p;/CREATE PACKAGE BODY pASFUNCTION get_flattened_roles(p_staffMemberId IN INTEGER )RETURN number_22_tableISBEGINRETURN NUMBER_22_TABLE(1, 2, 3, 4);END get_flattened_roles;END p;/
[INFO] Generating package : TEST.P[INFO] Generating routine : GetFlattenedRoles.java
public class P extends org.jooq.impl.PackageImpl {/**
* Call <code>TEST.P.GET_FLATTENED_ROLES</code>*/public static org.jooq.test.oracle.generatedclasses.test.udt.records.Number_22TableRecordgetFlattenedRoles(org.jooq.Configuration configuration, java.math.BigInteger pStaffmemberid) {
System.out.println(P.getFlattenedRoles(configuration, BigInteger.ONE));
Output: TEST.NUMBER_22_TABLE(1, 2, 3, 4)
Hi!
Excellent points to check.No, the type is not in the same schema. It's in a different one, with a public synonym which probably doesn't help. I wonder how the generator would find that type?!
CREATE PUBLIC SYNONYM TTT FOR TEST.NUMBER_22_TABLE;
/CREATE PACKAGE pASFUNCTION get_flattened_roles(p_staffMemberId IN INTEGER )
RETURN TTT;
END p;/CREATE PACKAGE BODY pASFUNCTION get_flattened_roles(p_staffMemberId IN INTEGER )
RETURN TTTISBEGINRETURN TTT(1, 2, 3, 4);
END get_flattened_roles;END p;/
select type_owner, type_namefrom all_argumentswhere owner = 'TEST'and object_name = 'GET_FLATTENED_ROLES'and package_name = 'P'and position = 0
TYPE_OWNER | TYPE_NAME
-----------+----------PUBLIC | TTT
And yes, it could be the re-write.The generator created a method that returns Object which already made me suspicious. When I examine the DataType of the Field it is TABLE though.
Hi Lukas,wow you're fast. Yes, it was caused by the type living in a different schema.I created the type in the same schema and now the generator generated properly Number_22TableRecord as return type.
So thanks for creating the issue. Remember ... when I talked about our special needs? :o)
--
CREATE SYNONYM Z.C FOR MY_SCHEMA.MY_TYPE;CREATE SYNONYM Y.B FOR Z.C;CREATE SYNONYM X.A FOR Y.B;
(X.A, MY_SCHEMA.MY_TABLE)(Y.B, MY_SCHEMA.MY_TABLE)(Z.C, MY_SCHEMA.MY_TABLE)
SELECT "s3"."OWNER","s3"."SYNONYM_NAME",connect_by_root "s3"."TABLE_OWNER" "TABLE_OWNER",connect_by_root "s3"."TABLE_NAME" "TABLE_NAME",SUBSTR(((((sys_connect_by_path((("s3"."TABLE_OWNER"|| '.')|| "s3"."TABLE_NAME"), ' <- ')|| ' <- ')|| "s3"."OWNER")|| '.')|| "s3"."SYNONYM_NAME"), 5)FROM (SELECT "s2"."OWNER","s2"."SYNONYM_NAME","s2"."TABLE_OWNER","s2"."TABLE_NAME"FROM (SELECT "s1"."OWNER","s1"."SYNONYM_NAME","s1"."TABLE_OWNER","s1"."TABLE_NAME"FROM "SYS"."ALL_SYNONYMS" "s1"UNIONSELECT "s1"."OWNER","s1"."SYNONYM_NAME",'PUBLIC',"s1"."TABLE_NAME"FROM "SYS"."ALL_SYNONYMS" "s1") "s2"WHERE ("s2"."OWNER", "s2"."SYNONYM_NAME") <> (("s2"."TABLE_OWNER", "s2"."TABLE_NAME"))) "s3"START WITH EXISTS (SELECT 1 "one"FROM "SYS"."ALL_OBJECTS"WHERE ("s3"."TABLE_OWNER" = "SYS"."ALL_OBJECTS"."OWNER"AND "s3"."TABLE_NAME" = "SYS"."ALL_OBJECTS"."OBJECT_NAME"AND "SYS"."ALL_OBJECTS"."OBJECT_TYPE" <> 'SYNONYM'))CONNECT BY ("s3"."TABLE_OWNER" = prior "s3"."OWNER"AND "s3"."TABLE_NAME" = prior "s3"."SYNONYM_NAME")
Before I implement this query in the jOOQ code generator, would you mind running it at your side to measure its execution time against your rather large database? That would be very helpful.
--