"ORA-00902: invalid datatype" when trying to register local schema

I'm trying to register a local schema which uses/includes a global schema(s). I validated the schemas using XMLSpy.
Registering the global schema(s) was successful. Registering these global schemas was done under user "Generic". For local schemas, that use global schema, a new user is created, and the following script is executed.
SQL> --
SQL> -- Create user
SQL> --
SQL> create user &1 identified by &2
2 temporary TABLESPACE temp
3 default TABLESPACE users;
old 1: create user &1 identified by &2
new 1: create user Simple identified by Simple
User created.
Elapsed: 00:00:00.03
SQL> --
SQL> -- Grant privileges
SQL> --
SQL> grant create session to &1;
old 1: grant create session to &1
new 1: grant create session to Simple
Grant succeeded.
Elapsed: 00:00:00.01
SQL> grant resource to &1;
old 1: grant resource to &1
new 1: grant resource to Simple
Grant succeeded.
Elapsed: 00:00:00.01
SQL> -- Dunno if following is required for local schemas, but if I remove I can't FTP
SQL> grant dba, xdbadmin to &1;
old 1: grant dba, xdbadmin to &1
new 1: grant dba, xdbadmin to Simple
Grant succeeded.
Elapsed: 00:00:00.02
SQL>
SQL> --
SQL> -- Connect ;-)
SQL> --
SQL> connect &1/&2@SVF91;
Connected.
===========================================================
SQL> --
SQL> -- Register the schema in Oracle
SQL> --
SQL> BEGIN
2 DBMS_XMLSchema.registerSchema(
3      schemaURL => '&1',
4      schemaDoc => xdbURIType('&2').getClob(),
5      local     => TRUE,
6      genTypes => TRUE,
7      genBean => FALSE,
8      genTables => TRUE);
9 END;
10 /
old 3: schemaURL     => '&1',
new 3: schemaURL     => 'http://http://ehvl091a:8080/home/Simple/xsd/SimplePOI.xsd',
old 4: schemaDoc     => xdbURIType('&2').getClob(),
new 4: schemaDoc     => xdbURIType('/home/Simple/xsd/SimplePOI.xsd').getClob(),
BEGIN
ERROR at line 1:
ORA-31084: error while creating table "SIMPLE"."SIMPLE_XPOI" for element
"XPOIS"
ORA-00902: invalid datatype
ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 20
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 31
ORA-06512: at line 2
The schema I use is:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:POI="POI" xmlns:xdb="http://xmlns.oracle.com/xdb" targetNamespace="POI" elementFormDefault="qualified" attributeFormDefault="unqualified" xdb:storeVarrayAsTable="true">
     <xs:include schemaLocation="http://ehvl091a:8080/home/Generic/xsd/POI.xsd"/>
     <xs:element name="XPOIS" xdb:defaultTable="SIMPLE_XPOI">
          <xs:annotation>
               <xs:documentation>A collection of XPOI</xs:documentation>
          </xs:annotation>
          <xs:complexType>
               <xs:sequence>
                    <xs:element name="Simple" minOccurs="3" maxOccurs="unbounded" xdb:columnProps="NOT SUBSTITUTABLE">
                         <xs:complexType>
                              <xs:complexContent>
                                   <xs:extension base="POI:POIType"/>
                              </xs:complexContent>
                         </xs:complexType>
                    </xs:element>
               </xs:sequence>
          </xs:complexType>
     </xs:element>
</xs:schema>
I'm new at this XML (Oracle) stuff, so i could really use some pointers on how to tackle this. Thanks in advance.

The following example works for me...
SQL> connect / as sysdba
Connected.
SQL> --
SQL> drop user global cascade
  2  /
User dropped.
SQL> drop user local cascade
  2  /
User dropped.
SQL> create user global identified by global
  2  /
User created.
SQL> grant connect, resource, alter session, create view, xdbadmin to global
  2  /
Grant succeeded.
SQL> create user local identified by local
  2  /
User created.
SQL> grant connect, resource, alter session, create view to local
  2  /
Grant succeeded.
SQL> connect global/global
Connected.
SQL> --
SQL> var schemaURL varchar2(256)
SQL> var schemaPath varchar2(256)
SQL> --
SQL> begin
  2    :schemaURL := 'poTypes.xsd';
  3    :schemaPath := '/public/poTypes.xsd';
  4  end;
  5  /
