Maximum Number of Columns Error

Okay, I've searched the discussion groups and did not see an answer to this so if anybody can help, it would be greatly appreciated. I have a user trying to pull back numbers from Essbase to an Excel spreadsheet and is getting "Maximum number of columns [1] exceeded [3].There is no Essbase error message associated with the error. I can pull back the same data on my set and do not get the error. Any help......thanks.

I have to disagree with the last comment; there is no "patch" for Hyperion to send. It's a simple version incompatibility. This situation usually occurs when you either upgrade the Essbase version or Excel, usually Essbase. The problem is that the "old" version of the Add-In isn't compatible with the new Essbase kernel, or in some cases the Excel version.<BR><BR>Try this:<BR><BR>In Excel, uncheck the <b>OLAP Server DLL</b> checkbox and install it again. To do so, browse to the server's hard drive, then to the ...\hyperion\essbase\bin directory and select the <b>Essexcln.xll</b> file. This will get a new copy of the Add-in from the server.<BR><BR>This situation has also occurred when version 6 Essbase is used with Excel 2003 and there's a different solution for that. If the above doesn't work, provide me with the Essbase version and the Excel version, along with what (if anything) has recently changed and I'll field it from there.

Similar Messages

  • Essbase error maximum number of columns [1] exceeded [15]

    <p>I am getting Essbase error: maximum number of columns [1]exceeded [15]</p><p>This message started appearing after HBR 3.5.1 install</p><p>When I retireve from the same excel spreadsheet on a machinewhich does not have HBR installed it works. I do need to use HBRso, how do I resolve this?</p>

    Retrieving more than 500,000 rows in excel are you sure you are using the correct tool, sounds like you are just trying to data dump out of essbase, have a look at other export options.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • ORA 01792 maximum number of columns in a table or view is 1000

    Hello every1, I wish to register a large xmlschema doc, I am using the command
    begin
    dbms_xmlschema.registerschema(
    schemaurl=>'xxxx',
    schemadoc=>bfilename('XMLDIR','xxxxxx.xsd'),
    csid=>nls_charset_id('AL32UTF8'));
    end;
    But the schema file exists 1000 col and it gives me the error msg of
    ORA-01792: maximum number of columns in a table or view is 1000
    is there anyway to solve the problems without edit the original schema document?
    Thanks for your help

    First create this package
    create or replace package XDB_ANALYZE_XMLSCHEMA_10200
    authid CURRENT_USER
    as
      function analyzeStorageModel(P_COMPLEX_TYPE_NAME VARCHAR2) return XMLTYPE;
      function analyzeComplexType(COMPLEX_TYPE VARCHAR2) return XMLTYPE;
      procedure renameCollectionTable (XMLTABLE varchar2, XPATH varchar2, COLLECTION_TABLE_PREFIX varchar2);
      function printNestedTables(XML_TABLE varchar2) return XMLType;
      function getComplexTypeElementList(P_SQLTYPE VARCHAR2, P_SQLSCHEMA VARCHAR2) return XDB.XDB$XMLTYPE_REF_LIST_T;
      procedure scopeXMLReferences;
      procedure indexXMLReferences(INDEX_NAME VARCHAR2);
      function generateSchemaFromTable(P_TABLE_NAME varchar2, P_OWNER varchar2 default USER) return XMLTYPE;
      function showSQLTypes(schemaFolder varchar2) return XMLType;
      function generateCreateTableStatement(XML_TABLE_NAME varchar2, NEW_TABLE_NAME varchar2) return CLOB;
    end XDB_ANALYZE_XMLSCHEMA_10200;
    show errors
    create or replace package body XDB_ANALYZE_XMLSCHEMA_10200
    as
    G_DEPTH_COUNT NUMBER(2) := 0;
    TYPE BASETYPE_T is RECORD  
      SUBTYPE               varchar2(128),
      SUBTYPE_OWNER         varchar2(32),
      BASETYPE              varchar2(128),
      BASETYPE_OWNER        varchar2(32)
    TYPE BASETYPE_LIST_T IS TABLE OF BASETYPE_T;
    BASETYPE_LIST            BASETYPE_LIST_T := BASETYPE_LIST_T();
    function findStorageModel(P_TYPE_NAME VARCHAR2, P_TYPE_OWNER VARCHAR2,  P_INCLUDE_SUBTYPES VARCHAR2 DEFAULT 'YES') return XMLType;
    function getLocalAttributes(P_TYPE_NAME varchar2, P_TYPE_OWNER VARCHAR2) return XMLType;
    function makeElement(P_NAME varchar2)
    return xmltype
    as
      V_NAME varchar2(4000) := P_NAME;
    begin
      -- -- dbms_output.put_line('Processing : ' || P_NAME);
      if (P_NAME LIKE '%$') then
        V_NAME := SUBSTR(V_NAME,1,LENGTH(V_NAME) - 1);
      end if;
      if (P_NAME LIKE '%$%') then
        V_NAME := REPLACE(V_NAME,'$','_0x22_');
      end if;
      return XMLTYPE( '<' || V_NAME || '/>');
    end;
    function getPathToRoot(SUBTYPE VARCHAR2, SUBTYPE_OWNER VARCHAR2)
    return varchar2
    as
      TYPE_HIERARCHY varchar2(4000);
    begin
       SELECT sys_connect_by_path( OWNER || '.' || TYPE_NAME , '/')
         INTO TYPE_HIERARCHY
         FROM ALL_TYPES
        WHERE TYPE_NAME = SUBTYPE
          AND OWNER = SUBTYPE_OWNER
              CONNECT BY SUPERTYPE_NAME = PRIOR TYPE_NAME
                     AND SUPERTYPE_OWNER = PRIOR OWNER
              START WITH SUPERTYPE_NAME IS NULL
                     AND SUPERTYPE_OWNER IS NULL;
       return TYPE_HIERARCHY;
    end;
    function expandSQLType(ATTR_NAME VARCHAR2, SUBTYPE VARCHAR2, SUBTYPE_OWNER VARCHAR2)
    return XMLType
    as
      STORAGE_MODEL       XMLTYPE;
      ATTRIBUTES          XMLTYPE;
      EXTENDED_TYPE       XMLTYPE;
      ATTR_COUNT          NUMBER := 0;
      CURSOR FIND_EXTENDED_TYPES
      is
      select TYPE_NAME, OWNER
        from ALL_TYPES
       where SUPERTYPE_NAME  = SUBTYPE
         and SUPERTYPE_OWNER = SUBTYPE_OWNER;
    begin
      -- dbms_output.put_line('Processing SQLType  : "' || SUBTYPE_OWNER || '.' || SUBTYPE || '".' );
      STORAGE_MODEL := makeElement(ATTR_NAME);
      select insertChildXML(STORAGE_MODEL,'/' || STORAGE_MODEL.getRootElement(),'@type',SUBTYPE)
        into STORAGE_MODEL
        from dual;
      select insertChildXML(STORAGE_MODEL,'/' || STORAGE_MODEL.getRootElement(),'@typeOwner',SUBTYPE_OWNER)
        into STORAGE_MODEL
        from dual;
      ATTRIBUTES := getLocalAttributes(SUBTYPE, SUBTYPE_OWNER);         
      ATTR_COUNT := ATTR_COUNT + ATTRIBUTES.extract('/' || ATTRIBUTES.getRootElement() || '/@columns').getNumberVal();
      select appendChildXML(STORAGE_MODEL,'/' || STORAGE_MODEL.getRootElement(),ATTRIBUTES)
        into STORAGE_MODEL        
        from DUAL;
      for t in FIND_EXTENDED_TYPES loop
         EXTENDED_TYPE := expandSQLType('ExtendedType',T.TYPE_NAME,T.OWNER);
         ATTR_COUNT := ATTR_COUNT + EXTENDED_TYPE.extract('/' || EXTENDED_TYPE.getRootElement() || '/@columns').getNumberVal();
         select appendChildXML(STORAGE_MODEL,'/' || STORAGE_MODEL.getRootElement(),EXTENDED_TYPE)
           into STORAGE_MODEL
           from DUAL;   
      end loop;
      select insertChildXML(STORAGE_MODEL,'/' || STORAGE_MODEL.getRootElement(),'@columns',ATTR_COUNT)
        into STORAGE_MODEL
        from dual;
      return STORAGE_MODEL;
    end;
    function getLocalAttributes(P_TYPE_NAME varchar2, P_TYPE_OWNER VARCHAR2)
    return XMLType
    as
      V_ATTRIBUTE_COUNT     NUMBER := 0;
      V_TOTAL_ATTRIBUTES    NUMBER := 0;
      V_TEMP_RESULT         NUMBER;
      V_COLLECTION_TYPE     varchar2(32);
      V_COLLECTION_OWNER    varchar2(32);
      CURSOR FIND_CHILD_ATTRS
      is
      select ATTR_NAME, ATTR_TYPE_OWNER, ATTR_TYPE_NAME, INHERITED
        from ALL_TYPE_ATTRS
       where TYPE_NAME = P_TYPE_NAME
         and OWNER = P_TYPE_OWNER
         and INHERITED = 'NO'
       order by ATTR_NO;       
      V_ATTR                    DBMS_XMLDOM.DOMATTR;
      V_ATTRIBUTE_LIST      XMLTYPE;
      V_ATTRIBUTE_LIST_DOCUMENT DBMS_XMLDOM.DOMDOCUMENT;
      V_ATTRIBUTE_LIST_ROOT     DBMS_XMLDOM.DOMELEMENT;
      V_ATTRIBUTE           XMLTYPE;
      V_ATTRIBUTE_DOCUMENT                DBMS_XMLDOM.DOMDOCUMENT;
      V_ATTRIBUTE_ROOT                    DBMS_XMLDOM.DOMELEMENT;
      V_TYPE_DEFINITION     XMLTYPE;
      V_TYPE_DEFINITION_DOCUMENT  DBMS_XMLDOM.DOMDOCUMENT;
      V_TYPE_DEFINITION_ROOT      DBMS_XMLDOM.DOMELEMENT;
    begin    
      V_ATTRIBUTE_LIST          := makeElement('Attributes');
      V_ATTRIBUTE_LIST_DOCUMENT := DBMS_XMLDOM.NEWDOMDOCUMENT(V_ATTRIBUTE_LIST);
      V_ATTRIBUTE_LIST_ROOT     := DBMS_XMLDOM.GETDOCUMENTELEMENT(V_ATTRIBUTE_LIST_DOCUMENT);
      for ATTR in FIND_CHILD_ATTRS loop
        -- Finding Element / Attribute Name could be tricky. Use SQLName
        V_ATTRIBUTE          := makeElement(ATTR.ATTR_NAME);
        V_ATTRIBUTE_DOCUMENT := DBMS_XMLDOM.NEWDOMDOCUMENT(V_ATTRIBUTE);
        V_ATTRIBUTE_ROOT     := DBMS_XMLDOM.GETDOCUMENTELEMENT(V_ATTRIBUTE_DOCUMENT);
        begin
          -- Check for Attributes based on collection types, With Nested Table storage each Collection will cost 2 columns.
          select ELEM_TYPE_NAME, ELEM_TYPE_OWNER
            into V_COLLECTION_TYPE, V_COLLECTION_OWNER
            from ALL_COLL_TYPES
           where TYPE_NAME = ATTR.ATTR_TYPE_NAME
             and OWNER = ATTR.ATTR_TYPE_OWNER;
          -- -- dbms_output.put_line('Adding "' || ATTR.ATTR_NAME || '". Collection of "' || ATTR.ATTR_TYPE_OWNER || '"."' || ATTR.ATTR_TYPE_NAME || '".');
          -- Attribute is a Collection Type.
          -- Collection will be managed as a NESTED TABLE
          -- Each Collection cost 2 columns.
          -- May want to count the number of columns in the NESTED_TABLE at a later date.
          V_ATTR      := DBMS_XMLDOM.CREATEATTRIBUTE(V_ATTRIBUTE_DOCUMENT,'SQLCollType');
                         DBMS_XMLDOM.SETVALUE(V_ATTR,ATTR.ATTR_TYPE_NAME);
          V_ATTR      := DBMS_XMLDOM.SETATTRIBUTENODE(V_ATTRIBUTE_ROOT,V_ATTR);
          V_ATTR      := DBMS_XMLDOM.CREATEATTRIBUTE(V_ATTRIBUTE_DOCUMENT,'SQLCollTypeOwner');
                         DBMS_XMLDOM.SETVALUE(V_ATTR,ATTR.ATTR_TYPE_OWNER);
          V_ATTR      := DBMS_XMLDOM.SETATTRIBUTENODE(V_ATTRIBUTE_ROOT,V_ATTR);
          V_ATTR      := DBMS_XMLDOM.CREATEATTRIBUTE(V_ATTRIBUTE_DOCUMENT,'SQLType');
                         DBMS_XMLDOM.SETVALUE(V_ATTR,V_COLLECTION_TYPE);
          V_ATTR      := DBMS_XMLDOM.SETATTRIBUTENODE(V_ATTRIBUTE_ROOT,V_ATTR);
          V_ATTR      := DBMS_XMLDOM.CREATEATTRIBUTE(V_ATTRIBUTE_DOCUMENT,'SQLTypeOwner');
                         DBMS_XMLDOM.SETVALUE(V_ATTR,V_COLLECTION_OWNER);
          V_ATTR      := DBMS_XMLDOM.SETATTRIBUTENODE(V_ATTRIBUTE_ROOT,V_ATTR);
          V_ATTR      := DBMS_XMLDOM.CREATEATTRIBUTE(V_ATTRIBUTE_DOCUMENT,'columns');
                         DBMS_XMLDOM.SETVALUE(V_ATTR,2);
          V_ATTR      := DBMS_XMLDOM.SETATTRIBUTENODE(V_ATTRIBUTE_ROOT,V_ATTR);
        exception
          when no_data_found then
            -- Attribute is not a collection type.
            begin
              -- Check for Attributes based on non-scalar types.
              select 1
                into V_TEMP_RESULT
                from ALL_TYPES
               where TYPE_NAME = ATTR.ATTR_TYPE_NAME
                 and OWNER = ATTR.ATTR_TYPE_OWNER;
              -- Attribute is based on a non-scalar type. Find the Storage Model for this type.
              V_ATTR      := DBMS_XMLDOM.CREATEATTRIBUTE(V_ATTRIBUTE_DOCUMENT,'SQLType');
                             DBMS_XMLDOM.SETVALUE(V_ATTR,ATTR.ATTR_TYPE_NAME);
              V_ATTR      := DBMS_XMLDOM.SETATTRIBUTENODE(V_ATTRIBUTE_ROOT,V_ATTR);
              V_ATTR      := DBMS_XMLDOM.CREATEATTRIBUTE(V_ATTRIBUTE_DOCUMENT,'SQLTypeOwner');
                             DBMS_XMLDOM.SETVALUE(V_ATTR,ATTR.ATTR_TYPE_OWNER);
              V_ATTR      := DBMS_XMLDOM.SETATTRIBUTENODE(V_ATTRIBUTE_ROOT,V_ATTR);
              V_TYPE_DEFINITION            := findStorageModel(ATTR.ATTR_TYPE_NAME, ATTR.ATTR_TYPE_OWNER, 'YES');   
              V_TYPE_DEFINITION_DOCUMENT   := DBMS_XMLDOM.NEWDOMDOCUMENT(V_TYPE_DEFINITION);
              V_TYPE_DEFINITION_ROOT       := DBMS_XMLDOM.GETDOCUMENTELEMENT(V_TYPE_DEFINITION_DOCUMENT);
              V_ATTRIBUTE_COUNT            := DBMS_XMLDOM.GETATTRIBUTE(V_TYPE_DEFINITION_ROOT,'columns');
              V_TYPE_DEFINITION_ROOT       := DBMS_XMLDOM.MAKEELEMENT(DBMS_XMLDOM.IMPORTNODE(V_ATTRIBUTE_DOCUMENT,DBMS_XMLDOM.MAKENODE(V_TYPE_DEFINITION_ROOT),TRUE));
              V_TYPE_DEFINITION_ROOT       := DBMS_XMLDOM.MAKEELEMENT(DBMS_XMLDOM.APPENDCHILD(DBMS_XMLDOM.MAKENODE(V_ATTRIBUTE_ROOT),DBMS_XMLDOM.MAKENODE(V_TYPE_DEFINITION_ROOT)));
              DBMS_XMLDOM.FREEDOCUMENT(V_TYPE_DEFINITION_DOCUMENT);
              if (ATTR.ATTR_TYPE_NAME = 'XDB$ENUM_T' and ATTR.ATTR_TYPE_OWNER = 'XDB') then
                -- The cost of a XDB$ENUM_T is 2 columns
                V_ATTR      := DBMS_XMLDOM.CREATEATTRIBUTE(V_ATTRIBUTE_DOCUMENT,'columns');
                               DBMS_XMLDOM.SETVALUE(V_ATTR,2);
                V_ATTR      := DBMS_XMLDOM.SETATTRIBUTENODE(V_ATTRIBUTE_ROOT,V_ATTR);
              else
                -- The cost of a non scalar Type is the number of attributes plus one for Type and one for the TYPEID.
                V_ATTR      := DBMS_XMLDOM.CREATEATTRIBUTE(V_ATTRIBUTE_DOCUMENT,'columns');
                               DBMS_XMLDOM.SETVALUE(V_ATTR,V_ATTRIBUTE_COUNT + 2);
                V_ATTR      := DBMS_XMLDOM.SETATTRIBUTENODE(V_ATTRIBUTE_ROOT,V_ATTR);
              end if;
            exception
              when no_data_found then
                 -- Attribute is based on a scalar type
                 V_ATTR      := DBMS_XMLDOM.CREATEATTRIBUTE(V_ATTRIBUTE_DOCUMENT,'SQLType');
                                DBMS_XMLDOM.SETVALUE(V_ATTR,ATTR.ATTR_TYPE_NAME);
                 V_ATTR      := DBMS_XMLDOM.SETATTRIBUTENODE(V_ATTRIBUTE_ROOT,V_ATTR);
                 V_ATTR      := DBMS_XMLDOM.CREATEATTRIBUTE(V_ATTRIBUTE_DOCUMENT,'columns');
                                DBMS_XMLDOM.SETVALUE(V_ATTR,1);
                 V_ATTR      := DBMS_XMLDOM.SETATTRIBUTENODE(V_ATTRIBUTE_ROOT,V_ATTR);
            end;
        end;
        V_TOTAL_ATTRIBUTES     := V_TOTAL_ATTRIBUTES + DBMS_XMLDOM.GETATTRIBUTE(V_ATTRIBUTE_ROOT,'columns');
        V_ATTRIBUTE_ROOT       := DBMS_XMLDOM.MAKEELEMENT(DBMS_XMLDOM.IMPORTNODE(V_ATTRIBUTE_LIST_DOCUMENT,DBMS_XMLDOM.MAKENODE(V_ATTRIBUTE_ROOT),TRUE));
        V_ATTRIBUTE_ROOT       := DBMS_XMLDOM.MAKEELEMENT(DBMS_XMLDOM.APPENDCHILD(DBMS_XMLDOM.MAKENODE(V_ATTRIBUTE_LIST_ROOT),DBMS_XMLDOM.MAKENODE(V_ATTRIBUTE_ROOT)));
        DBMS_XMLDOM.FREEDOCUMENT(V_ATTRIBUTE_DOCUMENT);
        if (V_TOTAL_ATTRIBUTES > 25000) then
          exit;
        end if;
      end loop;
      V_ATTR      := DBMS_XMLDOM.CREATEATTRIBUTE(V_ATTRIBUTE_LIST_DOCUMENT,'columns');
                     DBMS_XMLDOM.SETVALUE(V_ATTR,V_TOTAL_ATTRIBUTES);
      V_ATTR      := DBMS_XMLDOM.SETATTRIBUTENODE(V_ATTRIBUTE_LIST_ROOT,V_ATTR);
      return V_ATTRIBUTE_LIST;
    end;
    function getSubTypes(P_TYPE_NAME VARCHAR2, P_TYPE_OWNER VARCHAR2)
    return XMLType
    as
      CURSOR FIND_SUBTYPES
      is
      select TYPE_NAME, OWNER
        from ALL_TYPES
       where SUPERTYPE_NAME  = P_TYPE_NAME
         and SUPERTYPE_OWNER = P_TYPE_OWNER; 
      CURSOR FIND_SUBTYPE_HEIRARCHY
      is
      select LEVEL, TYPE_NAME, OWNER
        from ALL_TYPES
       where TYPE_NAME <> P_TYPE_NAME
         and OWNER <> P_TYPE_OWNER
             connect by SUPERTYPE_NAME = PRIOR TYPE_NAME
                    and SUPERTYPE_OWNER = PRIOR OWNER
             start with TYPE_NAME = P_TYPE_NAME
                    and OWNER = P_TYPE_OWNER;
      V_SUBTYPE_LIST                 XMLType;
      V_SUBTYPE_LIST_DOCUMENT        DBMS_XMLDOM.DOMDOCUMENT;
      V_SUBTYPE_LIST_ROOT            DBMS_XMLDOM.DOMELEMENT;
      V_TYPE_DEFINITION              XMLType;
      V_TYPE_DEFINITION_DOCUMENT     DBMS_XMLDOM.DOMDOCUMENT;
      V_TYPE_DEFINITION_ROOT         DBMS_XMLDOM.DOMELEMENT;
      V_SUBTYPE_DEFINITIONS          XMLType;
      V_SUBTYPE_DEFINITIONS_DOCUMENT DBMS_XMLDOM.DOMDOCUMENT;
      V_SUBTYPE_DEFINITIONS_ROOT     DBMS_XMLDOM.DOMELEMENT;
      V_ATTRIBUTE_LIST               XMLType;
      V_ATTRIBUTE_LIST_DOCUMENT      DBMS_XMLDOM.DOMDOCUMENT;
      V_ATTRIBUTE_LIST_ROOT          DBMS_XMLDOM.DOMELEMENT;
      V_SUBTYPES_EXIST               BOOLEAN := FALSE;
      V_TOTAL_columns                number;
      V_ATTRIBUTE_COUNT              number;
      V_ATTR                         DBMS_XMLDOM.DOMATTR;
      V_COMPLEX_TYPE                 VARCHAR2(256);
    begin
      V_SUBTYPE_LIST          := makeElement('SubTypeDefinitions');
      V_SUBTYPE_LIST_DOCUMENT := DBMS_XMLDOM.NEWDOMDOCUMENT(V_SUBTYPE_LIST);
      V_SUBTYPE_LIST_ROOT     := DBMS_XMLDOM.GETDOCUMENTELEMENT(V_SUBTYPE_LIST_DOCUMENT);
      V_TOTAL_columns := 0;
      for t in FIND_SUBTYPES() loop
        V_SUBTYPES_EXIST  := TRUE;
        V_TYPE_DEFINITION            := makeElement(t.TYPE_NAME);
        V_TYPE_DEFINITION_DOCUMENT   := DBMS_XMLDOM.NEWDOMDOCUMENT(V_TYPE_DEFINITION);
        V_TYPE_DEFINITION_ROOT       := DBMS_XMLDOM.GETDOCUMENTELEMENT(V_TYPE_DEFINITION_DOCUMENT);
        V_ATTR      := DBMS_XMLDOM.CREATEATTRIBUTE(V_TYPE_DEFINITION_DOCUMENT,'SQLTypeOwner');
                       DBMS_XMLDOM.SETVALUE(V_ATTR,t.OWNER);
        V_ATTR      := DBMS_XMLDOM.SETATTRIBUTENODE(V_TYPE_DEFINITION_ROOT,V_ATTR);
        begin
          select x.XMLDATA.NAME
            into V_COMPLEX_TYPE
            from XDB.XDB$COMPLEX_TYPE x
           where x.XMLDATA.SQLTYPE = t.TYPE_NAME
             and x.XMLDATA.SQLSCHEMA = t.OWNER;
          V_ATTR      := DBMS_XMLDOM.CREATEATTRIBUTE(V_TYPE_DEFINITION_DOCUMENT,'type');
                         DBMS_XMLDOM.SETVALUE(V_ATTR,V_COMPLEX_TYPE);
          V_ATTR      := DBMS_XMLDOM.SETATTRIBUTENODE(V_TYPE_DEFINITION_ROOT,V_ATTR);
          -- Consider adding Schema URL Attribute
        exception
          when no_data_found then
            null;
          when others then
            raise;
        end;
        V_ATTRIBUTE_LIST            := getLocalAttributes(t.TYPE_NAME, t.OWNER);  
        V_ATTRIBUTE_LIST_DOCUMENT   := DBMS_XMLDOM.NEWDOMDOCUMENT(V_ATTRIBUTE_LIST);
        V_ATTRIBUTE_LIST_ROOT       := DBMS_XMLDOM.GETDOCUMENTELEMENT(V_ATTRIBUTE_LIST_DOCUMENT);
        V_ATTRIBUTE_COUNT           := DBMS_XMLDOM.GETATTRIBUTE(V_ATTRIBUTE_LIST_ROOT,'columns');
        V_ATTRIBUTE_LIST_ROOT       := DBMS_XMLDOM.MAKEELEMENT(DBMS_XMLDOM.IMPORTNODE(V_TYPE_DEFINITION_DOCUMENT,DBMS_XMLDOM.MAKENODE(V_ATTRIBUTE_LIST_ROOT),TRUE));
        V_ATTRIBUTE_LIST_ROOT       := DBMS_XMLDOM.MAKEELEMENT(DBMS_XMLDOM.APPENDCHILD(DBMS_XMLDOM.MAKENODE(V_TYPE_DEFINITION_ROOT),DBMS_XMLDOM.MAKENODE(V_ATTRIBUTE_LIST_ROOT)));
        DBMS_XMLDOM.FREEDOCUMENT(V_ATTRIBUTE_LIST_DOCUMENT);
        V_SUBTYPE_DEFINITIONS       := getSubTypes(t.TYPE_NAME,t.OWNER);
        if (V_SUBTYPE_DEFINITIONS is not NULL) then
          V_SUBTYPE_DEFINITIONS_DOCUMENT   := DBMS_XMLDOM.NEWDOMDOCUMENT(V_SUBTYPE_DEFINITIONS);
          V_SUBTYPE_DEFINITIONS_ROOT       := DBMS_XMLDOM.GETDOCUMENTELEMENT(V_SUBTYPE_DEFINITIONS_DOCUMENT);
          V_ATTRIBUTE_COUNT                := V_ATTRIBUTE_COUNT + DBMS_XMLDOM.GETATTRIBUTE(V_SUBTYPE_DEFINITIONS_ROOT,'columns');
          V_SUBTYPE_DEFINITIONS_ROOT       := DBMS_XMLDOM.MAKEELEMENT(DBMS_XMLDOM.IMPORTNODE(V_TYPE_DEFINITION_DOCUMENT,DBMS_XMLDOM.MAKENODE(V_SUBTYPE_DEFINITIONS_ROOT),TRUE));
          V_SUBTYPE_DEFINITIONS_ROOT       := DBMS_XMLDOM.MAKEELEMENT(DBMS_XMLDOM.APPENDCHILD(DBMS_XMLDOM.MAKENODE(V_TYPE_DEFINITION_ROOT),DBMS_XMLDOM.MAKENODE(V_SUBTYPE_DEFINITIONS_ROOT)));
        end if;
        V_ATTR      := DBMS_XMLDOM.CREATEATTRIBUTE(V_TYPE_DEFINITION_DOCUMENT,'columns');
                       DBMS_XMLDOM.SETVALUE(V_ATTR,V_ATTRIBUTE_COUNT);
        V_ATTR      := DBMS_XMLDOM.SETATTRIBUTENODE(V_TYPE_DEFINITION_ROOT,V_ATTR);
        V_TYPE_DEFINITION_ROOT       := DBMS_XMLDOM.MAKEELEMENT(DBMS_XMLDOM.IMPORTNODE(V_SUBTYPE_LIST_DOCUMENT,DBMS_XMLDOM.MAKENODE(V_TYPE_DEFINITION_ROOT),TRUE));
        V_TYPE_DEFINITION_ROOT       := DBMS_XMLDOM.MAKEELEMENT(DBMS_XMLDOM.APPENDCHILD(DBMS_XMLDOM.MAKENODE(V_SUBTYPE_LIST_ROOT),DBMS_XMLDOM.MAKENODE(V_TYPE_DEFINITION_ROOT)));
        V_TOTAL_columns := V_TOTAL_columns + V_ATTRIBUTE_COUNT;
      end loop;
      if (V_SUBTYPES_EXIST) then
        V_ATTR      := DBMS_XMLDOM.CREATEATTRIBUTE(V_SUBTYPE_LIST_DOCUMENT,'columns');
                       DBMS_XMLDOM.SETVALUE(V_ATTR,V_TOTAL_columns);
        V_ATTR      := DBMS_XMLDOM.SETATTRIBUTENODE(V_SUBTYPE_LIST_ROOT,V_ATTR);
        return V_SUBTYPE_LIST;
      else
        return NULL;
      end if;
    end;
    function findSuperTypeModel(P_TYPE_NAME VARCHAR2, P_TYPE_OWNER VARCHAR2)
    return XMLType
    as
    begin
      -- dbms_output.put_line('Processing Super Type : "' || P_TYPE_OWNER || '"."' || P_TYPE_NAME || '"');
      return findStorageModel(P_TYPE_NAME, P_TYPE_OWNER,'NO');
    end;
    function getStorageModel(P_TYPE_NAME VARCHAR2, P_TYPE_OWNER VARCHAR2, P_INCLUDE_SUBTYPES VARCHAR2 DEFAULT 'YES')
    return XMLType
    as
      V_TYPE_DEFINITION      XMLTYPE;
      V_ATTRIBUTE_COUNT      NUMBER := 0;
      SUBTYPE_STORAGE_MODEL  XMLTYPE;
      V_SUPERTYPE_DEFINITION XMLTYPE;
      V_SUPERTYPE_DOCUMENT   DBMS_XMLDOM.DOMDOCUMENT;
      V_SUPERTYPE_ROOT       DBMS_XMLDOM.DOMELEMENT;
      V_SUBTYPE_DEFINITION XMLTYPE;
      V_SUBTYPE_DOCUMENT   DBMS_XMLDOM.DOMDOCUMENT;
      V_SUBTYPE_ROOT       DBMS_XMLDOM.DOMELEMENT;
      V_ATTRIBUTE_LIST          XMLTYPE;
      V_ATTRIBUTE_LIST_DOCUMENT DBMS_XMLDOM.DOMDOCUMENT;
      V_ATTRIBUTE_LIST_ROOT     DBMS_XMLDOM.DOMELEMENT;
      cursor FIND_SUPERTYPE_HEIRARCHY
      is
      select TYPE_NAME, OWNER
        from ALL_TYPES
       where TYPE_NAME <> P_TYPE_NAME
         and OWNER <> P_TYPE_OWNER
             connect by TYPE_NAME = PRIOR SUPERTYPE_NAME
                    and OWNER = PRIOR SUPERTYPE_OWNER
             start with TYPE_NAME = P_TYPE_NAME
                    and OWNER = P_TYPE_OWNER
       order by LEVEL;
      V_COMPLEX_TYPE        varchar2(256);
      V_SUPERTYPE_NAME      varchar2(256);
      v_SUPERTYPE_OWNER     varchar2(256);
      V_DOCUMENT            DBMS_XMLDOM.DOMDOCUMENT;
      V_ROOT                DBMS_XMLDOM.DOMELEMENT;
      V_ATTR                DBMS_XMLDOM.DOMATTR;
    begin
      -- dbms_output.put_line('Generating Storage Model for : "' || P_TYPE_OWNER || '"."' || P_TYPE_NAME || '"');
      V_TYPE_DEFINITION := makeElement(P_TYPE_NAME);
      V_DOCUMENT  := DBMS_XMLDOM.NEWDOMDOCUMENT(V_TYPE_DEFINITION);
      V_ROOT      := DBMS_XMLDOM.GETDOCUMENTELEMENT(V_DOCUMENT);
      V_ATTR      := DBMS_XMLDOM.CREATEATTRIBUTE(V_DOCUMENT,'SQLTypeOwner');
                     DBMS_XMLDOM.SETVALUE(V_ATTR,P_TYPE_OWNER);
      V_ATTR      := DBMS_XMLDOM.SETATTRIBUTENODE(V_ROOT,V_ATTR);
      begin
        select x.XMLDATA.NAME
          into V_COMPLEX_TYPE
          from XDB.XDB$COMPLEX_TYPE x
         where x.XMLDATA.SQLTYPE = P_TYPE_NAME
           and x.XMLDATA.SQLSCHEMA = P_TYPE_OWNER;
        V_ATTR      := DBMS_XMLDOM.CREATEATTRIBUTE(V_DOCUMENT,'type');
                       DBMS_XMLDOM.SETVALUE(V_ATTR,V_COMPLEX_TYPE);
        V_ATTR      := DBMS_XMLDOM.SETATTRIBUTENODE(V_ROOT,V_ATTR);
        -- Consider adding Schema URL Attribute
      exception
        when no_data_found then
          null;
        when others then
          raise;
      end;
      select SUPERTYPE_NAME, SUPERTYPE_OWNER
        into V_SUPERTYPE_NAME, V_SUPERTYPE_OWNER
        from ALL_TYPES
       where TYPE_NAME = P_TYPE_NAME
         and OWNER = P_TYPE_OWNER;
      -- Process SuperType. 
      if (V_SUPERTYPE_NAME is not null) then
        V_ATTR      := DBMS_XMLDOM.CREATEATTRIBUTE(V_DOCUMENT,'SQLParentType');
                       DBMS_XMLDOM.SETVALUE(V_ATTR,V_SUPERTYPE_NAME);
        V_ATTR      := DBMS_XMLDOM.SETATTRIBUTENODE(V_ROOT,V_ATTR);
        V_ATTR      := DBMS_XMLDOM.CREATEATTRIBUTE(V_DOCUMENT,'SQLParentTypeOwner');
                       DBMS_XMLDOM.SETVALUE(V_ATTR,V_SUPERTYPE_OWNER);
        V_ATTR      := DBMS_XMLDOM.SETATTRIBUTENODE(V_ROOT,V_ATTR);
        -- Find the Definition for the super type. Do not include the definition of it's subtypes.
        V_SUPERTYPE_DEFINITION := findSuperTypeModel(V_SUPERTYPE_NAME, V_SUPERTYPE_OWNER);
        -- -- dbms_output.put_line(dbms_lob.substr(V_SUPERTYPE_DEFINITION.getClobVal(),1000,1));
        V_SUPERTYPE_DOCUMENT   := DBMS_XMLDOM.NEWDOMDOCUMENT(V_SUPERTYPE_DEFINITION);
        V_SUPERTYPE_ROOT       := DBMS_XMLDOM.GETDOCUMENTELEMENT(V_SUPERTYPE_DOCUMENT);
        V_ATTRIBUTE_COUNT      := V_ATTRIBUTE_COUNT + DBMS_XMLDOM.GETATTRIBUTE(V_SUPERTYPE_ROOT,'columns');
        V_SUPERTYPE_ROOT       := DBMS_XMLDOM.MAKEELEMENT(DBMS_XMLDOM.IMPORTNODE(V_DOCUMENT,DBMS_XMLDOM.MAKENODE(V_SUPERTYPE_ROOT),TRUE));
        V_SUPERTYPE_ROOT       := DBMS_XMLDOM.MAKEELEMENT(DBMS_XMLDOM.APPENDCHILD(DBMS_XMLDOM.MAKENODE(V_ROOT),DBMS_XMLDOM.MAKENODE(V_SUPERTYPE_ROOT)));
        DBMS_XMLDOM.FREEDOCUMENT(V_SUPERTYPE_DOCUMENT);
      end if;
      -- Process Attributes defined directly by the Type.
      V_ATTRIBUTE_LIST            := getLocalAttributes(P_TYPE_NAME, P_TYPE_OWNER);  
      V_ATTRIBUTE_LIST_DOCUMENT   := DBMS_XMLDOM.NEWDOMDOCUMENT(V_ATTRIBUTE_LIST);
      V_ATTRIBUTE_LIST_ROOT       := DBMS_XMLDOM.GETDOCUMENTELEMENT(V_ATTRIBUTE_LIST_DOCUMENT);
      V_ATTRIBUTE_COUNT           := V_ATTRIBUTE_COUNT + DBMS_XMLDOM.GETATTRIBUTE(V_ATTRIBUTE_LIST_ROOT,'columns');
      V_ATTRIBUTE_LIST_ROOT       := DBMS_XMLDOM.MAKEELEMENT(DBMS_XMLDOM.IMPORTNODE(V_DOCUMENT,DBMS_XMLDOM.MAKENODE(V_ATTRIBUTE_LIST_ROOT),TRUE));
      V_ATTRIBUTE_LIST_ROOT       := DBMS_XMLDOM.MAKEELEMENT(DBMS_XMLDOM.APPENDCHILD(DBMS_XMLDOM.MAKENODE(V_ROOT),DBMS_XMLDOM.MAKENODE(V_ATTRIBUTE_LIST_ROOT)));
      DBMS_XMLDOM.FREEDOCUMENT(V_ATTRIBUTE_LIST_DOCUMENT);
      if (P_INCLUDE_SUBTYPES = 'YES') then
        -- Process any Sub-Types...
        V_SUBTYPE_DEFINITION := getSubTypes(P_TYPE_NAME, P_TYPE_OWNER);
        if (V_SUBTYPE_DEFINITION is not null) then
          V_SUBTYPE_DOCUMENT   := DBMS_XMLDOM.NEWDOMDOCUMENT(V_SUBTYPE_DEFINITION);
          V_SUBTYPE_ROOT       := DBMS_XMLDOM.GETDOCUMENTELEMENT(V_SUBTYPE_DOCUMENT);
          V_ATTRIBUTE_COUNT    := V_ATTRIBUTE_COUNT + DBMS_XMLDOM.GETATTRIBUTE(V_SUBTYPE_ROOT,'columns');
          V_SUBTYPE_ROOT       := DBMS_XMLDOM.MAKEELEMENT(DBMS_XMLDOM.IMPORTNODE(V_DOCUMENT,DBMS_XMLDOM.MAKENODE(V_SUBTYPE_ROOT),TRUE));
          V_SUBTYPE_ROOT       := DBMS_XMLDOM.MAKEELEMENT(DBMS_XMLDOM.APPENDCHILD(DBMS_XMLDOM.MAKENODE(V_ROOT),DBMS_XMLDOM.MAKENODE(V_SUBTYPE_ROOT)));   
          DBMS_XMLDOM.FREEDOCUMENT(V_SUBTYPE_DOCUMENT);
        end if;
      end if;
      V_ATTR      := DBMS_XMLDOM.CREATEATTRIBUTE(V_DOCUMENT,'columns');
                     DBMS_XMLDOM.SETVALUE(V_ATTR,V_ATTRIBUTE_COUNT);
      V_ATTR      := DBMS_XMLDOM.SETATTRIBUTENODE(V_ROOT,V_ATTR);
      -- Cache the type definition.
      -- dbms_output.put_line('Cached Storage Model for "' || P_TYPE_OWNER || '.' || P_TYPE_NAME || '".');
      insert into XDBPM.XDBPM_STORAGE_MODEL_CACHE (TYPE_NAME, TYPE_OWNER, EXTENDED_DEFINITION, STORAGE_MODEL) VALUES (P_TYPE_NAME, P_TYPE_OWNER, P_INCLUDE_SUBTYPES, V_TYPE_DEFINITION);
      return V_TYPE_DEFINITION;
    end;
    function findStorageModel(P_TYPE_NAME VARCHAR2, P_TYPE_OWNER VARCHAR2, P_INCLUDE_SUBTYPES VARCHAR2 DEFAULT 'YES')
    -- Find the Storage Model for the Base Type.
    -- If the type is derived from another type we need the storage model of the Base Type
    -- As storage models are calculated they are cached in the global temporary table XDBPM_STORAGE_MODEL_CACHE. This makes
    -- the process much more efficient. A global temporary table is used to minimize memory usage.
    return XMLType
    as
      V_STORAGE_MODEL          XMLType;
      V_STORAGE_MODEL_DOCUMENT DBMS_XMLDOM.DOMDOCUMENT;
      V_STORAGE_MODEL_ROOT     DBMS_XMLDOM.DOMELEMENT;
      V_ATTRIBUTE_COUNT        VARCHAR2(10);
    begin
      dbms_output.put_line('findStorageModel(' || G_DEPTH_COUNT || ') : Processing "' || P_TYPE_OWNER || '"."' || P_TYPE_NAME || '".' );
      begin
        SELECT STORAGE_MODEL
          into V_STORAGE_MODEL
          from XDBPM.XDBPM_STORAGE_MODEL_CACHE
         where TYPE_NAME = P_TYPE_NAME
           and TYPE_OWNER = P_TYPE_OWNER
           and EXTENDED_DEFINITION = P_INCLUDE_SUBTYPES;
         -- dbms_output.put_line('Resolved Storage Model from cache.');
      exception
        when no_data_found then
          G_DEPTH_COUNT := G_DEPTH_COUNT + 1;
          V_STORAGE_MODEL := getStorageModel(P_TYPE_NAME,P_TYPE_OWNER, P_INCLUDE_SUBTYPES);
          G_DEPTH_COUNT := G_DEPTH_COUNT - 1; 
        when others then
          raise;
      end;
      V_STORAGE_MODEL_DOCUMENT := DBMS_XMLDOM.NEWDOMDOCUMENT(V_STORAGE_MODEL);
      V_STORAGE_MODEL_ROOT     := DBMS_XMLDOM.GETDOCUMENTELEMENT(V_STORAGE_MODEL_DOCUMENT);
      V_ATTRIBUTE_COUNT          := DBMS_XMLDOM.GETATTRIBUTE(V_STORAGE_MODEL_ROOT,'columns');
      dbms_output.put_line('findStorageModel : Attribute Count for "' || P_TYPE_OWNER || '"."' || P_TYPE_NAME || '" = ' || V_ATTRIBUTE_COUNT || '.' );
      return V_STORAGE_MODEL;
    end;
    function analyzeStorageModel(P_COMPLEX_TYPE_NAME VARCHAR2, P_TYPE_NAME VARCHAR2, P_TYPE_OWNER VARCHAR2)
    -- Generate a map showing the number of columns required to persist an instance of the SQL type.
    return XMLType
    as
      V_STORAGE_MODEL       XMLTYPE;
      V_COUNT               NUMBER := 0;
      V_DOCUMENT            DBMS_XMLDOM.DOMDOCUMENT;
      V_ROOT                DBMS_XMLDOM.DOMELEMENT;
      V_ATTR                DBMS_XMLDOM.DOMATTR;
      V_MODEL               DBMS_XMLDOM.DOMELEMENT;
      V_TYPE_DEFINITION     DBMS_XMLDOM.DOMELEMENT;
    begin
      V_STORAGE_MODEL := makeElement(P_COMPLEX_TYPE_NAME);
      V_DOCUMENT  := DBMS_XMLDOM.NEWDOMDOCUMENT(V_STORAGE_MODEL);
      V_ROOT      := DBMS_XMLDOM.GETDOCUMENTELEMENT(V_DOCUMENT);
      V_ATTR      := DBMS_XMLDOM.CREATEATTRIBUTE(V_DOCUMENT,'SQLType');
                     DBMS_XMLDOM.SETVALUE(V_ATTR,P_TYPE_NAME);
      V_ATTR      := DBMS_XMLDOM.SETATTRIBUTENODE(V_ROOT,V_ATTR);
      V_ATTR      := DBMS_XMLDOM.CREATEATTRIBUTE(V_DOCUMENT,'SQLTypeOwner');
                     DBMS_XMLDOM.SETVALUE(V_ATTR,P_TYPE_OWNER);
      V_ATTR      := DBMS_XMLDOM.SETATTRIBUTENODE(V_ROOT,V_ATTR);
      V_TYPE_DEFINITION   := DBMS_XMLDOM.GETDOCUMENTELEMENT(DBMS_XMLDOM.NEWDOMDOCUMENT(findStorageModel(P_TYPE_NAME, P_TYPE_OWNER, 'YES')));
      V_TYPE_DEFINITION   := DBMS_XMLDOM.MAKEELEMENT(DBMS_XMLDOM.IMPORTNODE(V_DOCUMENT,DBMS_XMLDOM.MAKENODE(V_TYPE_DEFINITION),TRUE));
      V_TYPE_DEFINITION   := DBMS_XMLDOM.MAKEELEMENT(DBMS_XMLDOM.APPENDCHILD(DBMS_XMLDOM.MAKENODE(V_ROOT),DBMS_XMLDOM.MAKENODE(V_TYPE_DEFINITION)));
      V_ATTR      := DBMS_XMLDOM.CREATEATTRIBUTE(V_DOCUMENT,'columns');
                     DBMS_XMLDOM.SETVALUE(V_ATTR,DBMS_XMLDOM.GETATTRIBUTE(V_TYPE_DEFINITION,'columns'));
      V_ATTR      := DBMS_XMLDOM.SETATTRIBUTENODE(V_ROOT,V_ATTR);
      return  V_STORAGE_MODEL;
    end;
    function analyzeStorageModel(P_COMPLEX_TYPE_NAME VARCHAR2)
    return XMLTYPE
    -- Generate a map showing the number of columns required to persist an instance of the complex type.
    as
      pragma autonomous_transaction;
      V_SQLTYPE           VARCHAR2(128);
      V_SQLSCHEMA         VARCHAR2(32);
      V_RESULT            XMLType;
    begin
    G_DEPTH_COUNT := 0;
    select ct.XMLDATA.SQLTYPE, ct.XMLDATA.SQLSCHEMA
        into V_SQLTYPE, V_SQLSCHEMA
        from XDB.XDB$COMPLEX_TYPE ct, XDB.XDB$SCHEMA s
       where ct.XMLDATA.NAME = P_COMPLEX_TYPE_NAME
         and ref(s) = ct.XMLDATA.PARENT_SCHEMA
         and s.XMLDATA.SCHEMA_OWNER = USER;
      delete from XDBPM.XDBPM_STORAGE_MODEL_CACHE;
      -- delete from XDBPM.XDBPM_STORAGE_MODEL;
      V_RESULT := analyzeStorageModel(P_COMPLEX_TYPE_NAME,V_SQLTYPE,V_SQLSCHEMA);
      COMMIT;
      return V_RESULT;
    exception
      when no_data_found then
        -- dbms_output.put_line('Unable to find SQLType mapping for complexType : "' || USER || '"."' || P_COMPLEX_TYPE_NAME || '".' );
        return null;
      when others then
        raise;
    end;
    function analyzeSQLType(ATTR_NAME VARCHAR2, TARGET_TYPE_NAME VARCHAR2, TARGET_TYPE_OWNER VARCHAR2)
    return XMLType
    as
       ROOT_NODE_NAME   VARCHAR2(128);
       ATTR_DETAIL      XMLTYPE;
       XPATH_EXPRESSION VARCHAR2(129);
       CURSOR FIND_CHILD_ATTRS is
         select ATTR_NAME, ATTR_TYPE_OWNER, ATTR_TYPE_NAME, INHERITED
           from ALL_TYPE_ATTRS
          where OWNER = TARGET_TYPE_OWNER
            and TYPE_NAME = TARGET_TYPE_NAME
          order by ATTR_NO;       
       CHILD_ATTR  XMLTYPE;
       ATTR_COUNT NUMBER := 0;
       TEMP number;
       COLLECTION_TYPE_NAME  varchar2(256);
       COLLECTION_TYPE_OWNER varchar2(256);
    begin
      -- -- dbms_output.put_line('Processing Attribute ' || ATTR_NAME || ' of ' || TARGET_TYPE_OWNER || '.' || TARGET_TYPE_NAME );
      ATTR_DETAIL := makeElement(ATTR_NAME);
      XPATH_EXPRESSION := '/' || ATTR_DETAIL.GETROOTELEMENT();
      for ATTR in FIND_CHILD_ATTRS loop
        begin
          select ELEM_TYPE_NAME, ELEM_TYPE_OWNER
            into COLLECTION_TYPE_NAME, COLLECTION_TYPE_OWNER
            from ALL_COLL_TYPES
           where TYPE_NAME = ATTR.ATTR_TYPE_NAME
             and OWNER = ATTR.ATTR_TYPE_OWNER;
          CHILD_ATTR := analyzeSQLType(ATTR.ATTR_NAME, COLLECTION_TYPE_NAME, COLLECTION_TYPE_OWNER );
          ATTR_COUNT := ATTR_COUNT + CHILD_ATTR.extract('/' || CHILD_ATTR.GETROOTELEMENT()  || '/@sqlAttrs').getNumberVal();
          select appendChildXML(ATTR_DETAIL,XPATH_EXPRESSION,CHILD_ATTR)
            into ATTR_DETAIL
            from DUAL;
        exception
          when no_data_found then
            begin
              select 1
                into TEMP
                from ALL_TYPES
               where TYPE_NAME = ATTR.ATTR_TYPE_NAME
                and OWNER = ATTR.ATTR_TYPE_OWNER;
              CHILD_ATTR := analyzeSQLType(ATTR.ATTR_NAME, ATTR.ATTR_TYPE_NAME, ATTR.ATTR_TYPE_OWNER );
              ATTR_COUNT := ATTR_COUNT + CHILD_ATTR.extract('/' || CHILD_ATTR.GETROOTELEMENT() || '/@sqlAttrs').getNumberVal();
              select appendChildXML(ATTR_DETAIL,XPATH_EXPRESSION,CHILD_ATTR)
                into ATTR_DETAIL
                from DUAL;
            exception
             when no_data_found then
               ATTR_COUNT := ATTR_COUNT + 1;
            end;
        end;
      end loop;
      select insertChildXML(ATTR_DETAIL,XPATH_EXPRESSION,'@sqlAttrs',ATTR_COUNT)
        into ATTR_DETAIL
        from dual;
      return ATTR_DETAIL;
    end;
    function analyzeComplexType(COMPLEX_TYPE VARCHAR2)
    return XMLType
    as
      RESULT           xmltype;
      SQLTYPE          varchar2(128);
      SQLTYPE_OWNER    varchar2(32);
    begin
      select SQLTYPE, SQLTYPE_OWNER
        into SQLTYPE, SQLTYPE_OWNER
        from USER_XML_SCHEMAS,
             xmlTable
                xmlnamespaces
                  'http://www.w3.org/2001/XMLSchema' as "xsd",
                  'http://xmlns.oracle.com/xdb' as "xdb"
                '/xsd:schema/xsd:complexType'
                passing Schema
                columns
                COMPLEX_TYPE_NAME varchar2(4000) path '@name',
                SQLTYPE           varchar2(128)  path '@xdb:SQLType',
                SQLTYPE_OWNER     varchar2(32)   path '@xdb:SQLSchema'
       where COMPLEX_TYPE_NAME = COMPLEX_TYPE;
      result := analyzeSQLType(COMPLEX_TYPE,SQLTYPE,SQLTYPE_OWNER);
      select insertChildXML(RESULT,'/' || COMPLEX_TYPE,'@SQLType',SQLTYPE)
        into result
        from dual;
      return result;
    end;
    function showSQLTypes(schemaFolder varchar2) return XMLType
    is
      xmlSchema XMLTYPE;
    begin
      select xmlElement                                 
               "TypeList",                              
               xmlAgg                                   
                  xmlElement                             
                    "Schema",                            
                    xmlElement
                      "ResourceName",
                      extractValue(res,'/Resource/DisplayName')
                    xmlElement                         
                      "complexTypes",                  
                        select xmlAgg                               
                                 xmlElement              
                                   "complexType",        
                                   xmlElement           
                                     "name",             
                                     extractValue(value(XML),'/xsd:complexType/@name',XDB_NAMESPACES.XDBSCHEMA_PREFIXES)                          
                                   xmlElement            
                                     "SQLType",          
                                     extractValue(value(XML),'/xsd:complexType/@xdb:SQLType',XDB_NAMESPACES.XDBSCHEMA_PREFIXES)                            
                          from table                   
                                 xmlsequence           
                                   extract             
                                     xdburitype(p.path).getXML(),
                                     '/xsd:schema/xsd:complexType',
                                     XDB_NAMESPACES.XDBSCHEMA_PREFIXES
                               ) xml
                          -- order by extractValue(value(XML),'/xsd:complexType/@name',XDB_NAMESPACES.XDBSCHEMA_PREFIXES)
              ).extract('/*')                            
         into xmlSchema
         from path_view p                                
        where under_path(res,schemaFolder) = 1      
        order by extractValue(res,'/Resource/DisplayName');
      return xmlSchema;
    end;
    procedure renameCollectionTable (XMLTABLE varchar2, XPATH varchar2, COLLECTION_TABLE_PREFIX varchar2)
    as
       SYSTEM_GENERATED_NAME varchar2(256);
       COLLECTION_TABLE_NAME varchar2(256);
       CLUSTERED_INDEX_NAME  varchar2(256);
       PARENT_INDEX_NAME     varchar2(256);
       RENAME_STATEMENT varchar2(4000);
    begin
       COLLECTION_TABLE_NAME := COLLECTION_TABLE_PREFIX || '_TABLE';
       CLUSTERED_INDEX_NAME := COLLECTION_TABLE_PREFIX || '_DATA';
       PARENT_INDEX_NAME := COLLECTION_TABLE_PREFIX || '_LIST';
       select TABLE_NAME
         into SYSTEM_GENERATED_NAME
         from ALL_NESTED_TABLES
        where PARENT_TABLE_NAME = XMLTABLE
          and PARENT_TABLE_COLUMN = XPATH
          and OWNER = USER;
       RENAME_STATEMENT := 'alter table ' || USER || '."' || SYSTEM_GENERATED_NAME || '" rename to "' ||COLLECTION_TABLE_NAME || '"';
       -- -- dbms_output.put_line(RENAME_STATEMENT);
       execute immediate RENAME_STATEMENT;
       begin
         select INDEX_NAME
           into SYSTEM_GENERATED_NAME
           from ALL_INDEXES
          where TABLE_NAME = COLLECTION_TABLE_NAME
            and INDEX_TYPE = 'IOT - TOP'
            and OWNER = USER;
         RENAME_STATEMENT := 'alter index ' || USER || '."' || SYSTEM_GENERATED_NAME || '" rename to "' || CLUSTERED_INDEX_NAME || '"';
         -- -- dbms_output.put_line(RENAME_STATEMENT);
         execute immediate RENAME_STATEMENT;
       exception
         when NO_DATA_FOUND then
           null;
       end;
       begin
         select INDEX_NAME
           into SYSTEM_GENERATED_NAME
           from ALL_IND_columns
          where COLUMN_NAME = XPATH
            and TABLE_NAME =  XMLTABLE
            and TABLE_OWNER = USER;
         RENAME_STATEMENT := 'alter index ' || USER || '."' || SYSTEM_GENERATED_NAME || '" rename to "' || PARENT_INDEX_NAME || '"';
         -- -- dbms_output.put_line(RENAME_STATEMENT);
         execute immediate RENAME_STATEMENT;
       exception
         when NO_DATA_FOUND then
           null;
       end;
    end;
    function processNestedTable(currentLevel in out number, currentNode in out XMLType, query SYS_REFCURSOR)
    return XMLType
    is
      thisLevel  number;
      thisNode   xmlType;
      result xmlType;
    begin
      thisLevel := currentLevel;
      thisNode := currentNode;
      fetch query into currentLevel, currentNode;
      if (query%NOTFOUND) then
        currentLevel := -1;
      end if;
      while (currentLevel >= thisLevel) loop
        -- Next Node is a decendant of sibling of this Node.
        if (currentLevel > thisLevel) then
          -- Next Node is a decendant of this Node.
          result := processNestedTable(currentLevel, currentNode, query);
          select xmlElement
                    "Collection",
                    extract(thisNode,'/Collection/*'),
                    xmlElement
                      "NestedCollections",
                      result
             into thisNode
             from dual;
        else
          -- Next node is a sibling of this Node.
          result := processNestedTable(currentLevel, currentNode, query);
          select xmlconcat(thisNode,result) into thisNode from dual;
        end if;
      end loop;
      -- Next Node is a sibling of some ancestor of this node.
      return thisNode;
    end;
    function printNestedTables(XML_TABLE varchar2)
    return XMLType
    is
       query SYS_REFCURSOR;
       result XMLType;
       rootLevel number := 0;
       rootNode xmlType;
    begin
       open query for
            select level, xmlElement
                            "Collection",
                            xmlElement
                              "CollectionId",
                              PARENT_TABLE_COLUMN
                          ) as XML
              from USER_NESTED_TABLES
           connect by PRIOR TABLE_NAME = PARENT_TABLE_NAME
                   start with PARENT_TABLE_NAME = XML_TABLE;
        fetch query into rootLevel, rootNode;
        result := processNestedTable(rootLevel, rootNode, query);
        select xmlElement
                  "NestedTableStructure",
                  result
          into result
          from dual;
        return result;
    end;
    function generateSchemaFromTable(P_TABLE_NAME varchar2, P_OWNER varchar2 default USER)
    return XMLTYPE
    as
      xmlSchema XMLTYPE;
    begin
      select xmlElement
               "xsd:schema",
               xmlAttributes
                 'http://www.w3.org/2001/XMLSchema' as "xmlns:xsd",
                 'http://xmlns.oracle.com/xdb' as "xmlns:xdb"
               xmlElement
                 "xsd:element",
                 xmlAttributes
                   'ROWSET' as "name",
                   'rowset' as "type"
               xmlElement
                 "xsd:complexType",
                 xmlAttributes
                   'rowset' as "name"
                 xmlElement
                   "xsd:sequence",
                   xmlElement
                      "xsd:element",
                      xmlAttributes
                        'ROW' as "name",
                        table_name || '_T' as "type",
                        'unbounded' as "maxOccurs"
               xmlElement
                 "xsd:complexType",
                 xmlAttributes
                   table_name || '_T' as "name"
                 xmlElement
                   "xsd:sequence",
                     xmlAgg(ELEMENT order by INTERNAL_COLUMN_ID)
        into xmlSchema
        from (select TABLE_NAME, INTERNAL_COLUMN_ID,
                     case
                       when DATA_TYPE in ('VARCHAR2','CHAR') then
                         xmlElement
                           "xsd:element",
                           xmlattributes
                             column_name as "name",
                             decode(NULLABLE, 'Y', 0, 1) as "minOccurs",
                             column_name as "xdb:SQLName",
                             DATA_TYPE as "xdb:SQLType"
                           xmlElement
                             "xsd:simpleType",
                             xmlElement
                               "xsd:restriction",
                               xmlAttributes
                                 'xsd:string' as "base"
                               xmlElement
                                 "xsd:maxLength",
                                 xmlAttributes
                                   DATA_LENGTH  as "value"
                       when DATA_TYPE = 'NUMBER' then
                         xmlElement
                           "xsd:element",
                           xmlattributes
                             column_name as "name",
                             decode(NULLABLE, 'Y', 0, 1) as "minOccurs",
                             column_name as "xdb:SQLName",
                             DATA_TYPE as "xdb:SQLType"
                           xmlElement
                             "xsd:simpleType",
                             xmlElement
                               "xsd:restriction",
                               xmlAttributes
                                  decode(DATA_SCALE, 0, 'xsd:integer', 'xsd:double') as "base"
                               xmlElement
                                 "xsd:totalDigits",
                                 xmlAttributes
                                   DATA_PRECISION  as "value"
                       when DATA_TYPE = 'DATE' then
                         xmlElement
                           "xsd:element",
                           xmlattributes
                             column_name as "name",
                             decode(NULLABLE, 'Y', 0, 1) as "minOccurs",
                             'xsd:date' as "type",
                             column_name as "xdb:SQLName",
                             DATA_TYPE as "xdb:SQLType"
                       when DATA_TYPE like 'TIMESTAMP%WITH TIME ZONE' then
                         xmlElement
                           "xsd:element",
                           xmlattributes
                             column_name as "name",
                             decode(NULLABLE, 'Y', 0, 1) as "minOccurs",
                             'xsd:dateTime' as "type",
                             column_name as "xdb:SQLName",
                             DATA_TYPE as "xdb:SQLType"
                       else
                         xmlElement
                           "xsd:element",
                           xmlattributes
                             column_name as "name",
                             decode(NULLABLE, 'Y', 0, 1) as "minOccurs",
                             'xsd:anySimpleType' as "type",
                             column_name as "xdb:SQLName",
                             DATA_TYPE as "xdb:SQLType"
                     end ELEMENT
                from all_tab_cols c
               where c.TABLE_NAME = P_TABLE_NAME
                 and c.OWNER = P_OWNER
        group by TABLE_NAME;
      return xmlSchema;
    end;
    function appendElementList(V_ELEMENT_LIST IN OUT XDB.XDB$XMLTYPE_REF_LIST_T, V_CHILD_ELEMENT_LIST XDB.XDB$XMLTYPE_REF_LIST_T) return XDB.XDB$XMLTYPE_REF_LIST_T;
    function expandModel(P_MODEL XDB.XDB$MODEL_T) return XDB.XDB$XMLTYPE_REF_LIST_T;
    function expandChoiceList(P_CHOICE_LIST XDB.XDB$XMLTYPE_REF_LIST_T) return XDB.XDB$XMLTYPE_REF_LIST_T;
    function expandSequenceList(P_SEQUENCE_LIST XDB.XDB$XMLTYPE_REF_LIST_T) return XDB.XDB$XMLTYPE_REF_LIST_T;
    function expandGroupList(P_GROUP_LIST XDB.XDB$XMLTYPE_REF_LIST_T) return XDB.XDB$XMLTYPE_REF_LIST_T;
    function appendElementList(V_ELEMENT_LIST IN OUT XDB.XDB$XMLTYPE_REF_LIST_T, V_CHILD_ELEMENT_LIST XDB.XDB$XMLTYPE_REF_LIST_T)
    return XDB.XDB$XMLTYPE_REF_LIST_T
    as
    begin
      SELECT CAST
               SET
                 CAST(V_ELEMENT_LIST as XDBPM.XMLTYPE_REF_TABLE_T)
                 MULTISET UNION
                 CAST(V_CHILD_ELEMENT_LIST as XDBPM.XMLTYPE_REF_TABLE_T)
               as XDB.XDB$XMLTYPE_REF_LIST_T
        into V_ELEMENT_LIST
        from DUAL;
        return V_ELEMENT_LIST;     
    end;
    function expandModel(P_MODEL XDB.XDB$MODEL_T)
    return XDB.XDB$XMLTYPE_REF_LIST_T
    as
      V_ELEMENT_LIST       XDB.XDB$XMLTYPE_REF_LIST_T;
      V_CHILD_ELEMENT_LIST XDB.XDB$XMLTYPE_REF_LIST_T;
    begin
      V_ELEMENT_LIST := XDB.XDB$XMLTYPE_REF_LIST_T();
      if P_MODEL.ELEMENTS is not null then
        V_ELEMENT_LIST := P_MODEL.ELEMENTS;
      end if;
      if (P_MODEL.CHOICE_KIDS is not NULL) then
        V_CHILD_ELEMENT_LIST := expandChoiceList(P_MODEL.CHOICE_KIDS);
        V_ELEMENT_LIST := appendElementList(V_ELEMENT_LIST,V_CHILD_ELEMENT_LIST);
      end if;
      if (P_MODEL.SEQUENCE_KIDS is not NULL) then
        V_CHILD_ELEMENT_LIST := expandSequenceList(P_MODEL.SEQUENCE_KIDS);
        V_ELEMENT_LIST := appendElementList(V_ELEMENT_LIST,V_CHILD_ELEMENT_LIST);
      end if;
      -- Process ANYS
      if (P_MODEL.GROUPS is not NULL) then
        V_CHILD_ELEMENT_LIST := expandGroupList(P_MODEL.GROUPS);
        V_ELEMENT_LIST := appendElementList(V_ELEMENT_LIST,V_CHILD_ELEMENT_LIST);
      end if;
      return V_ELEMENT_LIST;
    end;
    function expandChoiceList(P_CHOICE_LIST XDB.XDB$XMLTYPE_REF_LIST_T)
    return XDB.XDB$XMLTYPE_REF_LIST_T
    as
      V_ELEMENT_LIST       XDB.XDB$XMLTYPE_REF_LIST_T;
      V_CHILD_ELEMENT_LIST XDB.XDB$XMLTYPE_REF_LIST_T;
      cursor getChoices is
      select c.XMLDATA MODEL
        from XDB.XDB$CHOICE_MODEL c, TABLE(P_CHOICE_LIST) cl
       where ref(c) = value(cl);
    begin
      V_ELEMENT_LIST := XDB.XDB$XMLTYPE_REF_LIST_T();
      for c in getChoices loop
        V_CHILD_ELEMENT_LIST := expandModel(c.MODEL);
        V_ELEMENT_LIST := appendElementList(V_ELEMENT_LIST,V_CHILD_ELEMENT_LIST);
      end loop;
      return V_ELEMENT_LIST;
    end;
    function expandSequenceList(P_SEQUENCE_LIST XDB.XDB$XMLTYPE_REF_LIST_T)
    return XDB.XDB$XMLTYPE_REF_LIST_T
    as
      V_ELEMENT_LIST       XDB.XDB$XMLTYPE_REF_LIST_T;
      V_CHILD_ELEMENT_LIST XDB.XDB$XMLTYPE_REF_LIST_T;
      cursor getSequences is
      select s.XMLDATA MODEL
        from XDB.XDB$SEQUENCE_MODEL s, TABLE(P_SEQUENCE_LIST) sl
       where ref(s) = value(sl);
    begin
      V_ELEMENT_LIST := XDB.XDB$XMLTYPE_REF_LIST_T();
      for s in getSequences loop
        V_CHILD_ELEMENT_LIST := expandModel(s.MODEL);
        V_ELEMENT_LIST := appendElementList(V_ELEMENT_LIST,V_CHILD_ELEMENT_LIST);
      end loop;
      return V_ELEMENT_LIST;
    end;
    function expandGroupList(P_GROUP_LIST XDB.XDB$XMLTYPE_REF_LIST_T)
    return XDB.XDB$XMLTYPE_REF_LIST_T
    as
      V_ELEMENT_LIST       XDB.XDB$XMLTYPE_REF_LIST_T;
      V_CHILD_ELEMENT_LIST XDB.XDB$XMLTYPE_REF_LIST_T;  V_MODEL  XDB.XDB$MODEL_T;
      cursor getGroups is
      SELECT CASE
               -- Return The MODEL Definition for the CHOICE, ALL or SEQUENCE
               WHEN gd.XMLDATA.ALL_KID is not NULL
                 THEN ( SELECT a.XMLDATA  from XDB.XDB$ALL_MODEL a where ref(a) = gd.XMLDATA.ALL_KID)
               WHEN gd.XMLDATA.SEQUENCE_KID is not NULL
                 THEN ( SELECT s.XMLDATA  from XDB.XDB$SEQUENCE_MODEL s where ref(s) = gd.XMLDATA.SEQUENCE_KID)
               WHEN gd.XMLDATA.CHOICE_KID is not NULL
                 THEN ( SELECT c.XMLDATA  from XDB.XDB$CHOICE_MODEL c where ref(c) = gd.XMLDATA.CHOICE_KID)
              END MODEL
         FROM XDB.XDB$GROUP_DEF gd, XDB.XDB$GROUP_REF gr, TABLE(P_GROUP_LIST) gl
        WHERE ref(gd) = gr.XMLDATA.GROUPREF_REF
          and ref(gr) = value(gl);
    begin
      V_ELEMENT_LIST := XDB.XDB$XMLTYPE_REF_LIST_T();
      for g in getGroups loop
        V_CHILD_ELEMENT_LIST := expandModel(g.MODEL);
        V_ELEMENT_LIST := appendElementList(V_ELEMENT_LIST,V_CHILD_ELEMENT_LIST);
      end loop;
      return V_ELEMENT_LIST;
    end;
    function getComplexTypeElementList(P_COMPLEX_TYPE_REF REF XMLTYPE)
    return XDB.XDB$XMLTYPE_REF_LIST_T
    as
      V_MODEL        XDB.XDB$MODEL_T;
      V_BASE_TYPE    REF XMLTYPE;
      V_ELEMENT_LIST XDB.XDB$XMLTYPE_REF_LIST_T := XDB.XDB$XMLTYPE_REF_LIST_T();
    begin
      SELECT ct.XMLDATA.BASE_TYPE,
             CASE
               -- Return The MODEL Definition for the CHOICE, ALL or SEQUENCE
               WHEN ct.XMLDATA.ALL_KID is not NULL
                 THEN ( SELECT a.XMLDATA  from XDB.XDB$ALL_MODEL a where ref(a) = ct.XMLDATA.ALL_KID)
               WHEN ct.XMLDATA.SEQUENCE_KID is not NULL
                 THEN ( SELECT s.XMLDATA  from XDB.XDB$SEQUENCE_MODEL s where ref(s) = ct.XMLDATA.SEQUENCE_KID)
               WHEN ct.XMLDATA.CHOICE_KID is not NULL
                 THEN ( SELECT c.XMLDATA  from XDB.XDB$CHOICE_MODEL c where ref(c) = ct.XMLDATA.CHOICE_KID)
               WHEN ct.XMLDATA.GROUP_KID is not NULL
                 -- COMPLEXTYPE is based on a GROUP.
                 THEN (
                         -- RETURN The CHOICE, ALL or SEQUENCE for GROUP
                         SELECT CASE
                                  WHEN gd.XMLDATA.ALL_KID is not NULL
                                    THEN ( SELECT a.XMLDATA  from XDB.XDB$ALL_MODEL a where ref(a) = gd.XMLDATA.ALL_KID)
                                  WHEN gd.XMLDATA.SEQUENCE_KID is not NULL
                                    THEN ( SELECT s.XMLDATA  from XDB.XDB$SEQUENCE_MODEL s where ref(s) = gd.XMLDATA.SEQUENCE_KID)
                                  WHEN gd.XMLDATA.CHOICE_KID is not NULL
                                    THEN ( SELECT c.XMLDATA  from XDB.XDB$CHOICE_MODEL c where ref(c) = gd.XMLDATA.CHOICE_KID)
                                  END
                             FROM XDB.XDB$GROUP_DEF gd, xdb.xdb$GROUP_REF gr
                            WHERE ref(gd) = gr.XMLDATA.GROUPREF_REF
                              and ref(gr) = ct.XMLDATA.GROUP_KID
    --           WHEN ct.XMLDATA.COMPLEXCONTENT.RESTRICTION.ALL_KID is not NULL
    --             THEN ( SELECT a.XMLDATA  from XDB.XDB$ALL_MODEL a where ref(a) = ct.XMLDATA.COMPLEXCONTENT.RESTRICTION.ALL_KID)
    --           WHEN ct.XMLDATA.COMPLEXCONTENT.RESTRICTION.SEQUENCE_KID is not NULL
    --            THEN ( SELECT s.XMLDATA  from XDB.XDB$SEQUENCE_MODEL s where ref(s) = ct.XMLDATA.COMPLEXCONTENT.RESTRICTION.SEQUENCE_KID)
    --           WHEN ct.XMLDATA.COMPLEXCONTENT.RESTRICTION.CHOICE_KID is not NULL
    --             THEN ( SELECT c.XMLDATA  from XDB.XDB$CHOICE_MODEL c where ref(c) = ct.XMLDATA.COMPLEXCONTENT.RESTRICTION.CHOICE_KID)
    --           WHEN ct.XMLDATA.COMPLEXCONTENT.RESTRICTION.GROUP_KID is not NULL
    --             -- COMPLEXTYPE is based on a GROUP.
    --             THEN (
    --                     -- RETURN The CHOICE, ALL or SEQUENCE for GROUP
    --                     SELECT CASE
    --                              WHEN gd.XMLDATA.ALL_KID is not NULL
    --                                THEN ( SELECT a.XMLDATA  from XDB.XDB$ALL_MODEL a where ref(a) = gd.XMLDATA.ALL_KID)
    --                              WHEN gd.XMLDATA.SEQUENCE_KID is not NULL
    --                                THEN ( SELECT s.XMLDATA  from XDB.XDB$SEQUENCE_MODEL s where ref(s) = gd.XMLDATA.SEQUENCE_KID)
    --                              WHEN gd.XMLDATA.CHOICE_KID is not NULL
    --                                THEN ( SELECT c.XMLDATA  from XDB.XDB$CHOICE_MODEL c where ref(c) = gd.XMLDATA.CHOICE_KID)
    --                              END
    --                         FROM XDB.XDB$GROUP_DEF gd, xdb.xdb$GROUP_REF gr
    --                       WHERE ref(gd) = gr.XMLDATA.GROUPREF_REF
    --                          and ref(gr) = ct.XMLDATA.COMPLEXCONTENT.RESTRICTION.GROUP_KID
               WHEN ct.XMLDATA.COMPLEXCONTENT.EXTENSION.ALL_KID is not NULL
                 THEN ( SELECT a.XMLDATA  from XDB.XDB$ALL_MODEL a where ref(a) = ct.XMLDATA.COMPLEXCONTENT.EXTENSION.ALL_KID)
               WHEN ct.XMLDATA.COMPLEXCONTENT.EXTENSION.SEQUENCE_KID is not NULL
                 THEN ( SELECT s.XMLDATA  from XDB.XDB$SEQUENCE_MODEL s where ref(s) = ct.XMLDATA.COMPLEXCONTENT.EXTENSION.SEQUENCE_KID)
               WHEN ct.XMLDATA.COMPLEXCONTENT.EXTENSION.CHOICE_KID is not NULL
                 THEN ( SELECT c.XMLDATA  from XDB.XDB$CHOICE_MODEL c where ref(c) = ct.XMLDATA.COMPLEXCONTENT.EXTENSION.CHOICE_KID)
               WHEN ct.XMLDATA.COMPLEXCONTENT.EXTENSION.GROUP_KID is not NULL
                 -- COMPLEXTYPE is based on a GROUP.
                 THEN (
                         -- RETURN The CHOICE, ALL or SEQUENCE for GROUP
                         SELECT CASE
                                  WHEN gd.XMLDATA.ALL_KID is not NULL
                                    THEN ( SELECT a.XMLDATA  from XDB.XDB$ALL_MODEL a where ref(a) = gd.XMLDATA.ALL_KID)
                    

  • Maximum number of columns  in a table or view is 1000

    Post Author: TinaReifer
    CA Forum: Formula
    I am trying to create a direct link from Tririga / Oracle database into Crystal XI.  The data I am attempting to pull is from the RETransaction (Escalations). The error I keep receiving is shown below.  Has anyone run across this problem and found a solution that can be shared?
    Very Appreciative for any feedback.
    Tina Reifer
    "Failed to retrieve data from the database.
    Details: HY000:&#91;Oracle&#93;&#91;ODBC&#93;&#91;Ora&#93;ORA-01792: maximum number of columns  in a table or view is 1000
    &#91;Database Vendor Code:  1792&#93;"

    Post Author: synapsevampire
    CA Forum: Formula
    Try posting your software, its version, and the type of connectivity you're using for oracle.
    Older versions of Crystal used a proprietary Oracle ODBC driver that came with Crystal, but you should SWITCH away from using ODBC anyway, not sure why you elected to use it, it's slower and more problematic.
    You'll see Oracle Server listed as a data source, that is generally the best connectivity to use.
    Also, what version of Oracle is it, and what Oracle client are you using?
    You might need your Oracle dbas assistance here.
    Anyway, the error is not a Crystal error, it's being raised by the ODBC driver, and Oracle used to have a maximum of 1024 colums I think it was...been a while...
    -k

  • Registerschema gives ORA-01792: maximum number of columns...

    Hi,
    DB: Oracle9i Enterprise Edition Release 9.2.0.6.0
    Opp Sys: HP-UX
    I've just increased the size of an XSD we have loaded in a customers database and attempting to reload using dbms_xmlschema.registerschema gives the following error:
    ORA-31084: error while creating table "SOLO"."LetterRoot5799_TAB" for element "LetterRoot"
    ORA-01792: maximum number of columns in a table or view is 1000
    ORA-02310: exceeded maximum number of allowable columns in table
    ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 0
    ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 26
    ORA-06512: at "SOLO.WORK_TEST_LETTERS_XSD", line 23
    ORA-06512: at line 2
    Is there a work around for this?
    Thanks,
    Mike Moore

    Hi! I faced the same problem as author of a thread. At first it was just the same and I used solution that was offered - add attribute xdb:SQLInline="false".
    But now this error (ORA-01792: maximum number of columns in a table or view is 1000) became to rise on element that doesn't have a lot of attributes or subelements that coul exceed limit of 1000! Moreover it is based on complex type that already exists! It was created during another schema registration, which is included in schema that I'm trying to register now!
    Does anyone challenged this problem?
    I use Oracle9i Enterprise Edition Release 9.2.0.5.0

  • Maximum number of columns in List for InfoPath to customise?

    What is the maximum number of columns I can have in a list to be able to customise it with InfoPath?
    We have ~180 columns in our list, and it was working before with ~80, however it's now failing with "The
    SOAP message cannot be parsed"  error. Please see my StackExchange Error post
    here.
    So just wondering if InfoPath can't handle too many columns? Or perhaps IIS is killing the message because the XML packet sent to the service is too large?
    Update: I increased all IPFS settings in Central Admin ten-fold, but I still got the same error.
    Update: As per my StackExchange post - I saved the list as a blank template and was able to customize the list with InfoPath and publish the changes. Seems it could also be data-related. The current list has ~1000 items in it.

    Hi Peter,
    Please try adding the executionTimeout="3000" in your SharePoint site web.config file (please back up the original file firstly) per the following article, then check result again (restart the IIS if needed), 
    http://sharepointshah.blogspot.com/2012/11/soap-message-cannot-be-parsed-error.html
    If the issue still happens, you can check if there are more related errors in ULS log like this
    article.
    Thanks
    Daniel Yang
    TechNet Community Support

  • Maximum Number Of Columns For A OBIEE Pivot Table?

    Hi All ,
    What is the Maximum Number of Columns for a OBIEE Pivot Table? Also what is default size of columns set for Pivot view in OBIEE 11g?
    Thanks In Advance.
    Qujes

    Hi,
    You can increase the maximum columns in a view by add some tags to instanceconfig.xml file.
    check this...http://obiee101.blogspot.com/2008/02/obiee-controling-pivot-view-behavior.html
    Regards,
    Srikanth
    Edited by: Srikanth Mandadi on Oct 15, 2010 10:04 AM

  • Sort key too long - maximum number of columns in select statement

    the sort key too long is caused by either too many group
    functions or too many columns selected. Does anyone know the
    maximum number of columns that can be selected in one statement ?

    The Oracle 9i reference states ...
    The GROUP BY expression and all of the
    nondistinct aggregates functions (for example,
    SUM, AVG) must fit within a single database
    block.
    ... and the Oracle 9i SQL Reference states that ...
    An order_by_clause can contain no more than 255
    expressions.
    You could check your own documentation, but i think it will
    be the same.

  • What is the maximum number of columns that can be displayed by sqlplus?

    Hello,
    Questions:
    Is there a limit on what sqlplus can display?
    What is the maximum number of columns that can be displayed by sqlplus?
    I cannot find anything on this in my search. I checked the limits page:
    http://docs.oracle.com/cd/B19306_01/server.102/b14357/apa.htm#sthref3658
    http://docs.oracle.com/cd/E11882_01/server.112/e16604/apa.htm#i635278
    It does not specify any column limits; however, I'm thinking it is tied to LINESIZE which is system dependent.
    Please confirm if true.
    Thanks!

    Received answer directly from SQL*Plus Development:
    "sqlplus does not have a limit on the number of columns it displays."
    They created a table with more than 256 columns with data and had no problem retrieving the data.

  • What is the maximum number of columns available in Numbers 3.1?

    What is the maximum number of columns available in Numbers 3.1? (I don't seem to be able to get past Column IU. Is that just how it is?)

    DBacs wrote:
    Aha! Just after posting this, the Support Community website suggested "More Like This", and I discovered the answer: 256 columns.  (I don't suppose I get Genius Points for answering my own question, do I...?)
    No

  • What is the maximum number of columns allowed on a table?

    What is the maximum number of columns that a table can have? I have a research team that wants to have 140,000 columns on one table and 2000 rows.
    What would be the best way to input (SQL*Loader?) that data on this table and retrieve data from this table? The highest number of columns that I have implemented on a table was 500.
    Any feedback would be greatly appreciated.
    Thanks. ;-)

    Holy cow 140,000 columns and 2000 rows!! I think you are going to have to tell someone to come up with a better design because that doesn't sound like a relational table. Besides, I found this in the Oracle 8.1.7 Reference Manual:
    "The absolute maximum number of columns in a table is 1000. However, when you create an object table (or a relational table with columns of object, nested table, varray, or REF type), Oracle maps the columns of the user-defined types to relational columns, creating in effect "hidden columns" that count toward the 1000-column limit. For details on how Oracle calculates the total number of columns in such a table, please refer to Oracle8i Administrator's Guide."

  • Maximum number of columns in a table

    Hi all
    I want to know the maximum number of columns in a table. Every people say either don't no? or else some are saying some number. Please can any body help me.
    Karthikeyan.Kesavan

    Every people say either don't no?
    or else some are saying some numberThen why not read the documentation ?

  • Maximum number of columns 90 exceeded

    Hi,
    after implementation SP SAPKH60409 we have problem with ALV reports FBL1N (3,5).
    When I choose a button "select layout" I get the message:
    Maximum number of columns 90 exceeded ( Message no. 0K114). It is not true because the layout has less columns.
    I have set an user parameter FIT_ALVC = 'X' and it solved  the problem but halfway the only.
    In FBL1N we can change display layout via "Switch list". The first uses FM REUSE_ALV_GRID_DISPLAY, the second  REUSE_ALV_LIST_DISPLAY. In the first it works, but it doesnt in the second.
    Did you identify such problems?
    regards

    We had the same issue occurring where message OK114 was being issued.  We had loaded note 1566394 in our system but only had the first correction for this note.  SAP applied a 2nd correction to this note on the 28th of March 2011 which has now fixed our issue.  Get your developer(s) to check the ABAP include LKKBLF01.  At line no. 5946 there is a message being issued "message w114(0k) with con_max_columns."  The 2nd correction of the note puts this message within the following IF statement "if l_no_out_count > con_max_columns.".  Hopefully this 2nd correction fixes your issue.
    Michael Arter

  • Maximum Number of Columns a ResultSet can support

    Hi,
    Can someone tell me what the maximum number of columns a result set can support? I'm using a cachedrowset to retrieve about 50 columns from a table and it seems to stop collecting columns after 33.
    Is there a way to work around this?
    Thanks

    Can someone tell me what the maximum number of
    columns a result set can support? I'm using a
    cachedrowset to retrieve about 50 columns from a
    table and it seems to stop collecting columns after
    33.
    33 is a suspiciously low number.
    Why do you think it 'stopped'? Explain exactly how you determined this.
    What are the data types of fields 30-34?
    Why do you think that the java program is actually getting 50 columns?
    Finally in general everything in a computer is limited. However 33/50 would be significantly below normal limits for most resources.

  • Maximum Number of Columns that adf table can support in JDeveloper 10.1.3.1

    Hi All,
    I'm using Toplink 10.1.3.1 . In JDeveloper 10.1.3.1 .
    I'm Trying to display the columns of a table which is having the more than 380 columns.
    When I'm trying to display the columns in adf table, it is getting hanged. The console of the displaying that "too long".
    If Execute the Application with nearly 50 columns, It is working fine.
    what is the Maximum number of columns that adf table can support. Is there any other solution for my problem.
    could anyone help me out.
    Thanks in advance,
    regards,
    Satish

    Hi,
    I am not sure there exist a limitation in columns and if the application hangs then this probably is a bug either in the business service or the view (which can also be due to that the server runs out of memory because of the created object instances).
    However, in my opinion a table with 380 columns is a loud cry for denormalization
    Frank

Maybe you are looking for

  • Premiere Pro CS6 won't open (nor will After Effects)

    I'm using a Mac, and this morning my system needed to run two updates.  The first was an update for OS X to 10.9.2.  It's focus was on improvement to stability, compatibility, and security.  The second was a CUDA driver update to 5.5.47.  After both

  • After Effects CC import "Sequence Footage" frame rate settings in "Import" preferences

    Just started using the new AE CC (v12 as Adobe will not refer to it as) I noticed one thing that seems to work differently from CS6 and that is in the preferences for import Sequence footage settings.  It doesn't seem to work normally, at least for m

  • Enterprise Session Bean Problem

    Dear Experts, I have just installed Netweaver Developer Studio 7.1 Composition Environment and is doing some development on it from the tutorial in the following link [http://help.sap.com/saphelp_nw04/helpdata/en/c3/679564e11d482f8a706b423f67e56c/con

  • Problems with deploying ODAC to web server

    I have a ASP.NET 4.0 MVC application using Entity Framework and ODAC r4 11.2.0.3.0. I have Oracle 10g client installed on the server (2003) already. I installed the 32-bit ODAC 4 XCopy deployment to the server using the batch file. So I have two Orac

  • IPhoto 09 library locked!!!

    I installed iLife '09 this morning, everything installed ok and i started to have a look at iPhoto. All seemed fine, the people section was scanning my photos (it takes ages 900 mins+ !!) and I was going through putting in my places info. Then it cra