ORA-00932 on 11g + sdo_anyinteract + GROUP BY

select pco.pointclass_id, count(pco.rid) anzahl
from pointcloud_output pco ,pointcloud_blk_25833 blk where 1=1
and blk.blk_id = pco.ptn_id and blk.obj_id = (SELECT pc.pc.pc_id
FROM pointcloud_25833 pc WHERE prin_id = 1)
and
MDSYS.SDO_RELATE
blk.blk_extent
mdp_utils.get_polygon(
'602397.7,5343239.79,
602389.62,5343264.06,
602416.09,5343265.53,
602421.23,5343239.79,
602397.7,5343239.79'
,25833)
,'MASK=ANYINTERACT'
) = 'TRUE'
group by pco.pointclass_id
throws this:
ORA-00932: inconsistent datatypes: expected - got MDSYS.SDO_ELEM_INFO_ARRAY
On removing the "GROUP BY", the query works., 11gr1
using SDO_ANYINTERACT, SDO_FILTER doesnt solve the problem
Similar problem like in:
Re: ORA-00932 Error using 11g and the SDO_RELATE function. Works fine in 10g
I made a new thread since I didnt want to hijack the old one.

Please let us know the explain plan for your query.

Similar Messages

  • ORA-00932: inconsistent datatypes: expected - got - In 11g, WORKS in 9i!

    Hello,
    Involved in migration of a 9i database to 11g, R2. One of our procedures works in 9i but in 11g gives us "ORA-00932: inconsistent datatypes: expected - got - "
    We tracked down the error in a statement where oracle does a fetch into a sys_refcursor. The fetch happens on a dynamically constructed select statement ( built by varchar concatenation).
    The select statement selects 3 fields, but the fetch into passes 2 variables to the fetch statement. This causes ORA-00932 in 11g R2, but works in 9i.
    Below is a modified procedure we built to demonstrate the problem. if you compile and test, you will see that the procedure runs in 9i but not 11g.
    create or replace procedure testORA00932 is
    v_now date;
    v_fsqltext varchar2(2000);
    v_curs sys_refcursor;
    begin
    v_fsqltext := 'select sysdate, sysdate+1 from dual'; -- select 2 fields
    open v_curs for v_fsqltext;
    loop
    fetch v_curs into v_now; -- fetch 1 field, this statement fails in 11g (ORA-00932), works in 9i
    dbms_output.put_line(v_now);
    exit when v_curs%notfound;
    end loop;
    close v_curs;
    end;
    Is there a compatibility flag we can turn on to resove this problem?
    Edited by: chrisl08 on Mar 29, 2012 11:11 PM

    After researching this a little more, this is a know bug to oracle: Bug 4381035
    According to Oracle, the only available workaround is to provide the same number of define variables as columns in the SELECT statement.

  • ORA-00932 Error using 11g and the SDO_RELATE function. Works fine in 10g

    Hello,
    If I run this query in Oracle 11g:
    SELECT M.FID, MAX(M.VERSION) AS VERSION
    FROM SW_PB.A_ROADNODEINFORMATION M, SW_PB.ROADNODE N
    WHERE M.REFERENCETOROADNODE = N.FID
    AND M.NODEVERSION = N.VERSION
    AND M.CATALOGUEID <= 477
    AND MDSYS.SDO_RELATE( N.GEOM, MDSYS.SDO_GEOMETRY(2003,81989,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),MDSYS.SDO_ORDINATE_ARRAY(120000,0,160000,40000)),'MASK=ANYINTERACT QUERYTYPE=WINDOW') = 'TRUE'
    GROUP BY M.FID;
    I get an error regarding the N.GEOM field. The error is as follows:
    ORA-00932: inconsistent datatypes: expected - got MDSYS.SDO_ELEM_INFO_ARRAY
    The same query runs fine on a 10g database with the same data. I've even truncated the N table and still get the error. I've rebuilt the index but it makes no difference and the metadata is exactly the same for this table as it is for other tables that are involved in a similar query.
    It looks like a bug to me but just wondered if anyone else had come across this?
    Thanks,
    Peter.

    Thanks for the reply. I'm really sorry but I haven't created trace files like this for a very long time and have forgotten the best way to read them. This is the start of the trace file, any help with reformatting it would be greatly appreciated.
    Thanks,
    Peter.
    *** 2009-04-23 17:09:22.902
    ----- Error Stack Dump -----
    *** 2009-04-23 17:09:22.917
    ORA-00932: inconsistent datatypes: expected - got MDSYS.SDO_ELEM_INFO_ARRAY
    ----- Current SQL Statement for this session (sql_id=br02jqdwy2utk) -----
    SELECT M.FID, MAX(M.VERSION) AS VERSION
    FROM SW_PB.A_ROADNODEINFORMATION M, SW_PB.ROADNODE N
    WHERE M.REFERENCETOROADNODE = N.FID
    AND M.NODEVERSION = N.VERSION
    AND M.CATALOGUEID <= 477
    AND MDSYS.SDO_RELATE( N.GEOM, MDSYS.SDO_GEOMETRY(2003,81989,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),MDSYS.SDO_ORDINATE_ARRAY(120000,0,160000,40000)),'MASK=ANYINTERACT QUERYTYPE=WINDOW') = 'TRUE'
    GROUP BY M.FID
    ----- Call Stack Trace -----
    calling call entry argument values in hex
    location type point (? means dubious value)
    skdstdst()+114      CALLrel  kgdsdst()+0 FB783A0 2
    ksedst1()+91        CALLrel  skdstdst()+0
    ksedst()+50         CALLrel  ksedst1()+0 0 1
    dbkedDefDump()+298  CALLrel  ksedst()+0 0
    5
    ksedmp()+40         CALLrel  dbkedDefDump()+0 3 0
    _dbkdaKsdActDriver(  CALLreg  00000000             3
    )+841
    _dbgdaExecuteAction  CALLreg  00000000             7B50420 FB79A4C
    ()+63
    dbgdaRunAction()+3  CALLrel  dbgdaExecuteAction 7B50420 4D4C148 20C0002
    02 ()+0 FB79A4C
    dbgdRunActions()+4  CALLrel  dbgdaRunAction()+0 7B50420 A789E54
    4
    dbgdProcessEventAc  CALLrel  dbgdRunActions()+0 7B50420 A789E74
    tions()+446
    __VInfreq__dbgdChkE CALLrel _dbgdProcessEventAc  7B50420 120A3370 A789F64
    ventKgErr()+237 tions()+0
    dbkdChkEventRdbmsE  CALLrel  dbgdChkEventKgErr( 7B50420 A7C06F4 3A4
    rr()+33 )+0
    __PGOSF99__ksfpec() CALLrel _dbkdChkEventRdbmsE  3A4
    +110 rr()+0
    _dbgePostErrorKGE()  CALLreg  00000000             120A3370 3A4
    +1601
    dbkePostKGEkgsf() CALLrel _dbgePostErrorKGE()  120A3370 A772020 3A4
    +49 +0
    _kgeade()+268        CALLreg  00000000             120A3370 A772020 3A4
    kgesev()+54         CALLrel  kgeade()+0
    kgesec2()+18        CALLrel  kgesev()+0 120A3370 A772020 3A4 2
    FB7A200
    qctErr932()+217     CALLrel  kgesec2()+0 120A3370 A772020 3A4 1 1
    FB7A468 1 19 FB7A218
    qctErrConvertDataT  CALLrel  qctErr932()+0 995FBCC0 120A3370 F6 FB7A468
    ype()+82 7B C2E85B4 995FBCC0 120A3370
    FB7A468 0 0 FB7A468 0 204
    qecgby()+240        CALLrel  qctErrConvertDataT 995FBCC0 120A3370 F6 0 0 7B
    ype()+0 C2E85B4
    qecpqbcheck()+75    CALLrel  qecgby()+0
    qecdrv()+161        CALLrel  qecpqbcheck()+0 C2ECD7C 0 0 0
    qecdrv()+74         CALLrel  qecdrv()+0
    kkqcttcalo()+383    CALLrel  qecdrv()+0 C2EFBAC
    kkqctdrvGBP()+1841  CALLrel  kkqcttcalo()+0 C2EFBAC 0 C2EFBAC 166A5D4 0 2
    __VInfreq__kkqgbpTr CALLrel _kkqctdrvGBP()+0     A730DD8
    avChkTran()+193
    _qksqbApplyToQbcLoc  CALLreg  00000000             A730DD8 FB7A9BC
    ()+536
    qksqbApplyToQbc()+  CALLrel  qksqbApplyToQbcLoc
    67 ()+0
    kkqctdrvTD()+1000   CALLrel  qksqbApplyToQbc()+ A730DD8 2EF2DA0 FB7A9BC 0
    0
    kkqgbpdrv()+88      CALLrel  kkqctdrvTD()+0 A754820 995FBDF4 6
    kkqdrv()+1520       CALLrel  kkqgbpdrv()+0 A754820 995FBDF4
    kkqctdrvIT()+698    CALLrel  kkqdrv()+0 A754820 0
    apadrv()+1205       CALLrel  kkqctdrvIT()+0 A754820 995FBDF4
    opitca()+1841       CALLrel  apadrv()+0 995FBDF4
    __PGOSF435__kksFull CALLrel _opitca()+0          A7CC9E4 995FBDF4
    TypeCheck()+15
    _rpiswu2()+560       CALLreg  00000000             FB7B718
    kksLoadChild()+860  CALLrel  rpiswu2()+0 AF495220 5 A77DCBB4 16
    8 94591E54 5 A77DCBE0 0 FB7B670
    615F44 0 FB7B718 0
    kxsGetRuntimeLock(  CALLrel  kksLoadChild()+0 120A3370 AE9130D8 FB7C090
    )+1421
    kksfbc()+8954       CALLrel  kxsGetRuntimeLock( 120A3370 A7CC9E4 FB7C090 3 1
    )+0
    kkspsc0()+1882      CALLrel  kksfbc()+0 A7CC9E4 3 108 FB7D2D8 1BB 0 0
    0
    kksParseCursor()+1  CALLrel  kkspsc0()+0
    43
    opiosq0()+2028      CALLrel  kksParseCursor()+0 FB7C610
    kpooprx()+273       CALLrel  opiosq0()+0 3 E FB7C734 A4
    kpoal8()+729        CALLrel  kpooprx()+0 FB7F214 FB7D2D8 1BA 1 0 A4
    _opiodr()+1224       CALLreg  00000000             5E 1C FB7F210
    _ttcpip()+2733       CALLreg  00000000             5E 1C FB7F210 0
    _opitsk()+1278       CALL???  00000000            
    opiino()+1067       CALLrel  opitsk()+0 0 0
    _opiodr()+1224       CALLreg  00000000             3C 4 FB7FC28
    opidrv()+807        CALLrel  opiodr()+0 3C 4 FB7FC28 0
    sou2o()+45          CALLrel  opidrv()+0 3C 4 FB7FC28
    opimaireal()+130 CALLrel _sou2o()+0           FB7FC1C 3C 4 FB7FC28
    opimai()+92         CALLrel  opimai_real()+0 2 FB7FC54
    OracleThreadStart@  CALLrel  opimai()+0
    4()+764
    77E6482C CALLreg 00000000
    00000000 CALL??? 00000000

  • ORA-00932: inconsistent datatypes: expected DATE got NUMBER at OCI call OCIStmtExecute in OBIEE 11g

    Hi Friends,
    I am getting this error : ORA-00932: inconsistent datatypes: expected DATE got NUMBER at OCI call OCIStmtExecute when I am trying to put the filter condition on the date column.
    "Dim-Time"."Day" <= cast(MAX("Dim-Time"."Day") as date)  and "Dim-Time"."Day" >= TIMESTAMPADD(SQL_TSI_MONTH, -1,cast(MAX("Dim-Time"."Day") as date).
    I have casted the max date but though I am getting the above error. I am thinking max(date) is creating the problem.
    Please suggest your on opinion this.
    Thanks.

    Not sure why you need cast in your statement if at all it is required then you need to do as below
    cast("Dim-Time"."Day"  as date)<= cast(MAX("Dim-Time"."Day") as date)  and cast("Dim-Time"."Day"  as date) >= TIMESTAMPADD(SQL_TSI_MONTH, -1,cast(MAX("Dim-Time"."Day") as date).
    ~ http://cool-bi.com

  • PL/SQL: ORA-00932: inconsistent datatypes: expected REF got CHAR

    SQL> desc o.rel_module;
    Name Null? Type
    ID NOT NULL NUMBER(6)
    TYPE NOT NULL CHAR(7)
    BUILDDATE NOT NULL NUMBER(4)
    DESIGNROOT NOT NULL NUMBER(6)
    SQL> desc rel_module
    Name Null? Type
    ID NOT NULL NUMBER(6)
    DESIGNROOT NOT NULL NUMBER(6)
    REL_COMPOSITEPARTS REL_COMPOSITEPART_TAB
    SQL> desc REL_COMPOSITEPART_TAB
    REL_COMPOSITEPART_TAB TABLE OF REL_COMPOSITEPART
    SQL> desc REL_COMPOSITEPART
    Name Null? Type
    TYPE CHAR(7)
    BUILDDATE NUMBER(4)
    SQL> create or replace procedure rel_module_p
    2 as
    3 cursor c is select ID, TYPE, BUILDDATE, DESIGNROOT from o.rel_module;
    4 begin
    5 FOR i in c
    6 LOOP
    7 INSERT into rel_module(id,REL_CompositeParts,DESIGNROOT)
    Values (i.ID,REL_CompositePart_TAB(i.type,i.builddate), i.designroot);
    8 END LOOP;
    9 END;
    10 /
    Warning: Procedure created with compilation errors.
    SQL> show err
    Errors for PROCEDURE REL_MODULE_P:
    LINE/COL ERROR
    7/1 PL/SQL: SQL Statement ignored
    7/93 PL/SQL: ORA-00932: inconsistent datatypes: expected REF got CHAR
    Can you please tell me where needs correction.

    801556 wrote:
    Can you please tell me where needs correction.Just a fix would be:
    create or replace procedure rel_module_p
    as
    cursor c is select ID, TYPE, BUILDDATE, DESIGNROOT from o.rel_module;
    begin
    FOR i in c
    LOOP
    INSERT into rel_module(id,REL_CompositeParts,DESIGNROOT)
    values (i.ID,REL_CompositePart_TAB(REL_COMPOSITEPART(i.type,i.builddate)), i.designroot);
    END LOOP;
    END;
    /However, I'd assume what you want is:
    create or replace procedure rel_module_p
    as
    cursor c is select ID,CAST(COLLECT(REL_COMPOSITEPART(TYPE,BUILDDATE)) AS REL_CompositePart_TAB) REL_COMPOSITEPARTS, DESIGNROOT
    from rel_module
    group by id,DESIGNROOT;
    begin
    FOR i in c
    LOOP
    INSERT into rel_moduleX(id,REL_CompositeParts,DESIGNROOT)
    values (i.ID,i.REL_COMPOSITEPARTS, i.designroot);
    END LOOP;
    END;
    /SY.

  • Binding dynamic variable in XQuery doesn't work: ORA-00932

    I have a table with several columns. One of those columns is a XMLType.
    My goal is to have a query which selects rows from the table of which the XML column matches certain criteria.
    I'm trying following example (JDBC) : http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28369/xdb_xquery.htm#insertedID11
    First, I created my own query, which looks like:
    select * from MyTable t, XMLTABLE( xmlnamespaces (DEFAULT 'http://test), 'for $i in /RootElement where $i/SubElement[contains(Element, "someValue")] return "true"' passing t.xmlColumn)This works as expected. Next, as done in the example, I'm trying to replace the "someValue" with a dynamic variable.
    Query then looks like:
    select * from MyTable t, XMLTABLE( xmlnamespaces (DEFAULT 'http://test), 'for $i in /RootElement where $i/SubElement[contains(Element, $val)] return "true"' passing t.xmlColumn, :1 as "val")This does not seem to work, neither in SQLDeveloper nor in java.
    I always get the :
    java.sql.SQLException: ORA-00932: inconsistent datatypes: expected - got CHAR(SQLDeveloper just gives ORA-00932)
    When I put $val between quotes (so "$val") then I get no error, but then I get no results either.
    I think it will not replace $val in that case but just use it as a literal, so thats not what I want
    I also tried to remove "contains" xpath and use the exact same example as on the oracle page
    select * from MyTable t, XMLTABLE( xmlnamespaces (DEFAULT 'http://test), 'for $i in /RootElement where $i/SubElement/Key = $val return "true"' passing t.xmlColumn, :1 as "val")But this doens't help either.
    I'm clueless about this, so any help would be appreciated
    Edited by: user5893566 on Nov 29, 2008 6:24 AM

    Ok, I tested it using the latest enterprise edition (11g) and there it works as expected.
    However, on 10.2.0.1.0 and 10.2.0.3.0 it gives this error.
    Is this a bug which has been fixed or should I do something special on 10g ?
    I installed all of these as normal without any special settings, created the tables and ran the query...

  • ORA-00932 and CMP 2.0

    Hi,
         I'm using Weblogic 7.0 sp2 with Oracle 8.1.7 and Oci driver, but this also happens
    to thin driver.
         When using a CMP 2.0 to update a table with 6 DATE fields, when we try to update
    one of those columns with null,
         it crashes:
    java.sql.SQLException: ORA-00932: tipos de dato inconsistentes
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
         at oracle.jdbc.oci8.OCIDBAccess.check_error(OCIDBAccess.java:1597)
         at oracle.jdbc.oci8.OCIDBAccess.executeFetch(OCIDBAccess.java:1209)
         at oracle.jdbc.oci8.OCIDBAccess.parseExecuteFetch(OCIDBAccess.java:1321)
         at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1446)
         at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1371)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1900)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:363)
         at weblogic.jdbc.jts.Statement.executeUpdate(Statement.java:509)
         at weblogic.jdbc.rmi.internal.PreparedStatementImpl.executeUpdate(PreparedStatementImpl.java:82)
         at weblogic.jdbc.rmi.SerialPreparedStatement.executeUpdate(SerialPreparedStatement.java:58)
         It only happens with one column. With all the rest, it works fine. We use java.sql.Date
    for they all.
         Why????????? All the columns are equal, of course, of course they aren't NOT
    NULL, and we have checked all
         the CMP and it's alright. We have even recreated it several times.
         With CMPs containing similar DATE fields but only containing 2 or 3, it always
    works fine.
         If using SQL directly, it works fine. The problem is only using the CMP 2.0.
    We have not tried with CMP 1.1.
         Any idea?

    Hi,
         We have already solved the problem, but we think there is some kind of bug in
    Weblogic.
         The problem is when we use MetaData as validate-db-schema-with option for our
    CMPs. Using this, we suppose there's some kind of problem when mapping CMP with
    DB. If we use TableQuery which performs a select when EJBs are deployed, it      works
    fine, and we can insert null in the field we couldn't before. WHY?? We don't know,
    but at least now it works.
         I've attached the table script only, as we don't think it has anything to do
    with CMP but the group. The problem is with FCHALTA_ITS column. If you need further
    information or code, please let me know. If there's any bug or it has already
    been      solved in Weblogic 8.1, please inform us.
    Thank you very much
    "Slava Imeshev" <[email protected]> wrote:
    Hi Ignacio,
    Could you post the table DDL, the full stack trace ant the code of
    the
    bean?
    Regards,
    Slava Imeshev
    "Ignacio Sanchez" <[email protected]> wrote in message
    news:[email protected]...
    Hi,
    I'm using Weblogic 7.0 sp2 with Oracle 8.1.7 and Oci driver, but thisalso
    happens
    to thin driver.
    When using a CMP 2.0 to update a table with 6 DATE fields, when wetry to
    update
    one of those columns with null,
    it crashes:
    java.sql.SQLException: ORA-00932: tipos de dato inconsistentes
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
    at oracle.jdbc.oci8.OCIDBAccess.check_error(OCIDBAccess.java:1597)
    at oracle.jdbc.oci8.OCIDBAccess.executeFetch(OCIDBAccess.java:1209)
    at oracle.jdbc.oci8.OCIDBAccess.parseExecuteFetch(OCIDBAccess.java:1321)
    atoracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1446
    atoracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1371)
    atoracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java
    :1900)
    atoracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedState
    ment.java:363)
    at weblogic.jdbc.jts.Statement.executeUpdate(Statement.java:509)
    atweblogic.jdbc.rmi.internal.PreparedStatementImpl.executeUpdate(PreparedState
    mentImpl.java:82)
    atweblogic.jdbc.rmi.SerialPreparedStatement.executeUpdate(SerialPreparedStatem
    ent.java:58)
    It only happens with one column. With all the rest, it works fine.We use
    java.sql.Date
    for they all.
    Why????????? All the columns are equal, of course, of course they aren'tNOT
    NULL, and we have checked all
    the CMP and it's alright. We have even recreated it several times.
    With CMPs containing similar DATE fields but only containing 2 or 3,it
    always
    works fine.
    If using SQL directly, it works fine. The problem is only using theCMP
    2.0.
    We have not tried with CMP 1.1.
    Any idea?
    [table.sql]

  • ORA-00932 error: limitations for SDO_UTIL.FROM_WKTGEOMETRY and SDO_GEOMETRY

    Hi all,
    In my project, I use C# .net and Oracle 11g. I use ADO.NET OracleClob object in my C# code which will be passed to a procedure (procedure defined in a package) where I convert the input clob/wkt geometry into SDO_GEOMETRY using SDO_UTIL.FROM_WKTGEOMETRY and subsequently the GEOMETRY can be pushed into a table as shown below.
    PROCEDURE insert_extent(p_key_id IN NUMBER, p_extent IN CLOB) AS
    m_geom SDO_GEOMETRY;
    BEGIN
    m_geom := SDO_UTIL.FROM_WKTGEOMETRY(p_extent);
    UPDATE TEMP SET GEOM = m_geom
    WHERE IDS = p_key_id;
    COMMIT;
    END insert_extent;
    The above code is working fine for small size clob inputs, but, I have encountered ORA-00932 error when my clob/wkt geometry was more than 30MB in size.
    Can any one tell me what is the limitation of size of the clob to convert the CLOB to SDO_GEOMETRY and is there any limitaion on SDO_GEOMETRY datatype object to write the geometry into a table as well via insert/update statement.
    Also share your thoughts on how to resolve the issue.
    Please let me know if further information is required and thanks for the help in advance.
    Regards,
    Kumar

    MDSYS.SDO_ORDINATE_ARRAY in sdo_geometry can hold 1048576 numbers:
    desc MDSYS.SDO_ORDINATE_ARRAY
    MDSYS.SDO_ORDINATE_ARRAY VARRAY(1048576) OF NUMBER

  • ORA-00932: inconsistent datatypes: expected - got SCOTT.TEST_T

    I am trying to copy the data from one tabel t Other table. Both are located in diffrent schemas.
    while doing so, i am getting the below error.
    CONN SCOTT/TIGER
    CREATE OR REPLACE TYPE  TEST_T AS TABLE OF VARCHAR2(20);
    CREATE TABLE TEST_TAB
    (ID NUMBER,
    NAME TEST_T,
    LOCATION VARCHAR2(100)
    GRANT SELECT ON TEST_TAB TO LOCALUSR;
    GRANT EXECUTE ON TEST_T TO LOCALUSR;
    CONN LOCALUSR/LOCALUSR
    CREATE OR REPLACE TYPE  TEST_T AS TABLE OF VARCHAR2(20);
    CREATE TABLE TEST_TAB
    (ID NUMBER,
    NAME TEST_T,
    LOCATION VARCHAR2(100)
    INSERT INTO TEST_TAB
    SELECT * FROM SCOTT.TEST_TAB;
    ORA-00932: inconsistent datatypes: expected - got SCOTT.TEST_T Pls suggest.
    Raj
    Edited by: KrChowdary on Jun 11, 2009 12:52 PM

    You have two different objects (one for localuser and one for scott) which you might think are identical but they are not. Basically it is the same as
    SQL> create or replace type test_t as table of varchar2 (20)
    Type created.
    SQL> create table test_tab (id      number, name    test_t, location varchar2 (100))
    nested table name store as nested_tab
       return as value
    Table created.
    SQL> create or replace type test2_t as table of varchar2 (20)
    Type created.
    SQL> create table test2_tab (id      number, name    test2_t, location varchar2 (100))
    nested table name store as nested2_tab
       return as value
    Table created.
    SQL> insert into test_tab
      values   (1, test_t (1, 2, 3), 'some location')
    1 row created.
    SQL> insert into test2_tab
         select   * from test_tab
    insert into test2_tab
         select   * from test_tab
    Error at line 21
    ORA-00932: inconsistent datatypes: expected - got MICHAEL.TEST_T
    SQL> insert into test2_tab
         select   id, cast(name as test2_t), location from test_tab
    1 row created.As shown, the insert succeeds (at least on 11g) when casting the type to the table's type.
    In your case I'd try
    insert into test_tab select id, cast(name as localuser.test_t) location from scott.test_tab

  • Oracle/PLSQL: ORA-00932 ErrorError: ORA-00932: inconsistent datatypes

    I am getting this error in a PL/SQL package, using SQL using the NVL function.
    Oracle/PLSQL: ORA-00932 ErrorError: ORA-00932: inconsistent datatypes. Cause: You tried to perform an operation between two different datatypes, but the datatypes are not compatible.
    I do not get this error on a 10.2.0.4 instance of the database running in Windows.
    Anyone come accross this type of issue in 11g Rel.2 or after migrating from 10g to 11g??
    Thanks.

    Dear user520935,
    What are the contents of the package? Where do you exactly get that error?
    http://ora-00932.ora-code.com/
    Have you checked the metalink about it? There are lots of articles about it.
    Ogan

  • ORA-00932: inconsistent datatypes: expected NUMBER got REF db.emp_person_ty

    hello,
    from the forum general questions invited me to enter this thread.
    Re: ORA-00932: inconsistent datatypes: expected NUMBER got REF db.emp_person_ty
    Can you help me?

    here's all the transactions after downloading oracle:
    -start application start database;
    -started get started with oracle database application 11g express edition;
    -selected application express menu;
    -'re logged in with the credentials defined sys + password to the installation;
    created a workspace with:
    - Username: db;
    - Application username: dbase;
    - Added password;
    - Open the workspace I went on sql workshop;
    - Then I clicked on sql commands;
    - And I put the following commands:
    - CREATE TYPE emp_person_typ AS OBJECT (
    name VARCHAR2(30),
    manager REF emp_person_typ );
    -CREATE TABLE emp_person_obj_table OF emp_person_typ;
    -INSERT INTO emp_person_obj_table VALUES (
    emp_person_typ ('John Smith', NULL));
    -SELECT *
    FROM emp_person_obj_table;
    -at this point I will get the following errors:
    ORA-00932: inconsistent datatypes: expected NUMBER got REF db.emp_person_typ
    I only do these operations I did! I did not change anything but these problems presented to me.
    I also tried on two different machines but nothing changes. help me!!!

  • ORA-00932

    Hi,
    I have query as under:
    SELECT DISTINCT D.region_id regionName,
                    D1.CNAME allCountryState
      FROM SOP_REGION_FUNCTION_MAP D
              SELECT e1.region_id,
                     concatenate_list(CURSOR(SELECT e2.country_name ||', ' || e2.state_name FROM sop_region_country_map e2 )) CNAME
              FROM   sop_region_country_map e1
              GROUP BY e1.region_id
           ) D1
    WHERE D1.REGION_ID(+) = D.REGION_ID
    ORDER BY D1.CNAMEthe function concatenate_list() is as under:
    CREATE OR REPLACE FUNCTION concatenate_list (p_cursor IN  SYS_REFCURSOR)
      RETURN  CLOB
    IS
      l_return  VARCHAR2(32767);
      l_temp    VARCHAR2(32767);
    BEGIN
      LOOP
        FETCH p_cursor
        INTO  l_temp;
        EXIT WHEN p_cursor%NOTFOUND;
        l_return := l_return || ',' || l_temp;
      END LOOP;
      RETURN LTRIM(l_return, ',');
    END;When i am executing it i am getting error:
    "ORA-00932: inconsistent datatype: expected char- got CLOB"
    can anybody let me know the solution?
    Thx

    Hi Justin,
    I modified the function as under:
    CREATE OR REPLACE FUNCTION concatenate_list (p_cursor IN  SYS_REFCURSOR)
       RETURN  CLOB IS l_return CLOB;
    --  l_return  VARCHAR2(32767);
      l_temp    VARCHAR2(32767);
    BEGIN
      LOOP
        FETCH p_cursor
        INTO  l_temp;
        EXIT WHEN p_cursor%NOTFOUND;
        l_return := l_return || ',' || l_temp;
      END LOOP;
      RETURN LTRIM(l_return, ',');
    END;Still i am getting the same error in the query...
    when I comment D1.CNAME allCountryState in the select list of column it runs fine...The below query is giving result but as i have commented country/state in select column list it does not show them in result:
    SELECT DISTINCT D.region_id regionName,               
              --D1.CNAME allCountryState
    FROM SOP_REGION_FUNCTION_MAP D,
    (SELECT e1.region_id,                
         concatenate_list(CURSOR(SELECT e2.country_name ||', ' || e2.state_name FROM sop_region_country_map e2 )) CNAME               FROM   sop_region_country_map e1         
         GROUP BY e1.region_id) D1
    WHERE D1.REGION_ID(+) = D.REGION_ID 
    ORDER BY D1.CNAMEIf would be gr8 help if a solution is provided.. I even tried to use TO_CLOB() but same error..
    thx for help btw

  • Get ORA-00932 inconsistent datatype when passing parameter in tableadapter

    I have to build a Dataset to use as source for Microsoft rdlc-Report.
    In the Dataset I create a tableadapter using plain SQL.
    In my SELECT-Command I have to pass a Date parameter:
    I've tested a SELECT like in the following example:
    SELECT a.field1, a.field2, field3
    FROM table a 
    WHERE a.createdate < :IN_DATE In the tableadapter query-builder I get data, but after storing the command I get following error-message:
    ORA-00932 inconsistent datatypes expected date got number
    Later I have to pass the Date parameter in a Function like
    SELECT a.field1, a.field2, getvalue(a.field3,:IN_DATE) FROM table aIm using ODP.NET 11g on a 10g Oracle DB server.
    Is there a possibility to pass a Date parameter?
    I hope anyone has a tipp...
    Roswitha

    Check the OracleParameter here: http://www.oracle.com/technology/pub/articles/mastering_dotnet_oracle/cook_masteringdotnet.html
    Ming Man

  • ORA-00932: 数据类型不一致: 应为 NUMBER, 但却获得 AAA.TYPESTT

    Schema为AAA
    执行的SQL语句为
    SELECT ID,STT,grouping(ID),grouping(STT)
    FROM TABLE (CORP('sys1','code1'))
    group by grouping sets((ID),(STT));
    错误信息为
    ORA-00932: 数据类型不一致: 应为 NUMBER, 但却获得 AAA.TYPESTT
    自定义类型为
    CREATE OR REPLACE TYPE "AAA"."TYPESTT"
    AS OBJECT( ID VARCHAR2 (30),
    STT VARCHAR (10))
    CREATE OR REPLACE TYPE "AAA"."CORPSTT" AS TABLE OF TYPESTT
    CORP函数的定义如下
    CREATE
    OR
    REPLACE
    FUNCTION "AAA"."CORP"(SYS1 VARCHAR ,
    CODE1 VARCHAR)
    RETURN CORPSTT PIPELINED AS V1 TYPESTT ;
    VCODE VARCHAR(30);
    VSYS VARCHAR(10);
    V_DATE VARCHAR(10);
    BEGIN
    VCODE := CODE1 ;
    VSYS := SYS1 ;
    V_DATE := TO_CHAR(SYSDATE,'YYYY-MM-DD') ;
    FOR MYROW IN
    SELECT
    ID ,
    STT
    FROM
    RLCP
    UNION ALL
    SELECT
    CORPID ,
    CORPROLE
    FROM
    RRCP )
    LOOP
    V1 := TYPESTT(MYROW.ID, MYROW.STT);
    PIPE ROW (V1);
    END LOOP;
    RETURN ;
    END ;
    请教
    帖子经 1002862编辑过

    Schema为AAA
    执行的SQL语句为
    SELECT ID,STT,grouping(ID),grouping(STT)
    FROM TABLE (CORP('sys1','code1'))
    group by grouping sets((ID),(STT));
    错误信息为
    ORA-00932: 数据类型不一致: 应为 NUMBER, 但却获得 AAA.TYPESTT
    自定义类型为
    CREATE OR REPLACE TYPE "AAA"."TYPESTT"
    AS OBJECT( ID VARCHAR2 (30),
    STT VARCHAR (10))
    CREATE OR REPLACE TYPE "AAA"."CORPSTT" AS TABLE OF TYPESTT
    CORP函数的定义如下
    CREATE
    OR
    REPLACE
    FUNCTION "AAA"."CORP"(SYS1 VARCHAR ,
    CODE1 VARCHAR)
    RETURN CORPSTT PIPELINED AS V1 TYPESTT ;
    VCODE VARCHAR(30);
    VSYS VARCHAR(10);
    V_DATE VARCHAR(10);
    BEGIN
    VCODE := CODE1 ;
    VSYS := SYS1 ;
    V_DATE := TO_CHAR(SYSDATE,'YYYY-MM-DD') ;
    FOR MYROW IN
    SELECT
    ID ,
    STT
    FROM
    RLCP
    UNION ALL
    SELECT
    CORPID ,
    CORPROLE
    FROM
    RRCP )
    LOOP
    V1 := TYPESTT(MYROW.ID, MYROW.STT);
    PIPE ROW (V1);
    END LOOP;
    RETURN ;
    END ;
    请教
    帖子经 1002862编辑过

  • ORA-00932 error

    Dear all,
    I am getting the following error when i try to compile a package body.
    The following error has occurred:
    PACKAGE BODY BTPL.STOCK
    On line: 27
    PL/SQL: ORA-00932: inconsistent datatypes: expected NUMBER got -
    Details:
    PACKAGE BODY BTPL.STOCK
    On line: 27
    PL/SQL: ORA-00932: inconsistent datatypes: expected NUMBER got -
    can someone finds me the solution for the issue posted.
    Thanks in Advance.
    Nirmal

    The following is the code
    CREATE OR REPLACE PACKAGE BODY STOCK
    IS
    PROCEDURE POPULATE_OPENING_BALANCE(GivenDate in Varchar2)
    IS
    BEGIN
    delete from STOCK_TEMP_OPEN_BALANCE;
    FOR I IN
    select
         nvl(a.cst_material,b.cst_material) temp_material,
         nvl(a.cst_receiving_vendor,b.cst_receiving_vendor) temp_vendor,
         nvl(cst_quantity,0) temp_opening_balance,
         (nvl(received_qty,0)-nvl(cst_quantity,0)) received_qty,
         nvl(consumed_qty,0) consumed_qty,
         (nvl(received_qty,0)- nvl(consumed_qty,0)) stock_qty,
         a.uom uom
    from
         select
              nvl(r.cst_material,c.cst_material) cst_material,
              nvl(r.cst_receiving_vendor,c.cst_receiving_vendor) cst_receiving_vendor,
              nvl(r.received_qty,0) received_qty,
              nvl(c.consumed_qty,0)consumed_qty,
              r.uom uom
         from
              SELECT
                   lpad(cst_material,18,0) cst_material,
                   cst_receiving_vendor,
                   (SUM (cst_quantity)) received_qty,
                   unit_of_measure uom
              FROM
                   select
                        lpad(cst_material,18,0) cst_material,
                        cst_receiving_vendor,
                        cst_quantity,
                        CST_UNIT_OF_MEASURE unit_of_measure
                   from
                        STOCK_DATA c
                   WHERE
                        (cst_doc_date between to_date('26/11/2006','dd/mm/yyyy') and (to_date(GivenDate,'dd/mm/yyyy')))
                        and ((CST_MOVEMENT_TYPE='101' and CST_SPL_INDICATOR ='O')
                             or CST_MOVEMENT_TYPE='541'
                             or CST_MOVEMENT_TYPE='544'
                             or CST_MOVEMENT_TYPE='545'
                             or (CST_MOVEMENT_TYPE='552' and CST_SPL_INDICATOR ='O'))
                   union all
                        select
                             lpad(temp_material,18,0)
                             cst_material,temp_vendor cst_receiving_vendor,
                             temp_opening_balance cst_quantity,
                             temp_uom unit_of_measure
                        from
                        STOCK_OPEN_BALANCE_261106
              group by cst_material,cst_receiving_vendor,unit_of_measure
         )r
         full outer join
              select
                   lpad(cst_material,18,0) cst_material,
                   cst_receiving_vendor,
                   (SUM (cst_quantity)) consumed_qty,
                   CST_UNIT_OF_MEASURE uom
              from
                   STOCK_DATA
              where
                   (cst_doc_date between to_date('26/11/2006','dd/mm/yyyy')
                   and (to_date(GivenDate,'dd/mm/yyyy')))
                   and (CST_MOVEMENT_TYPE='543'
                        or CST_MOVEMENT_TYPE='542'
                        OR CST_MOVEMENT_TYPE='546'
                        OR (CST_MOVEMENT_TYPE='102' and CST_SPL_INDICATOR ='O')
                        or (CST_MOVEMENT_TYPE='551' and CST_SPL_INDICATOR ='O'))
                   GROUP BY cst_material,cst_receiving_vendor,CST_UNIT_OF_MEASURE
         )c
         on
         r.cst_receiving_vendor=c.cst_receiving_vendor
         and r.cst_material=c.cst_material
    )a
    full outer join
         select
              lpad(temp_material,18,0) cst_material,
              temp_vendor cst_receiving_vendor,
              temp_opening_balance cst_quantity
         from
              STOCK_OPEN_BALANCE_261106
    ) b
    on
    a.cst_material = b.cst_material and
    a.cst_receiving_vendor=b.cst_receiving_vendor
    LOOP
    INSERT INTO STOCK_TEMP_OPEN_BALANCE (TEMP_MATERIAL, TEMP_VENDOR,TEMP_OPENING_BALANCE, TEMP_RECEIVED_QTY, TEMP_CONSUMED_QTY, TEMP_STOCK_QTY,TEMP_UOM
    VALUES
    (I.TEMP_MATERIAL,I.TEMP_VENDOR,I.TEMP_OPENING_BALANCE,I.RECEIVED_QTY,I.CONSUMED_QTY,I.STOCK_QTY,I.UOM
    END LOOP;
    END POPULATE_OPENING_BALANCE;
    ------------------ END POPULATE_OPENING_BALANCE ------
    PROCEDURE STOCK_ANALYSIS_DETAILED_REPORT(FromDate varchar2,ToDate varchar2)
    AS
    OPENING_BALANCE NUMBER:=0;
    prev_vendor VARCHAR2(75) := 'NONE';
    prev_material VARCHAR2(75) := 'NONE';
    BEGIN
    delete STOCK_ANALYSIS_TABLE;
    FOR I IN
    select
         cst_doc_no,
         cst_doc_date,
         cst_movement_type,
         cst_grgi_slip_no,
         cst_material,
         cst_receiving_vendor,
         received_qty,
         consumed_qty,
         status,
         NVL((SELECT TEMP_STOCK_QTY FROM STOCK_TEMP_OPEN_BALANCE WHERE TEMP_VENDOR= cst_receiving_vendor AND TEMP_MATERIAL=cst_material),0) OPENING_BALANCE,
         UOM,
         dc_no,
         dc_date,
         dc_doc_no
    from
         (     select
                   cst_doc_no,
                   cst_doc_date,
                   cst_movement_type,
                   cst_grgi_slip_no,
                   lpad(cst_material,18,0) cst_material,
                   cst_receiving_vendor ,
                   sum(cst_quantity) received_qty,
                   0 consumed_qty,
                   'received' status,
                   cst_unit_of_measure UOM,
                   dc_no dc_no,
                   dc_date dc_date,
                   dc_doc_no dc_doc_no
              from
                   STOCK_DATA c
              WHERE
                   (cst_doc_date between to_date(FromDate,'dd/mm/yyyy') and to_date(ToDate,'dd/mm/yyyy'))
                   and (
                        (CST_MOVEMENT_TYPE='101' and CST_SPL_INDICATOR ='O') or
                        CST_MOVEMENT_TYPE='541' or
                        CST_MOVEMENT_TYPE='544' or
                        CST_MOVEMENT_TYPE='545' or
                        (CST_MOVEMENT_TYPE='552' and CST_SPL_INDICATOR ='O')
              group by
                   cst_material,cst_receiving_vendor,cst_doc_date,cst_doc_no,cst_movement_type,
                   cst_grgi_slip_no,cst_unit_of_measure,dc_no,dc_date,dc_doc_no
         UNION
              select
                   cst_doc_no,
                   cst_doc_date,
                   cst_movement_type,
                   cst_grgi_slip_no,
                   lpad(cst_material,18,0) cst_material ,
                   cst_receiving_vendor,
                   0 received_qty,
                   (SUM (cst_quantity)) consumed_qty,
                   'consumed' status,
                   CST_UNIT_OF_MEASURE UOM,
                   dc_no dc_no,
                   dc_date dc_date,
                   dc_doc_no dc_doc_no
              from
                   STOCK_DATA
              where
                   (cst_doc_date between to_date(FromDate,'dd/mm/yyyy') and to_date(ToDate,'dd/mm/yyyy'))
                   and (CST_MOVEMENT_TYPE='543'
                   or CST_MOVEMENT_TYPE='542'
                   OR CST_MOVEMENT_TYPE='546'
                   OR (CST_MOVEMENT_TYPE='102' and CST_SPL_INDICATOR ='O')
                   or (CST_MOVEMENT_TYPE='551' and CST_SPL_INDICATOR ='O'))
              group by
                   cst_material,cst_receiving_vendor,cst_doc_date,cst_doc_no,cst_movement_type,
                   cst_grgi_slip_no,cst_unit_of_measure,dc_no,dc_date,dc_doc_no
    order by cst_receiving_vendor,cst_material,cst_doc_date asc, status desc
    LOOP
    IF not(i.cst_receiving_vendor = prev_vendor AND i.cst_material = prev_material) THEN
    OPENING_BALANCE := i.OPENING_BALANCE;
    END IF;
    INSERT INTO STOCK_ANALYSIS_TABLE
    (CST_DOC_NO, CST_DOC_DATE, CST_MOVEMENT_TYPE,
    CST_GRGI_SLIP_NO, CST_MATERIAL, CST_RECEIVING_VENDOR,
    RECEIVED_QTY, CONSUMED_QTY, STATUS, OPENING_BALANCE, STOCK_QTY,
    UOM, DC_NO, DC_DATE, DC_DOC_NO
    VALUES
    i.cst_doc_no,
    i.cst_doc_date,
    i.cst_movement_type,
    i.cst_grgi_slip_no,
    i.cst_material,
    i.cst_receiving_vendor,
    i.received_qty,
    i.consumed_qty,
    i.status,
    OPENING_BALANCE ,
    (OPENING_BALANCE+i.received_qty)-i.consumed_qty,
    i.uom,
    i.dc_no,
    i.dc_date,
    i.dc_doc_no
    OPENING_BALANCE := (OPENING_BALANCE+i.received_qty)-i.consumed_qty;
    prev_vendor := i.cst_receiving_vendor;
    prev_material := i.cst_material ;
    END LOOP;
    END STOCK_ANALYSIS_DETAILED_REPORT;
    ------- END STOCK_ANALYSIS_DETYAILED_REPORT ------
    PROCEDURE AGING_REPORT(GivenDate in Varchar2)
    AS
    vPrevVendor varchar2(25) := 'V';
    vPrevMaterial varchar2(25) := 'M';
    vCurrentVendor varchar2(25) := null;
    vCurrentMaterial varchar2(25) := null;
    vConsumedQty number:=0;
    vStockQty number := 0;
    vStockFlag varchar2(5) := 'Y';
    vQtyFlag varchar2(5) := 'Y';
    vCountFlag number := 0;
    BEGIN
    delete STOCK_AGING_TABLE;
    FOR I IN (
    select
    CST_DOC_NO, CST_DOC_DATE, CST_MATERIAL, CST_RECEIVING_VENDOR, RECEIVED_QTY, CONSUMED_QTY, OPENING_BALANCE,
    UOM,DC_NO,DC_DATE,DC_DOC_NO,CST_GRGI_SLIP_NO
    from STOCK_ANALYSIS_TABLE
    LOOP
         vCurrentVendor := I.CST_RECEIVING_VENDOR;
         vCurrentMaterial := I.CST_MATERIAL;
         IF vPrevVendor = i.CST_RECEIVING_VENDOR AND vPrevMaterial= i.CST_MATERIAL THEN
              IF vStockFlag='Y' THEN
              vStockFlag := 'N';
                   FOR J IN(select CONSUMED_QTY from STOCK_ANALYSIS_TABLE
                   WHERE CST_RECEIVING_VENDOR = i.CST_RECEIVING_VENDOR and CST_MATERIAL = i.CST_MATERIAL) LOOP
                        vConsumedQty := vConsumedQty+J.CONSUMED_QTY;
                   END LOOP;
              vConsumedQty := ( vConsumedQty - (I.OPENING_BALANCE + I.RECEIVED_QTY));
              ELSIF vQtyFlag = 'Y' THEN
                        vConsumedQty := (vConsumedQty - I.RECEIVED_QTY);
              END IF;
              IF     vConsumedQty <= 0 THEN
                   IF vQtyFlag = 'Y' THEN
                   vQtyFlag := 'N';
                   vStockQty := abs(vConsumedQty);
                   ELSE
                   vStockQty := I.RECEIVED_QTY;
                   END IF;
                   INSERT INTO STOCK_AGING_TABLE
                   (SAT_DOC_DATE,SAT_DOC_NO,SAT_VENDOR,SAT_MATERIAL,SAT_STOCK_QTY,SAT_NO_OF_DAYS,SAT_UOM, SAT_DC_NO, SAT_DC_DATE, SAT_DC_DOC_NO,SAT_GR_GI_SLIP_NO)
                   VALUES
                   I.CST_DOC_DATE,I.CST_DOC_NO,I.CST_RECEIVING_VENDOR,I.CST_MATERIAL,vStockQty,(to_date(GivenDate,'dd/mm/yyyy') - I.CST_DOC_DATE),I.UOM,I.DC_NO,I.DC_DATE,I.DC_DOC_NO,I.CST_GRGI_SLIP_NO
              END IF;
         ELSIF(vPrevVendor <> vCurrentVendor AND vPrevMaterial <> vCurrentMaterial) THEN
                   select count(CST_MATERIAL) into vCountFlag from STOCK_ANALYSIS_TABLE
                   WHERE CST_RECEIVING_VENDOR = vCurrentVendor and CST_MATERIAL = vCurrentMaterial;
                   IF vCountFlag = 1 THEN
                   INSERT INTO STOCK_AGING_TABLE
                   (SAT_DOC_DATE,SAT_DOC_NO,SAT_VENDOR,SAT_MATERIAL,SAT_STOCK_QTY,SAT_NO_OF_DAYS,SAT_UOM, SAT_DC_NO, SAT_DC_DATE, SAT_DC_DOC_NO,SAT_GR_GI_SLIP_NO)
                   VALUES
                   I.CST_DOC_DATE,I.CST_DOC_NO,I.CST_RECEIVING_VENDOR,I.CST_MATERIAL,(I.OPENING_BALANCE+I.RECEIVED_QTY),(to_date('31/03/2007','dd/mm/yyyy') - I.CST_DOC_DATE),I.UOM,I.DC_NO,I.DC_DATE,I.DC_DOC_NO,I.CST_GRGI_SLIP_NO
              vStockFlag := 'Y';
                   vQtyFlag := 'Y';
                   vConsumedQty := 0;
                   END IF;
         ELSE
              vStockFlag := 'Y';
                   vQtyFlag := 'Y';
                   vConsumedQty := 0;
         END IF;
    vPrevVendor := I.CST_RECEIVING_VENDOR;
    vPrevMaterial := I.CST_MATERIAL;
    END LOOP;
    END AGING_REPORT;
    END STOCK;
    /

Maybe you are looking for