Got ORA-00932

Hi.
When execute perl script I've got following error:
DBD::Oracle::db prepare failed: ORA-00932: inconsistent datatypes: expected NUMBER got BLOB (DBD ERR
OR: error possibly near <*> indicator at char 48 in 'select IMAGE_DATA from IMAGES where regexp_like
+(<*>IMAGE_DATA,'^\d{16}$')and rownum < = 10') [for Statement "select IMAGE_DATA from IMAGES where re+
+gexp_like(IMAGE_DATA,'^\d{16}$')and rownum < = 10"] at Find_Analyze_PAN_PROX4.TXT line 77.+
+Can't call method "execute" on an undefined value at Find_Analyze_PAN_PROX4.TXT line 78.+
Why this is happen and how i could troubleshoot it?

Hi T0t0shka ,
We get this Error, because the data types are Incompatible.
Use, Proper Conversion functions TO_NUMBER,TO_CHAR,TO_DATE to their appropriate data types.
We Often get this error, if we have a Table with Data type LONG also.
CREATE TABLE LONG_TABLE ( A LONG, B VARCHAR2(10) );
When you Perform a SELECT as
SELECT *
FROM long_table
WHERE b LIKE '%sj%';
We wont get error.
SELECT *
FROM long_table
WHERE a LIKE '%sj%';
We get Inconsistent datatypes error.
Thanks,
Shankar

Similar Messages

  • PL/SQL: ORA-00932: inconsistent datatypes: expected UDT got NUMBER

    Hi all,
    Wondering if you could assist? I'm exploring User Types and having a small problem. I'm getting the above error for a user type I have created which I'm calling in a function. Here's what my code looks like which I'm running the 'scott' schema for testing purposes
    SQL> CREATE OR REPLACE TYPE NBR_COLL AS TABLE OF NUMBER;
    2 /
    Type created.
    SQL> create or replace FUNCTION first_rec_only
    2 (
    3 NUM_ID IN NUMBER
    4 ) RETURN NUMBER IS
    5 v_num NBR_COLL;
    6 BEGIN
    7 select deptno into v_num from dept;
    8 RETURN v_num(v_num.FIRST);
    9 END first_rec_only;
    10 /
    Warning: Function created with compilation errors.
    SQL> show errors
    Errors for FUNCTION FIRST_REC_ONLY:
    LINE/COL ERROR
    7/4 PL/SQL: SQL Statement ignored
    7/11 PL/SQL: ORA-00932: inconsistent datatypes: expected UDT got
    NUMBER
    SQL>
    Any clues to what I'm doing wrong? Cheers.

    The deptno column is a number, you cannot directly select a number into your type, you need to use your type's constructor.
    Something like:
    CREATE OR REPLACE FUNCTION first_rec_only (NUM_ID IN NUMBER) RETURN NUMBER IS
       v_num NBR_COLL;
    BEGIN
       SELECT nbr_coll(deptno) INTO v_num from dept;
       RETURN v_num(v_num.FIRST);
    END first_rec_only;Note that although this will compile, it will throw ORA-01422: exact fetch returns more than requested number of rows when you run it. you need to either use the input parameter as a predicate on your query against dept, use rownum = 1 in the query or use bulk BULK COLLECT INTO, depending on what exactly you want to accomplish.
    John

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

  • Ora-00932 "expected number got -"... error comes and goes

    We have several procedures in a package which get called by an asp.net application. The procedures return a sys_refcursor as an out param, by going OPEN param FOR big complicated query. There are about seven procedures which encapsulate different queries. Sometimes, this package seems to just get into a bad mood.
    The symptom is, every time the application calls one of the procedures, it gets back the error "ORA-00932: inconsistent datatypes: expected NUMBER got -", with the line number being the beginning of the "OPEN param FOR" statement. But then, if I open SQL Developer and fiddle around with the package, the error goes away... like, sometimes if I manually invoke one of the procedures in script form from the SQL Developer window, it returns successfully there, and then for the rest of the day the application works fine. Then on some other day the app starts getting the error again. Recompiling the package also sometimes changes the state between erroring and working.
    I don't see how the error message can be a real error if these changing circumstances allow the procedure to work sometimes but not other times with the same data. I also don't understand what "got -" is supposed to mean. I'm scared about what will happen if we ship something behaving this way. Any clues out there as to what is going on?

    I have identified a possible workaround. There's an inner subquery that goes something like this:
    SELECT fields FROM ( subquery_a UNION ALL subquery_b ) LEFT OUTER JOIN table_c ON (condition)
    This in turn gets outer-joined to another subquery. Anyway, when I rewrite this subquery so there's no inside UNION ALL, the error goes away.
    At least in a simplified case.
    [edit] It looks like I have to avoid outer Union Alls as well.
    [edit] And CONNECT_BY_ROOT.
    [edit] And if I don't join one less-essential table. These three conditions actually each lead to three separate errors, any one of which will stop ODP.Net in its tracks though the query runs fine in sql plus or sqldeveloper. Using CONNECT_BY_ROOT causes the "expected NUMBER got -" error (even though the field I'm using it on is varchar2), the UNION ALL causes the internal error, and the harmful join causes a "end-of-file on communication channel". I can cause each of these independently of the other two, and I need three separate workarounds to get my product running!
    I am starting to conclude that ODP.Net, which I was ordered to use because it's so much better than the Microsoft driver, is a sack o sewage.
    Message was edited by:
    pointy
    Message was edited by:
    pointy

  • 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: inconsistent data types: expected NUMBER got BINARY

    ORA-00932: inconsistent data types: expected NUMBER got BINARY
    Hi,
    Could anyone help in resolving my problem?
    I ‘m developing cmp beans in Jbuilder X,
    My database is Oracle 10g, running on Linux and Application server is Oracle10gAs. Running on Windows.
    I can deploy my Entity EJB’s OK and look then up using finder methods as long as I’ve created the data directly in the database using SQL*Plus for instance.
    In the database I have my primary keys defined as type NUMBER
    In my EJB the corresponding number fields get mapped as java.math.BigDecimal.
    which according to the Oracle JDBC specification is how they are mapped.
    Problem:
    When I try to create a new database entity through my EJB entity bean I get:-
    Error "ORA-00932: inconsistent datatypes: expected NUMBER got BINARY".
    The value of the number being used as the primary key in this example is 10.
    Eg:-
    BigDecimal pk = new BigDecimal(10);
    TestBean test = home.create(pk);
    The datatype in my EJB Deployment descriptor ejb-jar-xml <pri-key-class> is java.math.BigDecimal>
    The jdbc driver defined in my application.xml is
    oracle.jdbc.driver.OracleDriverand url="jdbc:oracle:thin..." in the connection.
    I’ve even tried mapping a datatype as described in the Oracle FAQ’s but this didn’t work.
    21.     I'm trying to deploy a CMP entity bean with a field type BigDecimal and the table creation fails with an error. How do I work around this?
    You have to perform the following steps prior to deploy your application.
    o     Define the mapping for java.math.BigDecimal in the database-schemas/oracle.xml as follows:
    <type-mapping type="java.math.BigDecimal" name="number(20,8)" />o     Use this schema in your data-source as follows:-
    <data-source
    class="com.evermind.sql.DriverManagerDataSource"
    name="OracleDS"
    ejb-location="jdbc/OracleDS"
    schema="database-schemas/oracle.xml"
    connection-driver="oracle.jdbc.driver.OracleDriver"
    username="scott"
    password="tiger"
    url="jdbc:oracle:thin:@localhost:1521:DEBU"
    clean-available-connections-threshold="30"
    rac-enabled="false"
    inactivity-timeout="30"
    />

    Further clarification of my problem.
    Originally I said the error occurred when deploying EJB's
    Correction: I can deploy them OK on the application server However the Error message occurs when I try to create a new EJB entity, the only value required is the Primary key which I pass as type BidDecimal.
    If I create entries directly in the database my EJB findByPrimaryKey can find entities OK.
    But I cant create new ones through EJB.
    What realy baffels me is why I'm able to read data through the connection but not write.
    The datatype in my EJB Deployment descriptor ejb-jar-xml <pri-key-class> is java.math.BigDecimal>
    The jdbc driver defined in my application.xml is
    oracle.jdbc.driver.OracleDriver
    and url="jdbc:oracle:thin..." in the connection.

  • ORA-00932: inconsistent datatypes: expected - got -

    Hi,
    I have writen PL/SQL packages for data loging through pipe lined function for better peformance.The below packages has been compiled sucessfully but during the run time it shows an error
    like "ORA-00932: inconsistent datatypes: expected - got -".
    CREATE OR REPLACE PACKAGE pkg_mkt_hub_load
    AS
         PROCEDURE sp_final_load_mkt_hub;
           FUNCTION fnc_pipe_tot_lvl_idx_mon_hub
        (pi_input_cur IN SYS_REFCURSOR)
       RETURN tot_lvl_idx_mon_tt
       PIPELINED;
    END pkg_mkt_hub_load;
    CREATE OR REPLACE PACKAGE BODY pkg_mkt_hub_load
    AS
      c_default_limit CONSTANT PLS_INTEGER:=5000;
      c_created_dt    CONSTANT DATE:=SYSDATE;
      c_created_user  CONSTANT VARCHAR2(20):='SYSTEM';
      c_updated_dt    CONSTANT DATE:=SYSDATE;
      c_updated_user  CONSTANT VARCHAR2(20):='SYSTEM';
      -- to get the debug desc for updating process log table
      vg_debug_log_desc mkt_process_log.debug_log_desc%TYPE;
      --to get process log key
      vg_process_log_ky mkt_process_log.process_log_ky%TYPE;
       -- reset the all variables.
      PROCEDURE sp_reset_global_variables;
      PROCEDURE sp_final_lvl_idx_mon_hub;
      --PROCEDURE sp_final_lvl_idx_dly_hub;
      FUNCTION fnc_pipe_tot_lvl_idx_mon_hub
        (pi_input_cur IN SYS_REFCURSOR)
       RETURN tot_lvl_idx_mon_tt
       PIPELINED
      AS
       vl_lvl_idx_mon_cur_data tot_lvl_idx_mon_tt;
       BEGIN
         LOOP
          FETCH pi_input_cur BULK COLLECT INTO vl_lvl_idx_mon_cur_data LIMIT c_default_limit;
          EXIT WHEN vl_lvl_idx_mon_cur_data.COUNT = 0;
          FOR i IN 1 .. vl_lvl_idx_mon_cur_data.COUNT
          LOOP
            PIPE ROW (tot_lvl_idx_mon_ot(vl_lvl_idx_mon_cur_data(i).SSIA_INDEX_ID,
            vl_lvl_idx_mon_cur_data(i).start_date,vl_lvl_idx_mon_cur_data(i).currency,
          vl_lvl_idx_mon_cur_data(i).level1,vl_lvl_idx_mon_cur_data(i).type,
          vl_lvl_idx_mon_cur_data(i).RETURN_MONTH,vl_lvl_idx_mon_cur_data(i).RETURN_3MONTHS,
          vl_lvl_idx_mon_cur_data(i).RETURN_6MONTHS,vl_lvl_idx_mon_cur_data(i).RETURN_YTD,
          vl_lvl_idx_mon_cur_data(i).RETURN_1YEAR,vl_lvl_idx_mon_cur_data(i).RETURN_3YEARS,
          vl_lvl_idx_mon_cur_data(i).RETURN_5YEARS,vl_lvl_idx_mon_cur_data(i).RETURN_10YEARS,
          vl_lvl_idx_mon_cur_data(i).MARKET_CAP));
          END LOOP;
          END LOOP;
          CLOSE pi_input_cur;
          RETURN;
       END fnc_pipe_tot_lvl_idx_mon_hub;     
       PROCEDURE sp_final_lvl_idx_mon_hub
       AS
       BEGIN
       MERGE INTO mkt_total_lvl_indx_mon_hub idxhub  
       USING TABLE(pkg_mkt_hub_load.fnc_pipe_tot_lvl_idx_mon_hub(CURSOR(SELECT idxmap.ssia_index_code,idxstg.start_date,idxstg.currency,idxstg.level1,idxstg.type,
           idxstg.return_month,idxstg.return_3months, idxstg.return_6months, idxstg.return_ytd, idxstg.return_1year,
           idxstg.return_3years, idxstg.return_5years,idxstg.return_10years,idxstg.market_cap
         FROM   mkt_total_lvl_indx_mon_stg idxstg,
                 md_vendor_index_map idxmap
         WHERE  idxmap.source = idxstg.source
                 AND idxmap.base_currency = idxstg.currency
                 AND idxmap.return_type = idxstg.TYPE
                 AND idxmap.mkt_index_id = idxstg.vendor_code
                 AND idxmap.monthly = 'Y'
                 AND idxmap.file_type = 'T'))) idxmonstg
         ON (idxhub.ssia_index_id=idxmonstg.ssia_index_id)
         WHEN MATCHED THEN
         UPDATE set effective_date=idxmonstg.start_date,
                      CURRENCY=idxmonstg.currency,
                      INDEX_LEVEL=idxmonstg.LEVEL1,
                      TYPE=idxmonstg.type,
                      return_month=idxmonstg.return_month,
                      return_3months=idxmonstg.return_3months,
                      return_6months=idxmonstg.return_6months,
                      return_ytd=idxmonstg.return_ytd,
                      return_1year=idxmonstg.return_1year,
                      return_3years=idxmonstg.return_3years,
                      return_5years=idxmonstg.return_5years,
                      return_10years=idxmonstg.return_10years,
                      market_cap=idxmonstg.market_cap,
                      updated_dt=SYSDATE,
                      updated_user='MICHAEL'
         WHEN NOT MATCHED THEN
          INSERT (  ssia_index_id,
                    effective_date,
                      currency,
                      INDEX_LEVEL,
                      TYPE,
                      return_month,
                      return_3months,
                      return_6months,
                      return_ytd,
                      return_1year,
                      return_3years,
                      return_5years,
                      return_10years,
                      market_cap,
                      created_dt,
                      created_user)
         VALUES(        idxmonstg.ssia_index_id,
                      idxmonstg.start_date,
                      idxmonstg.currency,
                      idxmonstg.LEVEL1,
                      idxmonstg.type,
                      idxmonstg.return_month,
                      idxmonstg.return_3months,
                      idxmonstg.return_6months,
                      idxmonstg.return_ytd,
                      idxmonstg.return_1year,
                      idxmonstg.return_3years,
                      idxmonstg.return_5years,
                      idxmonstg.return_10years,
                      idxmonstg.market_cap,
                   SYSDATE,
                   'MICHAEL');     
       END sp_final_lvl_idx_mon_hub;
       PROCEDURE sp_final_load_mkt_hub
       as
       BEGIN
        sp_final_lvl_idx_mon_hub;
       END sp_final_load_mkt_hub;
       PROCEDURE Sp_reset_global_variables
       AS
       BEGIN
       vg_debug_log_desc := NULL;
       END sp_reset_global_variables;      
    END pkg_mkt_hub_load;
    SHOW ERRORS  Error:
    ERROR at line 1:
    ORA-00932: inconsistent datatypes: expected - got -
    ORA-06512: at "GPAIHMKTDTA.PKG_MKT_HUB_LOAD", line 33
    ORA-06512: at "GPAIHMKTDTA.PKG_MKT_HUB_LOAD", line 55
    ORA-06512: at "GPAIHMKTDTA.PKG_MKT_HUB_LOAD", line 92
    ORA-06512: at line 1
    types scripts:
    create or replace type tot_lvl_idx_mon_ot as object
    (SSIA_INDEX_ID  VARCHAR2(60),
    start_date date,
    CURRENCY               VARCHAR2(10),
    LEVEL1                  NUMBER(31,11),
    TYPE                    VARCHAR2(31) ,
    RETURN_MONTH            NUMBER(31,11),
    RETURN_3MONTHS          NUMBER(31,11),
    RETURN_6MONTHS          NUMBER(31,11),
    RETURN_YTD              NUMBER(31,11),
    RETURN_1YEAR            NUMBER(31,11),
    RETURN_3YEARS           NUMBER(31,11),
    RETURN_5YEARS           NUMBER(31,11),
    RETURN_10YEARS          NUMBER(31,11),
    MARKET_CAP              NUMBER(31,11));
    create or replace type tot_lvl_idx_mon_tt is table of tot_lvl_idx_mon_ot;how to resolve this issue?

    >
    could you please pointed out whether ref cursor used method correct or not?
    >
    The use looks correct but without your tables and DDL we can't even try to reproduce the problem.
    Notice how you had to break down the process to find out the query that is causing the problem?
    select *
    from TABLE(pkg_mkt_hub_load.fnc_pipe_tot_lvl_idx_mon_hub(CURSOR(SELECT . . .Unfortunately, this is where you should have started when you began creating the process.
    You are trying to design, implement and debug a process using code that has 3,4, 5 or more layers and objects and tables that have a dozen or more columns.
    That is not the way I would recommend especially if you do not have experience with some of the pieces like object types and tables, pipelined functions and ref cursors. You are trying to deal with too many complications at the same time.
    Here is how I would approach this if I were you.
    1. Get the process to work first and then build on it. Start by copying and hacking up what you already have.
    2. Create a very simple version of each of the pieces
    3. Create an object type like 'tot_lvl_idx_mon_ot' with only one or two columns.
    4. Create an object type like 'tot_lvl_idx_mon_tt' as a table of that simple object type
    5. Create a pipelined function that uses the two new simple types, simply hard-codes a value for one or two rows and then pipes out the rows.
    6. Use a simple query like the last one you posted to query the simple pipelined function
    select *
    from TABLE(pkg_mkt_hub_load.simpe_pipeline_function(CURSOR(SELECT . . .Work on that simple set of objects until you have the process defined and working.
    Then expand the now working example to use get the data values dynamically and to use more complicated objects.
    Start with something simple that works. Then build on it.
    It will take a lot less time and will point out other issues with your approach to this. Also, if you try a simple version using the SCOTT emp or dept table and it doesn't work you can post the code and we can try to reproduce it and help find the problem.

  • 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

  • ORA-00932: inconsistent datatypes: expected - got CURSER

    Hi all,
    I created a Function and tried to execute it from SQL Plus, but am getting an error
    ORA-00932: inconsistent datatypes: expected - got CURSER
    I have been trying to debug for ages, but cant get to the root of what the problem might be. I would appreciate any help or idea's people could offer
    The only comfort I take from this is that Oracle have a typo in one of their error messages :)
    SQL PLUS CODE
    select * FROM TABLE(CAST(tsoraimpdb.QueryAuthorsFunc(116, 1, -1, 1, 0) as tsoraimpdb.ENTITYIDTABLE));FUNCTION CODE
    CREATE OR REPLACE FUNCTION &HKImpDB_Schema_Name..QueryAuthorsFunc
    aKGID NUMBER,
      aPageNumber NUMBER,              -- The page interested
      aPageSize NUMBER,                -- Number of records per page
      aOffset NUMBER,                  -- The offset = number of records already got
      aTotalRecord NUMBER          -- Total number of users in the database
    RETURN sys_refcursor
    as
    l_FuncCur sys_refcursor;
    l_TotalRecord NUMBER(10) := aTotalRecord;
    l_Offset NUMBER(10) := aOffset;
    l_PagingTable TEMP_T_TABLE:= TEMP_T_TABLE();
    -- paging set up
    l_MinRecordsOnAPge NUMBER(10); --last record on the previous page
    l_MaxRecordsOnAPge NUMBER(10); --last record on the current page
    begin
    DBMS_OUTPUT.PUT_LINE('start');
    select KnowdePos(rownum,p.ID) bulk collect into l_PagingTable
      FROM KnowledgeGene kg
      INNER JOIN HKResource r ON kg.KGOwner = r.ID
      INNER JOIN Person p ON r.PersonID = p.ID
    WHERE kg.kgid = akgid
    ORDER BY p.FirstName + ' ' + p.LastName;
    l_TotalRecord := l_PagingTable.count; -- get total records
    DBMS_OUTPUT.PUT_LINE(  l_TotalRecord);
    if aPageSize > 0 then
      if aPageNumber <= 0 then
              Raise_application_error(-20003,'Invalid Page Number');
      else
          l_MinRecordsOnAPge := (aPageNumber-1)*aPageSize;
          l_MaxRecordsOnAPge := aPageNumber*aPageSize;
      end if;
    else -- if @PageSize < 0 return all records
        l_Offset := 0;
        l_MinRecordsOnAPge := 0;
        l_MaxRecordsOnAPge := l_TotalRecord;
    END if;
    -- return results for the correct page
    open l_FuncCur for
    SELECT pos
      from HKResource r
      INNER JOIN Person p ON r.PersonID = p.ID
      inner join TABLE(CAST(l_PagingTable AS TEMP_T_TABLE)) on pos = p.id
      WHERE KnowdeID > l_MinRecordsOnAPge - l_Offset AND KnowdeID <= l_MaxRecordsOnAPge - l_Offset;
    return l_FuncCur;
    EXCEPTION when NO_DATA_FOUND then null;
    end;

    Ok, I think you could rewrite that as:
    CREATE OR REPLACE PROCEDURE &HKImpDB_Schema_Name..QueryInterestedUsers
      akgid int,
      aPageSize int,     -- Number of records per page
      aPageNumber int,      -- The page interested
      aOffset int,          -- The offset = number of records already got
      aExcludeCategoryUser int,-- default(1), -- whether to exclude category users
      aTotalRecord out NUMBER,  -- Total number of users in the database
      aCur out sys_refcursor
    AS
      -- paging set up
      l_MinRecordsOnAPge NUMBER(10); --last record on the previous page
      l_MaxRecordsOnAPge NUMBER(10); --last record on the current page
      l_TopLevelTopicGroup NUMBER(10);
    BEGIN
      if aPageSize <= 0  or aPageNumber <= 0 then
        Raise_application_error(-20003,'Invalid Page Size or Page Number');
      else
        l_MinRecordsOnAPge := (aPageNumber-1)*aPageSize;
        l_MaxRecordsOnAPge := aPageNumber*aPageSize;
      end if;
      l_TopLevelTopicGroup := --currently not defined anywhere??!!?!
      open aCur for
      WITH excluded_users as (--exclude default user
                              SELECT ID as PersonID
                              FROM   Person
                              where  Username = 'default'
                              UNION ALL
                              -- exclude authors
                              SELECT p.ID as PersonID
                              FROM   KnowledgeGene kg
                                     INNER JOIN HKResource r ON kg.KGOwner = r.ID
                                     INNER JOIN Person p ON r.PersonID = p.ID
                              WHERE  kg.kgid = akgid
                              UNION ALL
                              -- exclude categories users if applicable
                              SELECT ua.PersonID
                              FROM   HKGroup g
                                     INNER JOIN UserAccount ua ON g.AccountID = ua.AccountID
                              WHERE  g.ParentID = l_TopLevelTopicGroup
                              and    aExcludeCategoryUser = 1),
               PagingList as (SELECT rownum as ID,
                                     p.ID AS PersonID,
                                     P.Firstname||' '||P.LastName AS UserText,
                                     p.AvatarFilename
                              FROM   PanelKG
                                     INNER JOIN Panel ON PanelKG.PanelID = Panel.PanelID -- MyHyperknowledge panels that contain this KG
                                     INNER JOIN HKResource ON Panel.ResourceID = HKResource.ID -- the people who own the panels
                                     INNER JOIN Person P ON HKResource.PersonID = P.ID
                                     INNER JOIN PanelType pt ON pt.id = panel.panelid
                                     INNER JOIN ProfileVisibility pv ON pv.PersonID = P.ID -- check visibility
                                     INNER JOIN section sn ON sn.id = pv.SectionID
                              WHERE  PanelKG.KGID = akgid
                              AND    pt.name = 'MyHyperknowledge'
                              AND    sn.name = 'MyHyperknowledge'
                              AND    PanelKG.IsValid = 1
                              AND    pv.Visible = 1
                              AND    p.ID NOT IN (SELECT PersonID
                                                  FROM   excluded_users))
      -- return results for the correct page
      SELECT PersonId,
             UserText,
             AvatarFilename
      FROM   PagingList
      WHERE  ID > l_MinRecordsOnAPge - aOffset
      AND    ID <= l_MaxRecordsOnAPge - aOffset;
      ORDER BY usertext; -- moved the order here, as it didn't make sense to leave it in the subquery!
    END QueryInterestedUsers;
    / Please also take note of the fact that you don't appear to have defined a value for "l_TopLevelTopicGroup" anywhere!
    HTH

  • ORA-00932: inconsistent datatypes: expected NUMBER got DATE

    I have a DAC task that is failing and I am getting the message below in the logs
    ORA-00932: inconsistent datatypes: expected NUMBER got DATE
    Attached below is the SQL for the mapping concerned, I am trying to figure this out so that I can run this ETL successfully.
    Any leads would be greatly appreciated.
    READER_1_1_1> CMN_1761 Timestamp Event: [Fri Nov 15 17:00:29 2013]
    READER_1_1_1> RR_4035 SQL Error [
    ORA-00932: inconsistent datatypes: expected NUMBER got DATE
    ORA-00932: inconsistent datatypes: expected NUMBER got DATE
    Database driver error...
    Function Name : Fetch
    SQL Stmt : SELECT
    PS_ITEM_DST.BUSINESS_UNIT_GL , PS_ITEM_DST.ACCOUNT , PS_ITEM_DST.ALTACCT , PS_ITEM_DST.DEPTID , PS_ITEM_DST.OPERATING_UNIT , PS_ITEM_DST.PRODUCT , PS_ITEM_DST.FUND_CODE , PS_ITEM_DST.CLASS_FLD , PS_ITEM_DST.PROGRAM_CODE , PS_ITEM_DST.BUDGET_REF , PS_ITEM_DST.AFFILIATE , PS_ITEM_DST.AFFILIATE_INTRA1 , PS_ITEM_DST.AFFILIATE_INTRA2 , PS_ITEM_DST.CHARTFIELD1 , PS_ITEM_DST.CHARTFIELD2 , PS_ITEM_DST.CHARTFIELD3 , PS_BI_LINE.PROJECT_ID , PS_ITEM_DST.STATISTICS_CODE , PS_ITEM.CUST_ID , PS_ITEM.ADDRESS_SEQ_NUM , PS_BI_HDR.SHIP_TO_CUST_ID , PS_BI_HDR.SHIP_TO_ADDR_NUM , PS_BI_HDR.SOLD_TO_CUST_ID , PS_BI_HDR.SOLD_TO_ADDR_NUM , PS_ITEM_DST.FOREIGN_AMOUNT , PS_ITEM_DST.MONETARY_AMOUNT , PS_ITEM_DST.FOREIGN_CURRENCY , PS_ITEM_DST.CURRENCY_CD , PS_ITEM_DST.BUSINESS_UNIT , PS_ITEM_DST.ITEM , PS_ITEM_DST.ITEM_LINE , PS_ITEM_DST.ITEM_SEQ_NUM , PS_ITEM_DST.DST_SEQ_NUM , PS_ITEM_DST.JOURNAL_ID , PS_ITEM_DST.JOURNAL_DATE , PS_ITEM_DST.JOURNAL_LINE , PS_ITEM_DST.GL_DISTRIB_STATUS , PS_ITEM_DST.LEDGER_GROUP , PS_ITEM_DST.LEDGER , SALESPERSON.EMPLID , PS_ITEM_ACTIVITY.COLLECTOR , PS_ITEM_ACTIVITY.ENTRY_TYPE , PS_ITEM_ACTIVITY.ENTRY_REASON , PS_ITEM_ACTIVITY.BANK_SETID , PS_ITEM_ACTIVITY.BANK_CD , PS_ITEM_ACTIVITY.BANK_ACCT_KEY , PS_ITEM_ACTIVITY.DEPOSIT_ID , PS_ITEM_ACTIVITY.PAYMENT_SEQ_NUM , PS_ITEM_ACTIVITY.GROUP_TYPE , PS_ITEM_ACTIVITY.POST_DT , PS_ITEM_ACTIVITY.ACCOUNTING_DT , PS_ITEM.BAL_AMT , PS_ITEM.ORIG_ITEM_AMT , PS_ITEM.ITEM_STATUS , PS_ITEM.PYMNT_TERMS_CD , PS_ITEM.DUE_DT , PS_ITEM.PO_REF , PS_ITEM.PO_LINE , PS_ITEM.ASOF_DT , PS_BI_HDR.DT_INVOICED , PS_BI_HDR.INVOICE_DT , PS_GROUP_CONTROL.OPRID , PS_ITEM.BUSINESS_UNIT_OM , PSPRCSRQST.RUNDTTM , PS_JRNL_HEADER.DTTM_STAMP_SEC , PSPRCSRQST1.RUNDTTM , PS_BI_HDR.LAST_UPDATE_DTTM , PS_JRNL_HEADER.JRNL_HDR_STATUS , PS_BI_LINE.TAX_CD , PS_BI_LINE.QTY , PS_BI_LINE.LAST_UPDATE_DTTM , PS_JRNL_HEADER.UNPOST_SEQ , PS_ITEM_DST.BUSINESS_UNIT_PC , PS_ITEM_DST.ACTIVITY_ID , PS_ITEM_DST.ANALYSIS_TYPE , PS_ITEM_DST.RESOURCE_TYPE , PS_ITEM_DST.RESOURCE_CATEGORY , PS_ITEM_DST.RESOURCE_SUB_CAT , PS_BI_LINE.CONTRACT_NUM
    FROM
    PS_ITEM_DST,
    PS_ITEM_ACTIVITY,
    PS_ITEM,
    PS_BI_HDR,
    PS_BI_LINE,
    PS_GROUP_CONTROL,
    PSPRCSRQST,
    PSPRCSRQST PSPRCSRQST1,
    PS_JRNL_HEADER,
    (SELECT A.SETCNTRLVALUE, B.SUPPORT_TEAM_MBR, B.EMPLID
    FROM PS_SET_CNTRL_REC A, PS_MEMBER_PERSON B
    WHERE A.SETID = B.SETID AND A.RECNAME = 'MEMBER_PERSON') SALESPERSON
    WHERE
    PS_ITEM_DST.BUSINESS_UNIT = PS_ITEM_ACTIVITY.BUSINESS_UNIT(+) AND PS_ITEM_DST.CUST_ID = PS_ITEM_ACTIVITY.CUST_ID(+) AND PS_ITEM_DST.ITEM = PS_ITEM_ACTIVITY.ITEM(+) AND PS_ITEM_DST.ITEM_LINE = PS_ITEM_ACTIVITY.ITEM_LINE(+) AND PS_ITEM_DST.ITEM_SEQ_NUM = PS_ITEM_ACTIVITY.ITEM_SEQ_NUM(+) AND PS_ITEM_DST.BUSINESS_UNIT = PS_ITEM.BUSINESS_UNIT(+) AND PS_ITEM_DST.CUST_ID = PS_ITEM.CUST_ID(+) AND PS_ITEM_DST.ITEM = PS_ITEM.ITEM(+) AND PS_ITEM_DST.ITEM_LINE = PS_ITEM.ITEM_LINE(+) AND PS_ITEM.BUSINESS_UNIT_BI = PS_BI_HDR.BUSINESS_UNIT(+) AND PS_ITEM.ITEM = PS_BI_HDR.INVOICE(+) AND PS_ITEM_DST.BUSINESS_UNIT_GL = PS_BI_LINE.BUSINESS_UNIT(+) AND PS_ITEM_DST.ITEM = PS_BI_LINE.INVOICE(+) AND PS_ITEM_DST.ITEM_SEQ_NUM = PS_BI_LINE.LINE_SEQ_NUM(+) AND PS_ITEM_ACTIVITY.GROUP_ID = PS_GROUP_CONTROL.GROUP_ID(+) AND PS_ITEM_ACTIVITY.GROUP_BU = PS_GROUP_CONTROL.GROUP_BU(+) AND PS_ITEM_DST.PROCESS_INSTANCE = PSPRCSRQST.PRCSINSTANCE(+) AND PS_ITEM_DST.BUSINESS_UNIT_GL = PS_JRNL_HEADER.BUSINESS_UNIT(+) AND PS_ITEM_DST.JOURNAL_ID = PS_JRNL_HEADER.JOURNAL_ID(+) AND PS_ITEM_DST.JOURNAL_DATE = PS_JRNL_HEADER.JOURNAL_DATE(+) AND PS_JRNL_HEADER.UNPOST_SEQ(+) = 0 AND PS_JRNL_HEADER.PROCESS_INSTANCE = PSPRCSRQST1.PRCSINSTANCE(+) AND PS_ITEM_ACTIVITY.BUSINESS_UNIT = SALESPERSON.SETCNTRLVALUE(+) AND PS_ITEM_ACTIVITY.SALES_PERSON = SALESPERSON.SUPPORT_TEAM_MBR(+)
    AND PS_ITEM_ACTIVITY.ENTRY_TYPE <> 'CR'
    --AND PS_ITEM_DST.GL_DISTRIB_STATUS <> 'I'
    --AND PS_ITEM_DST.GL_DISTRIB_STATUS ='D'

    It might be data issue.
    You may narrow down using length of the particular column.
    ex: date column length less than 8 or 10 might be an issue

  • ORA-00932: inconsistent datatypes: expected NUMBER got BLOB

    Hello,
    My query:
    select name,mime_type,blob_content
    from htmldb_application_files
    error:ORA-00932: inconsistent datatypes: expected NUMBER got BLOB
    What's going on?
    Tom

    Hi,
    So how can I check content of 'blob_content'?
    Tom

  • 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: inconsistent datatypes: expected %s got %s

    Hi All,
    I am facing the following error while querying a form.
    ORA-00932: inconsistent datatypes: expected %s got %s
    Can anyone please help me with this.
    Regards,
    Shruti

    user11272043 wrote:
    Hi All,
    I am facing the following error while querying a form.You can query a table, Not sure how you query a form. What do you mean by form?
    ORA-00932: inconsistent datatypes: expected %s got %sSomewhere (As you dint give us much to work with) you are using a incorrect datatype. For example Something that expects date and you pass number you will get this error.
    Can anyone please help me with this.No, with what ever you have supplied its hard to help. Give us more details.

  • Ora-00932 inconsistent datatypes expected got clob

    How can I get rid of this error in my query?
    ora-00932 inconsistent datatypes expected got clob
    The Maximum length of the object is 51465

    Hello,
    I would like to convert LONG into LOB. I get the following error.
    SQL> desc all_views
    Name                                      Null?    Typ
    OWNER                                     NOT NULL VARCHAR2(30)
    VIEW_NAME                                 NOT NULL VARCHAR2(30)
    TEXT_LENGTH                                        NUMBER
    TEXT                                               LONG
    TYPE_TEXT_LENGTH                                   NUMBER
    TYPE_TEXT                                          VARCHAR2(4000)
    OID_TEXT_LENGTH                                    NUMBER
    OID_TEXT                                           VARCHAR2(4000)
    VIEW_TYPE_OWNER                                    VARCHAR2(30)
    VIEW_TYPE                                          VARCHAR2(30)
    SUPERVIEW_NAME                                     VARCHAR2(30)
    SQL> SELECT to_lob(text) from all_views
      2  where rownum <= 1;
    SELECT to_lob(text) from all_views
    FEHLER in Zeile 1:
    ORA-00932: Inkonsistente Datentypen: - erwartet, LONG erhaltenDoes anybody have an idea?

  • ORA-00932: inconsistent datatypes: expected UDT got NUMBER

    Hello Friends...
    i got this error while inserting record ..
    ORA-00932: inconsistent datatypes: expected UDT got NUMBER
    wht is that UDT ??
    Thanks..

    You cannot insert into your table STUDENT using the COURSE_TAB collection, since the column SUB is defined as a single object type.
    So either you have to modify your insert into two inserts as follows;
    INSERT INTO STUDENT VALUES(1,COURSE('1','ORACLE') )
    INSERT INTO STUDENT VALUES(1,COURSE('2','JAVA') )
    /or you have to modify your table structure so you can store a nested table, which will allow you to have a single insert
    something like this:
    drop table s
    drop type course_tab
    create or replace type course_type as  object (
    CNO CHAR(1),
    C_CNAME VARCHAR2(10)
    CREATE or replace  TYPE course_tab AS TABLE OF course_type;
    create table s ( c course_tab )
    nested table c store as course_list
    -- You can now have a single insert as follows:
      1* insert into s (c) values ( course_tab ( course_type('1','Java'), course_type('2','Oracle'))  )
    SQL> /
    1 row created.Be careful of using nested tables though. asktom reckons one should not use them.
    P;

Maybe you are looking for