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.

Similar Messages

  • 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;
    /

  • 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

  • "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

  • 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.

  • 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

  • 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!

  • Need help to read the item details while creating the Opportunity in SAP CR

    Hi,
    I need to read the values entered at item level while creating a new opportunity in SAP CRM 5.0.
    Is there any function modle to do that ? I need to read the custom fields (developed by EEWB)
    and sum  them up and populate at the header level.
    As the data is not saved yet, I cannot read from database in the present scenario.
    Thanks and regards

    Hi,
      U can use CRM_ORDER_READ.
    1) Pass the values for the ITEM guid which u want to read.
    2) ignore the other header guid and object id because it is for whole contract
    3) if u had custmize any table it will be available in the internal table returned by the function module.
    4) u have to identify which internal table will contain the field since many internal table are available with similar meaning.
    4) CRM_ORDER_ORDER is heavy function module it reads entire contract hence u need to specify which internal table u have to read any only those values will be read. for that u have to fill in <b>it_requested_objects</b>
    fill requested ogject with below statement
    INSERT gc_object_name-orderadm_h  INTO TABLE lit_import_tab.
    gc_object_name is constant structure u have to include
    *-Standard Include
      INCLUDE crm_object_names_con.
    Mark helpfull answers
    Regards
    Manoj

  • Error: ORA-00905:Missing keyword while creating Materialized view

    Hi Gurus,
    I am trying to create a materialized view as :
    1 CREATE MATERIALIZED VIEW AMREG.ClientData
    2 TABLESPACE AMREG_DATA
    3 COMPRESS
    4 PARALLEL
    5 NOLOGGING
    6 BUILD IMMEDIATE
    7 REFRESH COMPLETE
    8 ON DEMAND
    9 DISABLE QUERY REWRITE
    10 REFRESH START WITH TRUNC( SYSDATE + 1 ) + 3/24 NEXT TRUNC( SYSDATE + 1 ) + 3/24
    11 AS
    12 SELECT
    13 CHILD.CLIENT_SGK "Child SGK",
    14 CHILD.CLIENT_NAME "Child Name",
    15 CHILD.ARC_ACCT_CD "Child ARC Acct Code",
    16 ULTIMATE.CLIENT_SGK "Ultimate Parent SGK",
    17 ULTIMATE.CLIENT_NAME "Ultimate Parent Name",
    18 ULTIMATE.ARC_ACCT_CD "Ultimate ARC Acct Code",
    19 HIER.LVL_FROM_ANCESTOR ,
    20 FROM [email protected] CHILD,
    21 [email protected] HIER,
    22 [email protected] ULTIMATE
    23 WHERE HIER.DESCENDANT_CLIENT_SGK = CHILD.CLIENT_SGK
    24* AND ULTIMATE.CLIENT_SGK = HIER.ANCESTOR_CLIENT_SGK;
    SQL> /
    REFRESH START WITH TRUNC( SYSDATE + 1 ) + 3/24 NEXT TRUNC( SYSDATE + 1 ) + 3/24
    ERROR at line 10:
    ORA-00905: missing keyword
    DBLink name is : DNYCPH60.WORLD
    Please guide me on this and help to resolve the issue.

    I provided the answer over at the duplicate post ...
    ORA-00905: missing keyword error while creating a materialised view
    Please, please, please ... please do not duplicate posts. Pick one. If you don't get an answer in a reasonable time - close it (edit the title) and THEN open in a different forum.

  • Need Help with ORA-00604 - ORA-01219

    Hey i'm having a hard to understand the error messages generated by our Oracle database server. i'm in charge of the development of a .NET apps with an Oracle DB underneath.
    i tried to change the parameter values ( the java pool and the shared pool) and when i tried to apply the change from Enterprise manager the shutdown process didn't complete, the parameters values are all gone and i'm trying to log on thru SQL* Plus i'm getting the following errors
    ORA-00604 error occured at recusive SQL Level 1
    ORA-01219 database not open: queries allowed on fixed tables/views only
    is there a way to recover or to reload the previous parameters values? . i really need some help on this
    thanks in advance

    Take a look in the alert log for the database to see why the database did not open. The alert log can be found in ORACLE_BASE/admin/<dbsid>/bdump/alert_<dbsid>.log .
    You can try to open the database with the following:
    set ORACLE_SID=<dbsid>
    sqlplus /nolog
    connect / as sysdba
    alter database open;
    It is possible that the above will not open the database if there is something preventing the opening of the database. That information can be found in the alert log mentioned above.

  • Need help with ora-01036  illegal variable name/number

    Can you help me fix the following problem.
    I'm getting an oracle exceptioin while running the following.
    OracleParameter[] myParameters = new OracleParameter[] { new OracleParameter("SELECTEDREGIONS", OracleDbType.RefCursor, ParameterDirection.Output) };
    XmlReader xRdr = oraclehelper.ExecuteXmlReader(myConnection,CommandType.StoredProcedure,"TEST_TESTPACKAGE.TEST_GETREGIONS_SP",myParameters);
    the oracle helper function is
    public XmlReader ExecuteXmlReader(OracleConnection inConnection,
    CommandType inCommandType,
    string inCommandText,
    params OracleParameter[] inCommandParameters)
    //create a command and prepare it for execution
    OracleCommand cmd = new OracleCommand(inCommandText,inConnection);
    cmd.CommandType = inCommandType;
    if (inCommandParameters != null)
    foreach (OracleParameter op in inCommandParameters)
    cmd.Parameters.Add(op);
    cmd.BindByName = true;
    cmd.XmlCommandType = OracleXmlCommandType.Query;
    cmd.XmlQueryProperties.RootTag = "Result";
    cmd.XmlQueryProperties.RowTag = "Row";
    if (cmd.Connection.State != ConnectionState.Open) cmd.Connection.Open();
    XmlReader retval = null;
    //create the DataAdapter & DataSet
    retval = cmd.ExecuteXmlReader();
    // detach the OracleParameters from the command object, so they can be used again.
    cmd.Parameters.Clear();
    return retval;
    The stored proc is:
    CREATE OR REPLACE package GJUTRAS.test_TestPackage AS
    type sregions is REF CURSOR;
    procedure test_GetRegions_sp
    selectedregions out sregions
    procedure test_GetRegByDescrip_sp
    descript in varchar2,
    selectedregions out sregions
    end test_TestPackage;
    CREATE OR REPLACE package body GJUTRAS.test_TestPackage AS
    procedure test_GetRegions_sp
    selectedregions out sregions
    is
    begin
    open selectedregions for
    select * from ods.region;
    end test_GetRegions_sp;
    procedure test_GetRegByDescrip_sp
    descript in varchar2,
    selectedregions out sregions
    is
    begin
    open selectedregions for
    select * from ods.region where description = descript;
    end test_GetRegByDescrip_sp;
    end test_TestPackage;
    /

    The versions of the function that use text "select * from ods.region" work fine. It's using a stored procedure with ExecuteXmlReader that I can't seem to get working. The table is
    CREATE TABLE REGION (
    ID NUMBER(10) NOT NULL,
    CODE VARCHAR2(100 BYTE),
    ABBREV VARCHAR2(100 BYTE),
    NAME VARCHAR2(500 BYTE),
    EXTRA_FIELDS_ID NUMBER(10) NOT NULL,
    ACTIVE_FLAG VARCHAR2(1 BYTE) NOT NULL,
    DESCRIPTION VARCHAR2(4000 BYTE),
    COMMENTS VARCHAR2(4000 BYTE),
    KEYWORDS VARCHAR2(4000 BYTE),
    CHNG_REASON_TYPE_ID NUMBER(10),
    CHNG_REASON_CMNT VARCHAR2(4000 BYTE),
    BEG_DATE DATE NOT NULL,
    BEG_USER_ID NUMBER(10) NOT NULL,
    CREATOR_ID NUMBER(10) NOT NULL,
    CREATION_DATE DATE NOT NULL )

  • Need help with working in the background while doing a presentation

    Hi guys,
    I wanted to know if my MBP had a way to let me do a presentation, where on my screen I could tell it to present what I wanted it to present rather than showing every single move that I would make. If for instance, I were to open an app for looking up something to present, I wouldn't want people to see that action, but rather the things that I would put on a special window or virtual place created just for that.
    Maybe there's an app that will let me do this? What happens to me know is that when I connect the MBP to the data show presenter, everything I do gets displayed on the big screen on the wall. I want to work in the background without people seeing that. Please help. Thanks.

    The system software makes it about as easy as possible. Press fn+F7 (the pictographic mnemonic on the F7 kety is two overlapping rectangles). This will toggle the display mode between mirroring (same image on internal and external display) and spanning (each display independently contributing to the total viewable area).
    As a bonus when using Keynote (the presentation software from iWork) in a dual-screen configuration, you get one display showing the presentation and the other showing you context (the upcoming slide) and a timer. Check out the demo included with you MacBook.
    Randall Schulz

  • Need help with ORA-00936: missing expression

    11.2.0.3
    desc killsessionlog
    Name                                                  Null?    Type
    KILLTIME                                              NOT NULL DATE
    USERNAME                                              NOT NULL VARCHAR2(30)
    SID                                                   NOT NULL NUMBER
    SERIAL#                                               NOT NULL NUMBER
    CTIME                                                 NOT NULL NUMBER
    MACHINE                                                        VARCHAR2(64)
    TERMINAL                                                       VARCHAR2(30)
    PROGRAM                                                        VARCHAR2(48)
    ACTION                                                         VARCHAR2(64)
    MODULE                                                         VARCHAR2(64)want to test the code to kill the blocker
    SQL> create or replace procedure killblocker
      2  is
      3  stmt varchar2(1000);
      4  cursor c1 is
      5  select  s1.SQL_EXEC_START+l1.ctime killtime, s1.username,s1.sid,s1.serial#,l1.ctime ,s1.machine
    ,s1.TERMINAL, s1.PROGRAM,s1.ACTION,s1.MODULE
      6      from v$lock l1, v$session s1, v$lock l2, v$session s2
      7      where s1.sid=l1.sid and s2.sid=l2.sid
      8      and l1.BLOCK=1 and l2.request > 0
      9      and l1.id1 = l2.id1
    10      and l2.id2 = l2.id2
    11      and l1.ctime >0;
    12  begin
    13  for i in c1 loop
    14  EXECUTE IMMEDIATE 'ALTER SYSTEM KILL SESSION ''' || i.sid || ',' || i.serial# || '''';
    15  stmt := 'insert into killsessionlog values ('||i.killtime||','|| i.username||','||i.sid||','||i
    .serial#||','||i.ctime||','||i.machine||','||i.TERMINAL||','|| i.PROGRAM||','||i.ACTION||','||i.MODU
    LE||')'
    16  ;
    17  EXECUTE IMMEDIATE stmt;
    18  dbms_output.put_line('SID '||i.sid ||' with serial# '||i.serial#||' was killed');
    19    END LOOP;
    20  END;
    21  /
    Procedure created.created the blocker and blocked sessions.
    SQL> exec killblocker
    BEGIN killblocker; END;
    ERROR at line 1:
    ORA-00936: missing expression
    ORA-06512: at "NN.KILLBLOCKER", line 17
    ORA-06512: at line 1the first EXECUTE IMMEDIATE for killing the session worked, but the 2nd EXECUTE IMMEDIATE for the insert failed as above. Not able to figure the problem.
    TIA

    SQL> create or replace procedure killblocker
      2  is
      3  stmt varchar2(1000);
      4  cursor c1 is
      5  select  s1.SQL_EXEC_START+l1.ctime killtime, s1.username,s1.sid,s1.serial#,l1.ctime ,s1.machine
    ,s1.TERMINAL, s1.PROGRAM,s1.ACTION,s1.MODULE
      6      from v$lock l1, v$session s1, v$lock l2, v$session s2
      7      where s1.sid=l1.sid and s2.sid=l2.sid
      8      and l1.BLOCK=1 and l2.request > 0
      9      and l1.id1 = l2.id1
    10      and l2.id2 = l2.id2
    11      and l1.ctime >0;
    12  begin
    13  for i in c1 loop
    14  EXECUTE IMMEDIATE 'ALTER SYSTEM KILL SESSION ''' || i.sid || ',' || i.serial# || '''';
    15  stmt := 'insert into killsessionlog values (:killtime, :username, :sid, :serial#, :ctime, :machine, :TERMINAL, :PROGRAM, :ACTION, :MODULE)'
    16  ;
    17  EXECUTE IMMEDIATE stmt using i.killtime, i.username, i.sid, i.serial#, i.ctime, i.machine, i.TERMINAL, i.PROGRAM, i.ACTION, i.MODULE;
    18  dbms_output.put_line('SID '||i.sid ||' with serial# '||i.serial#||' was killed');
    19    END LOOP;
    20  END;
    21  / Gerard

  • I need help with ORA-07445

    Hi all!
    I was executing every day one workflow which contains some mappings. This worked fine but one day it started crashing. The error I get is:
    ERROR ORA-03113: end-of-file on communication channel
    We traced the session and we saw that it also produced this error:
    ORA-07445: exception encountered: core dump [slmecpy()+96] [SIGSEGV] [Address not mapped to object] [0x000000000] [] []
    Does anyone know what can be happening??
    Thanks in advance
    Edited by: Julius84 on 18-may-2010 3:55

    Thanks, but I had tried doing it. I had regenerated the mapping and it doesn´t work.
    I have read in internet that it's a bug, but i don't understand: i haven't changed anything.
    Thanks again

  • Need help with ora-hash function

    I am doing a insert operation..in the actual view i came up with this expression ORA_HASH(c.cpt_code_grp_dscrptn
    ||c.cpt_code_grp_id) AS bwrse_link_idntfr
    i was given to insert browse_link_idntfr value as 2910441270
    how to proceed with the insertion in the actual table for those two columns?

    964145 wrote:
    I am doing a insert operation..in the actual view i came up with this expression ORA_HASH(c.cpt_code_grp_dscrptn
    ||c.cpt_code_grp_id) AS bwrse_link_idntfr
    i was given to insert browse_link_idntfr value as 2910441270
    how to proceed with the insertion in the actual table for those two columns?HUH?
    How do I ask a question on the forums?
    SQL and PL/SQL FAQ

Maybe you are looking for