PL/SQL procedure successfully completed.
SQL> declare
  2    res boolean;
  3    xmlSchema xmlType := xmlType(
  4  '<!-- edited with XML Spy v4.0 U (http://www.xmlspy.com) by Mark (Drake) -->
  5  <xs:schema xmlns="http://xmlns.oralce.com/demo/xdb/purchaseOrderTypes" targetNamespace="http://xmlns.oralce.com/demo/xdb/purchaseOrderT
ypes" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" version="1.0" xdb:storeVarrayAsTable="true">
  6     <xs:complexType name="LineItemsType" xdb:SQLType="LINEITEMS_T">
  7             <xs:sequence>
  8                     <xs:element name="LineItem" type="LineItemType" maxOccurs="unbounded" xdb:SQLName="LINEITEM" xdb:SQLCollType="LINEIT
EM_V"/>
  9             </xs:sequence>
10     </xs:complexType>
11     <xs:complexType name="LineItemType" xdb:SQLType="LINEITEM_T">
12             <xs:sequence>
13                     <xs:element name="Description" type="DescriptionType" xdb:SQLName="DESCRIPTION"/>
14                     <xs:element name="Part" type="PartType" xdb:SQLName="PART"/>
15             </xs:sequence>
16             <xs:attribute name="ItemNumber" type="xs:integer" xdb:SQLName="ITEMNUMBER" xdb:SQLType="NUMBER"/>
17     </xs:complexType>
18     <xs:complexType name="PartType" xdb:SQLType="PART_T">
19             <xs:attribute name="Id" xdb:SQLName="PART_NUMBER" xdb:SQLType="VARCHAR2">
20                     <xs:simpleType>
21                             <xs:restriction base="xs:string">
22                                     <xs:minLength value="10"/>
23                                     <xs:maxLength value="14"/>
24                             </xs:restriction>
25                     </xs:simpleType>
26             </xs:attribute>
27             <xs:attribute name="Quantity" type="moneyType" xdb:SQLName="QUANTITY"/>
28             <xs:attribute name="UnitPrice" type="quantityType" xdb:SQLName="UNITPRICE"/>
29     </xs:complexType>
30     <xs:simpleType name="ReferenceType">
31             <xs:restriction base="xs:string">
32                     <xs:minLength value="18"/>
33                     <xs:maxLength value="30"/>
34             </xs:restriction>
35     </xs:simpleType>
36     <xs:complexType name="ActionsType" xdb:SQLType="ACTIONS_T">
37             <xs:sequence>
38                     <xs:element name="Action" maxOccurs="4" xdb:SQLName="ACTION" xdb:SQLCollType="ACTION_V">
39                             <xs:complexType xdb:SQLType="ACTION_T">
40                                     <xs:sequence>
41                                             <xs:element name="User" type="UserType" xdb:SQLName="ACTIONED_BY"/>
42                                             <xs:element name="Date" type="DateType" minOccurs="0" xdb:SQLName="DATE_ACTIONED"/>
43                                     </xs:sequence>
44                             </xs:complexType>
45                     </xs:element>
46             </xs:sequence>
47     </xs:complexType>
48     <xs:complexType name="RejectionType" xdb:SQLType="REJECTION_T">
49             <xs:all>
50                     <xs:element name="User" type="UserType" minOccurs="0" xdb:SQLName="REJECTED_BY"/>
51                     <xs:element name="Date" type="DateType" minOccurs="0" xdb:SQLName="DATE_REJECTED"/>
52                     <xs:element name="Comments" type="CommentsType" minOccurs="0" xdb:SQLName="REASON_REJECTED"/>
53             </xs:all>
54     </xs:complexType>
55     <xs:complexType name="ShippingInstructionsType" xdb:SQLType="SHIPPING_INSTRUCTIONS_T">
56             <xs:sequence>
57                     <xs:element name="name" type="NameType" minOccurs="0" xdb:SQLName="SHIP_TO_NAME"/>
58                     <xs:element name="address" type="AddressType" minOccurs="0" xdb:SQLName="SHIP_TO_ADDRESS"/>
59                     <xs:element name="telephone" type="TelephoneType" minOccurs="0" xdb:SQLName="SHIP_TO_PHONE"/>
60             </xs:sequence>
61     </xs:complexType>
62     <xs:simpleType name="moneyType">
63             <xs:restriction base="xs:decimal">
64                     <xs:fractionDigits value="2"/>
65                     <xs:totalDigits value="12"/>
66             </xs:restriction>
67     </xs:simpleType>
68     <xs:simpleType name="quantityType">
69             <xs:restriction base="xs:decimal">
70                     <xs:fractionDigits value="4"/>
71                     <xs:totalDigits value="8"/>
72             </xs:restriction>
73     </xs:simpleType>
74     <xs:simpleType name="UserType">
75             <xs:restriction base="xs:string">
76                     <xs:minLength value="1"/>
77                     <xs:maxLength value="10"/>
78             </xs:restriction>
79     </xs:simpleType>
80     <xs:simpleType name="RequestorType">
81             <xs:restriction base="xs:string">
82                     <xs:minLength value="0"/>
83                     <xs:maxLength value="128"/>
84             </xs:restriction>
85     </xs:simpleType>
86     <xs:simpleType name="CostCenterType">
87             <xs:restriction base="xs:string">
88                     <xs:minLength value="1"/>
89                     <xs:maxLength value="4"/>
90             </xs:restriction>
91     </xs:simpleType>
92     <xs:simpleType name="VendorType">
93             <xs:restriction base="xs:string">
94                     <xs:minLength value="0"/>
95                     <xs:maxLength value="20"/>
96             </xs:restriction>
97     </xs:simpleType>
98     <xs:simpleType name="PurchaseOrderNumberType">
99             <xs:restriction base="xs:integer"/>
100     </xs:simpleType>
101     <xs:simpleType name="SpecialInstructionsType">
102             <xs:restriction base="xs:string">
103                     <xs:minLength value="0"/>
104                     <xs:maxLength value="2048"/>
105             </xs:restriction>
106     </xs:simpleType>
107     <xs:simpleType name="NameType">
108             <xs:restriction base="xs:string">
109                     <xs:minLength value="1"/>
110                     <xs:maxLength value="20"/>
111             </xs:restriction>
112     </xs:simpleType>
113     <xs:simpleType name="AddressType">
114             <xs:restriction base="xs:string">
115                     <xs:minLength value="1"/>
116                     <xs:maxLength value="256"/>
117             </xs:restriction>
118     </xs:simpleType>
119     <xs:simpleType name="TelephoneType">
120             <xs:restriction base="xs:string">
121                     <xs:minLength value="1"/>
122                     <xs:maxLength value="24"/>
123             </xs:restriction>
124     </xs:simpleType>
125     <xs:simpleType name="DateType">
126             <xs:restriction base="xs:date"/>
127     </xs:simpleType>
128     <xs:simpleType name="CommentsType">
129             <xs:restriction base="xs:string">
130                     <xs:minLength value="1"/>
131                     <xs:maxLength value="2048"/>
132             </xs:restriction>
133     </xs:simpleType>
134     <xs:simpleType name="DescriptionType">
135             <xs:restriction base="xs:string">
136                     <xs:minLength value="1"/>
137                     <xs:maxLength value="256"/>
138             </xs:restriction>
139     </xs:simpleType>
140  </xs:schema>');
141  begin
142    if (dbms_xdb.existsResource(:schemaPath)) then
143      dbms_xdb.deleteResource(:schemaPath);
144    end if;
145    res := dbms_xdb.createResource(:schemaPath,xmlSchema);
146  end;
147  /
PL/SQL procedure successfully completed.
SQL> begin
  2    dbms_xmlschema.registerSchema
  3    (
  4      :schemaURL,
  5      xdbURIType(:schemaPath).getClob(),
  6      FALSE,TRUE,FALSE,FALSE
  7    );
  8  end;
  9  /
PL/SQL procedure successfully completed.
SQL> connect local/local
Connected.
SQL> --
SQL> var schemaURL varchar2(256)
SQL> var schemaPath varchar2(256)
SQL> --
SQL> begin
  2    :schemaURL := 'po.xsd';
  3    :schemaPath := '/public/po.xsd';
  4  end;
  5  /
PL/SQL procedure successfully completed.
SQL> declare
  2    res boolean;
  3    xmlSchema xmlType := xmlType(
  4  '<xs:schema xmlns="http://xmlns.oralce.com/demo/xdb/purchaseOrder" targetNamespace="http://xmlns.oralce.com/demo/xdb/purchaseOrder"  xm
lns:types="http://xmlns.oralce.com/demo/xdb/purchaseOrderTypes" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.c
om/xdb" version="1.0" xdb:storeVarrayAsTable="true">
  5     <xs:import namespace="http://xmlns.oralce.com/demo/xdb/purchaseOrderTypes" schemaLocation="poTypes.xsd"/>
  6     <xs:element name="PurchaseOrder" type="PurchaseOrderType" xdb:defaultTable="PURCHASEORDER"/>
  7     <xs:complexType name="PurchaseOrderType" xdb:SQLType="PURCHASEORDER_T">
  8             <xs:sequence>
  9                     <xs:element name="Reference" type="types:ReferenceType" xdb:SQLName="REFERENCE"/>
10                     <xs:element name="Actions" type="types:ActionsType" xdb:SQLName="ACTIONS"/>
11                     <xs:element name="Reject" type="types:RejectionType" minOccurs="0" xdb:SQLName="REJECTION"/>
12                     <xs:element name="Requestor" type="types:RequestorType" xdb:SQLName="REQUESTOR"/>
13                     <xs:element name="User" type="types:UserType" xdb:SQLName="USERID"/>
14                     <xs:element name="CostCenter" type="types:CostCenterType" xdb:SQLName="COST_CENTER"/>
15                     <xs:element name="ShippingInstructions" type="types:ShippingInstructionsType" xdb:SQLName="SHIPPING_INSTRUCTIONS"/>
16                     <xs:element name="SpecialInstructions" type="types:SpecialInstructionsType" xdb:SQLName="SPECIAL_INSTRUCTIONS"/>
17                     <xs:element name="LineItems" type="types:LineItemsType" xdb:SQLName="LINEITEMS"/>
18             </xs:sequence>
19     </xs:complexType>
20     </xs:schema>');
21  begin
22    if (dbms_xdb.existsResource(:schemaPath)) then
23      dbms_xdb.deleteResource(:schemaPath);
24    end if;
25    res := dbms_xdb.createResource(:schemaPath,xmlSchema);
26  end;
27  /
PL/SQL procedure successfully completed.
SQL> begin
  2    dbms_xmlschema.registerSchema
  3    (
  4      :schemaURL,
  5      xdbURIType(:schemaPath).getClob(),
  6      TRUE,TRUE,FALSE,TRUE
  7    );
  8  end;
  9  /
PL/SQL procedure successfully completed.
SQL> desc PURCHASEORDER
Name                                      Null?    Type
TABLE of SYS.XMLTYPE(XMLSchema "po.xsd" Element "PurchaseOrder") STORAGE Object-relational TYPE "PURCHASEORDER_T"
SQL> desc PURCHASEORDER_T
PURCHASEORDER_T is NOT FINAL
Name                                      Null?    Type
SYS_XDBPD$                                         XDB.XDB$RAW_LIST_T
REFERENCE                                          VARCHAR2(30 CHAR)
ACTIONS                                            GLOBAL.ACTIONS_T
REJECTION                                          GLOBAL.REJECTION_T
REQUESTOR                                          VARCHAR2(128 CHAR)
USERID                                             VARCHAR2(10 CHAR)
COST_CENTER                                        VARCHAR2(4 CHAR)
SHIPPING_INSTRUCTIONS                              GLOBAL.SHIPPING_INSTRUCTIONS
                                                    _T
SPECIAL_INSTRUCTIONS                               VARCHAR2(2048 CHAR)
LINEITEMS                                          GLOBAL.LINEITEMS_T
SQL>I'm not sure what you were trying here in your xml schema
xdb:columnProps="NOT SUBSTITUTABLE">
or whether or not this annotation is the source of the problem

Similar Messages

  • ORA-00902: invalid datatype

    There is a table t_emp, having column clm1, clm2, clm3, clm4, etc.
    Datatype of columns:-
    clm1 -- Number
    clm2 -- Number(12)
    clm3 -- Char(4)
    Now, I am trying to create a primary key using statement:
    alter table t_emp
    add constraint primary key (clm1, clm2, clm3)It gives oralce error ORA-00902: invalid datatype.
    what is wrong at this place?
    Any thought?
    Regards,
    Ritesh

    You need to give your primary key a name (which is good practice anyway):
    SQL> r
      1  create table t_emp (
      2  clm1  Number,
      3  clm2  Number(12),
      4  clm3  Char(4)
      5* )
    Table created.
    SQL> alter table t_emp
      2  add constraint primary key (clm1, clm2, clm3)
      3  /
    add constraint primary key (clm1, clm2, clm3)
    ERROR at line 2:
    ORA-00902: invalid datatype
    SQL> ed
    Wrote file afiedt.buf
      1  alter table t_emp
      2* add constraint temp_pk primary key (clm1, clm2, clm3)
    SQL> r
      1  alter table t_emp
      2* add constraint temp_pk primary key (clm1, clm2, clm3)
    Table altered.
    SQL>Cheers, APC
    blog: http://radiofreetooting.blogspot.com

  • Need help with "ORA-00902: invalid datatype"  while creating a view

    I am using Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options.....
    when I try ti create a view, I am getting ORA-00902 error.
    SQL> create view sales_view as
    2 select *
    3 from table(OLAP_TABLE('global DURATION session',
    4 'sales_type_table',
    5 '',
    6 'DIMENSION time_id FROM time
    7 DIMENSION channel_id FROM channel
    8 DIMENSION product_id FROM product
    9 DIMENSION customer_id FROM customer
    10 MEASURE sales FROM sales
    11 MEASURE units FROM units
    12 MEASURE extended_cost FROM extended_cost
    13 MEASURE forecast_sales FROM fcast_sales
    14 ROW2CELL olap_calc'));
    create view sales_view as
    ERROR at line 1:
    ORA-00902: invalid datatype
    ORA-06512: at "SYS.OLAPIMPL_T", line 23
    ORA-06512: at "SYS.OLAPIMPL_T", line 17
    ORA-06512: at line 4
    I am new to Oracle.... using document "40261_leveragingtools.pdf" as a guide against a cube created using "Global_AWM10g_Handson.doc".
    AWM displays data from cube without a problem.
    I would welcome any assistance.

    Can you provide the definition of sales_type_table? Also, Are all of the dimensions you have created of type TEXT?
    Swapan.

  • ORA-00902: invalid datatype comile error while using CAST function

    Hi everyone,
    I'm getting ORA-00902: invalid datatype compilation error while using CAST function.
    open ref_cursor_list for select empName from TABLE(CAST(part_t AS partnumberlist));
    The partnumberlist and ref_cursor_list is declared in the Package spec as given below.
    TYPE ref_cursor_list IS REF CURSOR;
    TYPE partnumberlist IS TABLE OF emp.empName%TYPE;
    The error points the partnumberlist as invalid datatype in TOAD because of this i'm unable to compile the package.
    Any suggestion
    Thanks and regards
    Sathish Gopal

    Here is my code for
    package Spec
    CREATE OR REPLACE PACKAGE "HISTORICAL_COMMENTZ" AS
    TYPE prior_part_data_record IS RECORD (
    prior_part_row_id PGM_RPLCMNT_PART.PR_PART_ROW_S_ID%TYPE,
    prior_pgm_chng_s_id PGM_RPLCMNT_PART.PR_PGM_CHNG_S_ID%TYPE
    TYPE parts_list IS TABLE OF prior_part_data_record;
    --TYPE parts_list IS TABLE OF NUMBER;
    TYPE partnumberlist IS TABLE OF PGM_RPLCMNT_PART.PR_PART_ROW_S_ID%TYPE;
    TYPE partnumber_cursor IS REF CURSOR;
    TYPE comment_record IS RECORD (
    pgm_s_id                     PGM_PART_CMNT.PGM_S_ID%TYPE,
    part_row_s_id                PGM_PART_CMNT.PART_ROW_S_ID%TYPE,
    pgm_chng_s_id                PGM_PART_CMNT.PGM_CHNG_S_ID%TYPE,
    cmnt_txt                     PGM_PART_CMNT.CMNT_TXT%TYPE,
    cmnt_dt                     PGM_PART_CMNT.CMNT_DT%TYPE,
    updt_rsrc_id                PGM_PART_CMNT.UPDT_RSRC_ID%TYPE
    TYPE comment_list IS TABLE OF comment_record;
    global_pgm_s_id INTEGER := 0;
    global_part_row_s_id INTEGER := 0;
    err_num NUMBER := 999999;
    err_msg VARCHAR2 (250);
    PROCEDURE getComments (
    pgm_s_id IN NUMBER,
    part_row_s_id IN NUMBER,
    partnumber_cursorlist out partnumber_cursor);
    END;
    Package Body
    CREATE OR REPLACE PACKAGE BODY HISTORICAL_COMMENTZ
    AS
    FUNCTION getPriorPart
    (param_prior_pgm_chng_s_id IN PGM_RPLCMNT_PART.PR_PGM_CHNG_S_ID%TYPE,
    return_prior_part_data_record IN OUT prior_part_data_record
    RETURN INTEGER
    IS
    retVal INTEGER;
    prior_part_row_id INTEGER;
    prior_pgm_chng_s_id INTEGER;
    local_prior_part_data_record prior_part_data_record;
    BEGIN
    SELECT PR_PART_ROW_S_ID AS prior_part_row_id, PR_PGM_CHNG_S_ID AS prior_pgm_chng_s_id
    INTO local_prior_part_data_record
    --SELECT PR_PART_ROW_S_ID INTO retVal
    FROM PGM_RPLCMNT_PART
    WHERE PGM_S_ID = global_pgm_s_id AND CUR_PGM_CHNG_S_ID = param_prior_pgm_chng_s_id;
    return_prior_part_data_record := local_prior_part_data_record;
    retVal := 0;
    RETURN retVal;
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    err_num := SQLCODE;
    err_msg := 'SQL Error ' || SUBSTR (SQLERRM, 1, 250);
    DBMS_OUTPUT.put_line ('SQLERROR = ' || err_msg);
    retVal := -1;
    RETURN retVal;
    WHEN OTHERS
    THEN
    err_num := SQLCODE;
    err_msg := 'SQL Error ' || SUBSTR (SQLERRM, 1, 250);
    DBMS_OUTPUT.put_line ('SQLERROR = ' || err_msg);
    retVal := -1;
    RETURN retVal;
    END getPriorPart;
    FUNCTION getComment (found_parts_list IN parts_list, comments OUT comment_list)
    RETURN INTEGER
    IS
    CURSOR init_cursor
    IS
    SELECT PGM_S_ID,PART_ROW_S_ID,PGM_CHNG_S_ID,CMNT_TXT,CMNT_DT,UPDT_RSRC_ID
    FROM PGM_PART_CMNT WHERE 1 = 2;
    retVal INTEGER;
    indexNum PLS_INTEGER;
    local_part_record prior_part_data_record;
    local_comment_record comment_record;
    local_part_row_s_id NUMBER;
    i PLS_INTEGER;
    BEGIN
    OPEN init_cursor;
    FETCH init_cursor
    BULK COLLECT INTO comments;
    i := 0;
    indexNum := found_parts_list.FIRST;
    WHILE indexNum IS NOT NULL
    LOOP
    local_part_record := found_parts_list(indexnum);
    local_part_row_s_id := local_part_record.prior_part_row_id;
    SELECT PGM_S_ID,PART_ROW_S_ID,PGM_CHNG_S_ID,CMNT_TXT,CMNT_DT,UPDT_RSRC_ID
    INTO local_comment_record FROM PGM_PART_CMNT
    WHERE PGM_S_ID = global_pgm_s_id
    AND PART_ROW_S_ID = local_part_row_s_id;
    comments(i) := local_comment_record;
    i := i + 1;
    END LOOP;
    RETURN retval;
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    err_num := SQLCODE;
    err_msg := 'SQL Error ' || SUBSTR (SQLERRM, 1, 250);
    DBMS_OUTPUT.put_line ('SQLERROR = ' || err_msg);
    RETURN retval;
    WHEN OTHERS
    THEN
    err_num := SQLCODE;
    err_msg := 'SQL Error ' || SUBSTR (SQLERRM, 1, 250);
    DBMS_OUTPUT.put_line ('SQLERROR = ' || err_msg);
    RETURN retval;
    END getComment;
    PROCEDURE getComments
    pgm_s_id IN NUMBER,
    part_row_s_id IN NUMBER,
    partnumber_cursorlist OUT partnumber_cursor)
    IS
    comment_recordlist comment_record;
    retPartnumberlist partnumberlist;
    found_parts_list parts_list;
    local_part_record prior_part_data_record;
    is_more_parts BOOLEAN;
    driver_chng_s_id NUMBER;
    num_parts NUMBER;
    retVal NUMBER;
    comments comment_list;
    returnPartnumberlist partnumberlist;
    iloopCounter PLS_INTEGER;
    inx1 PLS_INTEGER;
    part_t partnumberlist :=partnumberlist(100,200,300);
    CURSOR part_list_init_cursor
    IS
    SELECT PR_PART_ROW_S_ID,PR_PGM_CHNG_S_ID FROM PGM_RPLCMNT_PART WHERE 1 = 2;
    CURSOR inIt_cursor
    IS
    SELECT 0 FROM DUAL WHERE 1 = 2;
    BEGIN
    DBMS_OUTPUT.ENABLE (5000000);
    global_pgm_s_id := pgm_s_id;
    global_part_row_s_id := part_row_s_id;
    SELECT PART_ROW_S_ID AS prior_part_row_id, PR_PGM_CHNG_S_ID AS prior_pgm_chng_s_id
    INTO local_part_record
    FROM PGM_RPLCMNT_PART
    WHERE PGM_S_ID = global_pgm_s_id AND PART_ROW_S_ID = global_part_row_s_id AND
    CUR_PGM_CHNG_S_ID IN (SELECT MAX(CUR_PGM_CHNG_S_ID) FROM PGM_RPLCMNT_PART WHERE
    PGM_S_ID = global_pgm_s_id AND PART_ROW_S_ID = global_part_row_s_id
    GROUP BY PART_ROW_S_ID);
    OPEN part_list_init_cursor;
    FETCH part_list_init_cursor
    BULK COLLECT INTO found_parts_list;
    -- Add the existing part to the found list
    found_parts_list.EXTEND;
    found_parts_list(1) := local_part_record;
    driver_chng_s_id := local_part_record.prior_pgm_chng_s_id;
    num_parts := 1;
    is_more_parts := TRUE;
    WHILE (is_more_parts) LOOP
    retVal := getPriorPart(driver_chng_s_id,local_part_record);
    IF (retVal != -1) THEN
    found_parts_list.EXTEND;
    num_parts := num_parts + 1;
    found_parts_list(num_parts) := local_part_record;
    driver_chng_s_id := local_part_record.prior_pgm_chng_s_id;
    ELSE
    is_more_parts := FALSE;
    END IF;
    END LOOP;
    --num_parts := getComment(found_parts_list,comments);
    OPEN init_cursor;
    FETCH init_cursor
    BULK COLLECT INTO returnPartnumberlist;
    num_parts := found_parts_list.COUNT;
    FOR iloopCounter IN 1 .. num_parts
    LOOP
    returnPartnumberlist.EXTEND;
    returnPartnumberlist(iloopCounter) := found_parts_list(iloopCounter).prior_part_row_id;
    END LOOP;
    retPartnumberlist := returnPartnumberlist;
    open
    *          partnumber_cursorlist for select PR_PART_ROW_S_ID from TABLE(CAST(retPartnumberlist AS historical_commentz.partnumberlist));*                              
    DBMS_OUTPUT.put_line('Done....!');
    EXCEPTION
    some code..............................
    END getComments;
    END HISTORICAL_COMMENTZ;
    /

  • Table cast PL/SQL: ORA-00902: invalid datatype

    I m getting
    PL/SQL: ORA-00902: invalid datatype
    error in
    OPEN pPymtCur FOR
    SELECT *
    FROM TABLE(CAST( up_gap_tra_reports.myArray AS traArray));
    in my package up_gap_tra_reports.
    CREATE OR REPLACE PACKAGE GAPSDVEL.up_gap_tra_reports
    AS
    TYPE traRecord IS RECORD
    group1StudEnrol NUMBER(6,1),
    group2StudEnrol NUMBER(6,1),
    pymtAmt gap_payment.NET_AMT%TYPE
    TYPE traArray IS TABLE OF traRecord;
    myArray traArray := traArray() ;
    END up_gap_tra_reports;
    I hv alreay declared traArray type.
    pls help me to solve this.

    Meghna wrote:
    is there any way to use pl/sql collection in SQL or refcur without creating it because i am not able to create type in database.The only way I am aware of is pipelined function:
    create or replace
      package pkg1
        is
          type traRecord
            is record(
                      ename emp.ename%type,
                      sal   emp.sal%type
          TYPE traArray IS TABLE OF traRecord;
          function f1
            return traArray
            pipelined;
    end;
    create or replace
      package body pkg1
        is
        function f1
            return traArray
            pipelined
          is
              v_rec traRecord;
          begin
              v_rec.ename := 'Sam';
              v_rec.sal := 1000;
              pipe row(v_rec);
              v_rec.ename := 'John';
              v_rec.sal := 1500;
              pipe row(v_rec);
              v_rec.ename := 'Mary';
              v_rec.sal := 2000;
              pipe row(v_rec);
              return;
        end;
    end;
    /Now you can:
    SQL> select * from table(pkg1.f1)
      2  /
    ENAME             SAL
    Sam              1000
    John             1500
    Mary             2000
    SQL>Keep in mind, it will create system generated types:
    SQL> select type_name from user_types
      2  /
    TYPE_NAME
    SYS_PLSQL_73305_9_1
    SYS_PLSQL_73305_DUMMY_1
    SYS_PLSQL_73305_34_1
    SQL> desc SYS_PLSQL_73305_9_1
    Name                                      Null?    Type
    ENAME                                              VARCHAR2(10)
    SAL                                                NUMBER(7,2)
    SQL> desc SYS_PLSQL_73305_DUMMY_1
    SYS_PLSQL_73305_DUMMY_1 TABLE OF NUMBER
    SQL> desc SYS_PLSQL_73305_34_1
    SYS_PLSQL_73305_34_1 TABLE OF SYS_PLSQL_73305_9_1
    Name                                      Null?    Type
    ENAME                                              VARCHAR2(10)
    SAL                                                NUMBER(7,2)
    SQL> SY.

  • Help ORA-00902: invalid datatype

    I am getting the following error for a constraint I have created, cant see why it doesnt work?
    (EXISTS(SELECT best_buy_gourmet_name
    ERROR at line 5:
    ORA-00902: invalid datatype
    This constraint is just below my variable declerations in a create Endorses table:
    CONSTRAINT
    (EXISTS(SELECT best_buy_gourmet_name
    FROM(SELECT * FROM Sells,Endorses WHERE Sells.shop_name = Endorses.shop_name)
    GROUP BY best_buy_gourmet_name HAVING COUNT(*) > 0)),
    Thanks for your time

    You cannot do this in a CHECK constraint. What you need to do is define a foreign key between ENDORSES and SELLS tables.
    Cheers, APC

  • OEHR Sample Objects Installation - ORA-00902: invalid datatype

    When I was trying to install the supporting objects, I received a CREATE TYPE privilege error previously. Then the DBA updated APEX to 2.2.1 to fix the problem. It did but know I'm gettingn ORA-00901:invalid datatype and othere errors with creating the tables, views,etc. Can somebody help me. I'm running APEX with database version 9.2

    Can somebody help me? I can not install the database objects. I get an invalid datatype error when the install script attempts to install the tables.
    Please help!

  • ORA-10722 Invalid Number when trying to Associate Asset to Activity

    Hello experts,
    For Activities created by API, we are getting an error (ORA-10722 Invalid Number) when attempting to associate a asset to the activity using the activity Association Form. Has anyone run across this before?
    Thanks,
    Tom

    ORA-01722: invalid number
    It can be because of The attempted conversion of a character string to a number failed because the character string was not a valid numeric literal.
    Only numeric fields or character fields containing numeric data may be used in arithmetic functions or expressions.
    Only numeric fields may be added to or subtracted from dates.
    Check the character strings in the function or expression.
    Check that they contain only numbers, a sign, a decimal point, and the character "E" or "e" and retry the operation .
    Check API design.
    Regards
    Kamal

  • ORA-31050: Access denied when try to register XMLSchema

    Dear All
    I got ORA-31050: Access denied
    when tried to run to load XML schema with DBMS_XMLSCHEMA.registerSchema
    Can you advise me what privilege should I grant to the user?
    I tried grant XDBADMIN role but it does nto help
    Thank you in advance
    Artem Rodin

    Dear Mark!
    I realy need you help!
    I can successfully register schema which has complexType declaration as root element, like
    <schema targetNamespace="http://www.oracle.com/PO.xsd"
         xmlns:po="http://www.oracle.com/PO.xsd"
         xmlns="http://www.w3.org/2001/XMLSchema">
    <complexType name="PurchaseOrderType">
         <sequence>
              <element name="PONum" type="decimal"/>
              <element name="Company">
                   <simpleType>
                        <restriction base="string">
                             <maxLength value="100"/>
                        </restriction>
                   </simpleType>
              </element>
              <element name="Item" maxOccurs="1000">
                   <complexType>
                        <sequence>
                             <element name="Part">
                                  <simpleType>
                                       <restriction base="string">
                                            <maxLength value="1000"/>
                                       </restriction>
                                  </simpleType>
                             </element>
                             <element name="Price" type="float"/>
                        </sequence>
                   </complexType>
              </element>
         </sequence>
    </complexType>
    <!--element name="PurchaseOrder" type="po:PurchaseOrderType"/-->
    </schema>
    But I failed if in the root there is element like
    <schema targetNamespace="http://www.oracle.com/PO.xsd"
         xmlns:po="http://www.oracle.com/PO.xsd"
         xmlns="http://www.w3.org/2001/XMLSchema">
    <complexType name="PurchaseOrderType">
         <sequence>
              <element name="PONum" type="decimal"/>
              <element name="Company">
                   <simpleType>
                        <restriction base="string">
                             <maxLength value="100"/>
                        </restriction>
                   </simpleType>
              </element>
              <element name="Item" maxOccurs="1000">
                   <complexType>
                        <sequence>
                             <element name="Part">
                                  <simpleType>
                                       <restriction base="string">
                                            <maxLength value="1000"/>
                                       </restriction>
                                  </simpleType>
                             </element>
                             <element name="Price" type="float"/>
                        </sequence>
                   </complexType>
              </element>
         </sequence>
    </complexType>
    <element name="PurchaseOrder" type="po:PurchaseOrderType"/>
    </schema>
    I got the following error stack
    ORA-01031: insufficient privileges
    ORA-06512: at “XDB.DBMS_XDBZ0”, line 218
    ORA-06512: at “XDB.DBMS_XDBZ”, line 6
    ORA-06512: at line 1
    ORA-06512: at “XDB.DBMS_XMLSCHEMA_INT”, line 0
    ORA-06512: at “XDB.DBMS_XMLSCHEMA”, line 26
    ORA-06512: at “XDB.DBMS_XMLSCHEMA”, line 131
    ORA-06512: at “DVLP.PRIME_BRIDGE”, line 73
    ORA-06512: at line 7
    I guess you can reproduce this in-house,
    It's not my schema it is taken from
    XML Database Developer’s Guide - Oracle XML DB
    Structured Mapping of XMLType 5-3
    Example 5–1 XML Schema Definition, po.xsd
    As far as I understand in the second case Oracle tries to create a table to store XML content and fails to do it.
    User that I used has DBA role. What other privileges should I grant to the user? And/or I should grant some additional privileges to "XDB" user?
    This issue has become critical for me, so I am highly appreciate any assistance
    Many thanks in advance
    Best regards
    Artem Rodin

  • Error: Invalid Password when trying to sign in on any wireless devise

    Error:  Invalid Password when trying to sign in on any wireless devise
    I even reinstalled my WRT110 to be sure of the Network Name and Password but I still get this error.  I have never been able to log in to the wireless network.  I can see it - Ienter my password and still "Invalid Password"

    I don't understand this: Connect directly to the router.  Is this the http://192.168.1.1?
    I  HAVE changed the network name, I HAVE changed the password.
    I still get invalid password!!!
    I am extremely frustrated by all this.  I need simple instructions.  I followed them when I set the friggin thing up, I reinstalled.  I know what my friggin password is - why why why?

  • When trying to register my ipad and put in my email address, a statement comes up stating the address is already verified for another apple id.  How can I add my ipad?

    When trying to register my ipad to mobile me by putting in my email address, a statement comes up stating the email address is already verified for another apple ID (which is me).  How can I still use this email for the ipad?

    Try here.
    Frequently Asked Questions About Apple ID
    and here.  Using an existing Apple ID with the iTunes Store and Mac App Store

  • I am getting a "invalid screenshot" when trying to upload the screen shot to a Words With Friends cheat app.  It just started doing this!

    I am getting a "invalid screenshot" when trying to upload the screenshot to a Words With Friends cheat application.
    What am I doing wrong?

    That was no help!  When playing with two grown daughters with high IQs,
    I need all the help I can get!

  • Ajax submit failed: error =403, Forbidden, Forbidden when trying to register account

    I get: "Ajax submit failed: error =403, Forbidden" when trying to register with ePrint
    This question was solved.
    View Solution.

    Tim_H wrote:
    Hi BOLAINE,
    I'm sorry you're having this problem.  The best way to work around it is to try using a different browser.  Preferably either nternet Explorer, Firefox, or Chrome.
    Let me know if this helps, please.
    I  having the same problem getting Ajax submit failed=403 when trying to register account.  All I have is a new Chromebook. Am I stuck?  Don't seem to have an option of other browsers...?
    cg

  • I keep getting an invalid address when trying to purchase songs.  All the information is correct - it just send me in a circle

    I keep getting an invalid address when trying to purchase songs on itune.  All the information entered is correct.  I have tried on my iPhone, iPad, iTouch and on itunes.

    THE FIX: your credit card address AND spelling of your name must match iTunes.
    Please don't google or read other blog entries on the Internet telling you to use a restaurant address or those that are telling you apple is doing address validation. They are all written by 17 year olds who pick up the first thing and re-post. Why do people try to "help" by authoritatively posting an answer? The mass of them are ruining my google searches. :-)
    Apple is now validating whatever ASCII that you told your credit card company. It's not just address validation.
    Name AND address must match.
    Then it worked for me.

  • Error code 403 when trying to register product or set up eprint

    hp 8600 pro N911a
    error code 403 when trying to register product

    Hello v8442,
    It may have been that the servers were undergoing updates that day.  Try to register again, and if you get the same error, try using a different web browser.
    -------------How do I give Kudos? | How do I mark a post as Solved? --------------------------------------------------------

Maybe you are looking for