Inconsistent datatypes: expected - got CLOB

hi guys, i am currently doing a select from my table and in one of my selects I am doing a max() so therfore in the group by clause i have to group by every column that was not being used with max. As a result i get the error stated in the title of this thread. Would anyone know the reason why or how I can solve this problem.
Thanks.

Depending on how much data you are actually storing in your CLOB this might work for you:
create table my_table (my_num number, my_clob CLOB);
insert into my_table values (1, 'Hi there');
insert into my_table values (1, 'Hello');
insert into my_table values (2, 'Goodbye');
with data as (
select my_num, cast(substr(my_clob,1,4000) as varchar2(4000)) my_clob_varchar
from my_table
select my_num, max(my_clob_varchar)
from data
group by my_num;Result
MY_NUM     MAX(MY_CLOB_VARCHAR)
1     Hi there
2     Goodbye

Similar Messages

  • Inconsistent datatypes: expected - got CLOB (Urgent!!)

    Hi All,
    I am getting this error " inconsistent datatypes: expected - got CLOB" for a region based upon a SQL query. The base table contains a CLOB field but that is empty.
    Also, something strange is happening. This error comes for some users and doesn't come for some others. There is no authorization scheme on the page or on the region or on the column.
    I am using HTML DB 1.5.
    I don't know what am i missing. But, any help will be highly appreciated. It is quite urgent.
    Thanks in advance
    Monika

    I have something more to add to this issue.
    The CLOB field has been marked as a "Sortable" column. I think, this is creating problem as Oracle doesn't allow to sort on LOBs.
    But, again the behaviour here is not consistent. For some combinations of Sortable columns, there is no error and for some others error comes. Also, the CLOB column position in report attributes is affecting the behaviour.
    Does anybody have any idea on this unexpected behaviour.
    Thanks
    Monika

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

  • Getting "ORA-00932: inconsistent datatypes: expected - got CLOB"

    Hi:
    I've got a stored procedure that is attempting to open a cursor for a SQL string and getting an error. The query in the string is only a select (i.e. I'm not updating anything). I'm not doing a bind because the sole reason for doing any of this is just to validate the SQL. I am given some XML and I translate it into SQL and before saving the XML off because I want to verify that it actually translates into valid SQL. The validation test is dmbs_sql.parse().
    I've tried using varchar2 and CLOB as the sql string argument but still get the error. What is the inconsistency that Oracle is complaining about?
    Oracle 10.2.0.3 on RHEL 4 (64 bit)
    Thanks
    PROCEDURE SaveXML(XMLClob in CLOB, status out integer) IS
        chandle                      INT;
        sqlString                     VARCHAR2(4000);
        errorString                  VARCHAR2(300) := 'NO ERRORS.' ;
        xmldata                      XMLType;  -- The XMLType format of the XML to transform
        xsldata                       XMLType;  -- The XMLType format of the stylesheet to apply
        stylesheetClob             CLOB;   -- The stylesheet in CLOB form.
    BEGIN
        status := -1;
        -- Before saving, convert the XML to SQL and parse it to verify that it will in
        -- fact be able to be represented later as a valid SQL query. 
        -- Get the stylesheet from the stylesheet table.
        select stylesheet into stylesheetClob from saved_query_stylesheets
            where name = 'SAVED_QUERY.XSL' and rownum = 1
            order by version desc;
        xmldata := XMLType.createXML(XMLClob);
        xsldata :=  XMLType.createXML(stylesheetClob);
        sqlString := rto_char(dbms_xmlgen.convert(xmldata.transform(xsldata).getStringVal(),
                    dbms_xmlgen.ENTITY_DECODE) ) ;
        -- dbms_output.put_line('Length of query string is ' || length(sqlString));
        if(length(sqlString) <= 0) then
            dbms_output.put_line('NO sqlString obtained!');
            return;
        end if;
        begin -- catch the exception in this block
            dbms_output.put_line('SaveXML(): parsing XML now.');
            -- The parse command wants a cursor
            chandle := dbms_sql.open_cursor;   
            Dbms_sql.parse(chandle, sqlString, DBMS_SQL.NATIVE);
            DBMS_SQL.CLOSE_CURSOR(chandle);
            status := 0;
            dbms_output.put_line('SaveXML() successful!!  Returning...');
            EXCEPTION
                WHEN OTHERS THEN 
                DBMS_SQL.CLOSE_CURSOR(chandle);       
                DBMS_OUTPUT.PUT_LINE('Exception occurred and caught! ' || SQLERRM);
        end ;  
    EXCEPTION
      WHEN OTHERS THEN         
       DBMS_OUTPUT.PUT_LINE('Exception occurred ' || SQLERRM);
      status := 0;
    END SaveXML;

    Do you mean
    select dbms_lob.SUBSTR(stylesheet ,1,2000) into stylesheetClob from saved_query_stylesheets
    where name = 'SAVED_QUERY.XSL' and rownum = 1
    order by version desc;
    I modified it to be dbms_lob.SUBLSTR(stylesheet,1,4000)...
    and now I get a different errror.
    Exception occurred ORA-30625: method dispatch on NULL SELF argument is disallowed
    This makes me think that internally there is an extract on an empty node or something, i.e., it's data related?
    Update: I think I'm getting the 30625 error because one of my clobs is null and I'm getting the final query string by using (among other things) a command that includes getStringVar().
    SQLQuery := dbms_xmlgen.convert(xmldata.transform(xsldata).getStringVal(), dbms_xmlgen.ENTITY_DECODE);So I guess I'll track that down :)
    SUBSTR(
    STR1 CLOB CHARACTER SET ANY_CS,
    POS  NUMBER,                -- starting position
    LEN  NUMBER := 2147483647)  -- number of characters
    RETURN CLOB CHARACTER SET STR1%CHARSET;
    Edited by: Gaff on Apr 21, 2009 10:55 AM

  • Inconsistent datatypes:expected - got - error in handling xml

    hi i am getting the error Error(45,12): PL/SQL: ORA-00932: inconsistent datatypes: expected - got - in this procedure
    i tried a lot and landed in confused state..
    create or replace
    PROCEDURE BT_CPE_XML_READ1 IS
    dest_clob CLOB;
    src_clob BFILE := BFILENAME('DOC_PATH', 'tester.xml');
    dst_offset number := 1 ;
    src_offset number := 1 ;
    lang_ctx number := DBMS_LOB.DEFAULT_LANG_CTX;
    warning number;
    ex number;
    v_cast xmltype;
    v_varchar varchar2(32767);
    BEGIN
    DBMS_LOB.CREATETEMPORARY(dest_clob,true);
    ex := dbms_lob.fileexists(src_clob);
    if ex = 1 then
    INSERT INTO test_clob(id, file_name, XML_FILE_COLUMN, timestamp)
    VALUES(1001, 'test.xml', empty_clob(), sysdate)
    RETURNING XML_FILE_COLUMN INTO dest_clob;
    DBMS_LOB.OPEN(src_clob, DBMS_LOB.LOB_READONLY);
    DBMS_LOB.LoadCLOBFromFile(
    DEST_LOB => dest_clob
    , SRC_BFILE => src_clob
    , AMOUNT => DBMS_LOB.GETLENGTH(src_clob)
    , DEST_OFFSET => dst_offset
    , SRC_OFFSET => src_offset
    , BFILE_CSID => DBMS_LOB.DEFAULT_CSID
    , LANG_CONTEXT => lang_ctx
    , WARNING => warning
    DBMS_OUTPUT.ENABLE(100000);
    DBMS_LOB.CLOSE(src_clob);
    COMMIT;
    DBMS_OUTPUT.PUT_LINE('Loaded XML File using DBMS_LOB.LoadCLOBFromFile: (ID=1001).');
    v_cast :=xmltype(dest_clob);
    --dbms_output.put_line(v_cast);
    select extractvalue(XML_FILE_COLUMN,'/modifyProductPortfolioRequest/ns1:stateCode') from test_clob;
    end if;
    END BT_CPE_XML_READ1;
    is there any other way to get the value(xml)from the clob column of a table

    I see two issues off a quick eye-ball of the code<br><br>
    #1) You insert an empty clob into your table, load a local variable with the XML from disk, and then query the table. You never insert the XML into the table so you are querying on an empty column in the table.<br><br>
    #2) extractValue allows a third parm which is the namespace string. Since your XPath contains ns1: you'll need to use the third parm

  • Inconsistent datatypes: expected - got -

    hi i am getting the error Error(45,12): PL/SQL: ORA-00932: inconsistent datatypes: expected - got - in this procedure
    i tried a lot and landed in confused state..
    create or replace
    PROCEDURE BT_CPE_XML_READ1 IS
    dest_clob CLOB;
    src_clob BFILE := BFILENAME('DOC_PATH', 'tester.xml');
    dst_offset number := 1 ;
    src_offset number := 1 ;
    lang_ctx number := DBMS_LOB.DEFAULT_LANG_CTX;
    warning number;
    ex number;
    v_cast xmltype;
    v_varchar varchar2(32767);
    BEGIN
    DBMS_LOB.CREATETEMPORARY(dest_clob,true);
    ex := dbms_lob.fileexists(src_clob);
    if ex = 1 then
    INSERT INTO test_clob(id, file_name, XML_FILE_COLUMN, timestamp)
    VALUES(1001, 'test.xml', empty_clob(), sysdate)
    RETURNING XML_FILE_COLUMN INTO dest_clob;
    DBMS_LOB.OPEN(src_clob, DBMS_LOB.LOB_READONLY);
    DBMS_LOB.LoadCLOBFromFile(
    DEST_LOB => dest_clob
    , SRC_BFILE => src_clob
    , AMOUNT => DBMS_LOB.GETLENGTH(src_clob)
    , DEST_OFFSET => dst_offset
    , SRC_OFFSET => src_offset
    , BFILE_CSID => DBMS_LOB.DEFAULT_CSID
    , LANG_CONTEXT => lang_ctx
    , WARNING => warning
    DBMS_OUTPUT.ENABLE(100000);
    DBMS_LOB.CLOSE(src_clob);
    COMMIT;
    DBMS_OUTPUT.PUT_LINE('Loaded XML File using DBMS_LOB.LoadCLOBFromFile: (ID=1001).');
    v_cast :=xmltype(dest_clob);
    --dbms_output.put_line(v_cast);
    select extractvalue(XML_FILE_COLUMN,'/modifyProductPortfolioRequest/ns1:stateCode') from test_clob;
    end if;
    END BT_CPE_XML_READ1;
    is there any other way to get the value(xml)from the clob column of a table

    I see two issues off a quick eye-ball of the code<br><br>
    #1) You insert an empty clob into your table, load a local variable with the XML from disk, and then query the table. You never insert the XML into the table so you are querying on an empty column in the table.<br><br>
    #2) extractValue allows a third parm which is the namespace string. Since your XPath contains ns1: you'll need to use the third parm

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

  • Inconsistent datatypes: expected - got CHAR, Detail view bind variables

    Hi.
    Here is my problem:
    I have master detail views connected with a view link. Both of views have bind variables that hold some session info:
    It's a menu on database and I am trying to hide some values based on user permissions.
    When running application module, everything works fine. The problem occurs when I try to show menu as a tree table, or any other table, on a page.
    The root view executes fine, but then I get an
    "java.sql.SQLSyntaxErrorException: ORA-00932: inconsistent datatypes: expected - got CHAR"
    error in executeQueryForCollection method of detail view. (this method is overridden)
    Bind Variables are:
    - :menuRoot -> which holds value of Root node. (In detail view it's just a dummy variable. It is explaned later on why i used it.)
    - :listOfUserPermmission -> array of user permissions.
    My query looks like this:
    1.Master View:
    SELECT MetVMenu.CHILD_ID,
           MetVMenu.CHILD_IME_MODULA,
           MetVMenu.PARENT_ID,
           MetVMenu.PARENT_IME_MODULA,
           MetVMenu.ZST,
           MetVMenu.NIVO,
           MetVMenu.CHILD_NAZIV_V_MENIJU,
           MetVMenu.CHILD_TIP_MODULA,
           MetVMenu.CHILD_OPIS_MODULA
    FROM MET_V_MENU MetVMenu
    WHERE MetVMenu.PARENT_IME_MODULA like :menuRoot
    and MetVMenu.CHILD_IME_MODULA in (SELECT * FROM TABLE(CAST(:listOfUserPermission AS STRARRAY)))CHILD_IME_MODULA and PARENT_IME_MODULA are also names of permissions.
    2.View Link that connects master.CHILD_ID and detail PARENT_ID
    3.Detail view, that then links to itself... to get the tree menu.
    SELECT MetVMenu.CHILD_ID,
           MetVMenu.CHILD_IME_MODULA,
           MetVMenu.PARENT_ID,
           MetVMenu.PARENT_IME_MODULA,
           MetVMenu.ZST,
           MetVMenu.NIVO,
           MetVMenu.CHILD_NAZIV_V_MENIJU,
           MetVMenu.CHILD_TIP_MODULA,
           MetVMenu.CHILD_OPIS_MODULA
    FROM MET_V_MENU MetVMenu
    WHERE :menuRoot like 'a'
    and
    MetVMenu.CHILD_IME_MODULA in (SELECT * FROM TABLE(CAST(:listOfUserPermission AS STRARRAY)))4. ViewLink that connects CHILD_ID and PARENT_ID of this "detail" view.
    Both views executeQuery methods are overridden to set Bind variables before execution.
    I get an arrayList of strings (permissions) from session and then convert it to Array.
         ArrayList permmissionsArray = (ArrayList)MyUserSession.getSessionValue("permissions");
         Array permissions = new Array(permissionsArray.toArray());
            HashMap context = new HashMap();
            context.put(DomainContext.ELEMENT_SQL_NAME, "STRARRAY");
            context.put(DomainContext.ELEMENT_TYPE, String.class);
            if(permissions != null){
                permissions.setContext(null, null, context);
                setlistOfUserPermission(permissions);
         //Here I set menuRoot variable.
         I also noticed that there are problems with how I define bind variables (the order matters).
    So when i didn't use menuRoot variable in detail view I got the
    “inconsistent datatypes: expected - got CHAR"
    error in application module.

    I went through those links, and I am sure the user has enough rights on STRARRAY object.
    I noticed that when running application module things work fine if I firstly execute RootView - Master view.
    and then double click on VL which shows detail view in table.
    The error occurs if I click on ViewLink first. I am not sure if I am even "allowed" to do that.
    I set the parameters with "setNamedWhereClauseParam" and print them out before i call super.executeQueryForCollection() and this the output i get:
    ExecuteQueryForCollectionRoot
    Permission: [AdfIn2Ogrodje.ROOT, AdfIn2Ogrodje.ADMINISTRACIJA, HOME]
    [87] MetVMenuRoot1 ViewRowSetImpl.setNamedWhereClauseParam(listOfUserPermission, oracle.jbo.domain.Array@e1af74d9)
    [88] MetVMenuRoot1 ViewRowSetImpl.setNamedWhereClauseParam(menuRoot, AdfIn2Ogrodje.ROOT)
    //Print before execution.
    EXECUTE_MENUROOT menuRoot: AdfIn2Ogrodje.ROOT
    EXECUTE_MENUROOT permission: oracle.jbo.domain.Array@e1af74d9
        Permission: AdfIn2Ogrodje.ROOT
        Permission: AdfIn2Ogrodje.ADMINISTRACIJA
        Permission: HOME
    [89] MetVMenuRoot1>#q computed SQLStmtBufLen: 537, actual=447, storing=477
    [90] SELECT MetVMenu.CHILD_ID,         MetVMenu.CHILD_IME_MODULA,         MetVMenu.PARENT_ID,         MetVMenu.PARENT_IME_MODULA,         MetVMenu.ZST,         MetVMenu.NIVO,         MetVMenu.CHILD_NAZIV_V_MENIJU,         MetVMenu.CHILD_TIP_MODULA,         MetVMenu.CHILD_OPIS_MODULA FROM MET_V_MENU MetVMenu WHERE MetVMenu.PARENT_IME_MODULA like :menuRoot and MetVMenu.CHILD_IME_MODULA in (SELECT * FROM TABLE(CAST(:listOfUserPermission AS STRARRAY)))
    [91] ViewObject: [adfin2.menu.model.views.MetVMenuRoot]MetMenuAppModule.MetVMenuRoot1 Created new QUERY statement
    [92] Bind params for ViewObject: [adfin2.menu.model.views.MetVMenuRoot]MetMenuAppModule.MetVMenuRoot1
    [93] Binding null of type 12 for "menuRoot"
    [94] Binding null of type 12 for "listOfUserPermission"
    protected void executeQueryForCollection(Object object, Object[] object2, int i) {
            System.out.println("ExecuteQueryForCollectionRoot");
            setParametersForSessionTest(); // method where i set the parameters.
            printExecute(); // printing
            super.executeQueryForCollection(object, object2, i);
        }After a few clicks on OK button the query executes normally.
    What I am guessing is, that executeQueryForCollection just takes whatever is in object2 and that's null at the beginning.
    I tried to use this method, which sets the bind variables in object2. And it gives me "Invalid column type" error.
    http://packtlib.packtpub.com/library/9781849684767/ch04lvl1sec07

  • 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 - got CHAR in 10.1.3 ADF BC.

    "ORA-00932: inconsistent datatypes: expected - got CHAR"
    i got SQL error during statement preparation. Statement: SELECT Emp.EMPNO, Emp.ENAME, Emp.JOB, Emp.MGR, Emp.HIREDATE, Emp.SAL, Emp.COMM, Emp.DEPTNO, Emp.ROWID FROM EMP Emp WHERE (EMPNO in (SELECT * FROM TABLE(CAST(:no AS TABLE_OF_NO))))
    Oct 29, 2008 1:53:09 PM oracle.adf.controller.faces.lifecycle.FacesPageLifecycle addMessage
    WARNING: ORA-00932: inconsistent datatypes: expected - got CHAR
    while running the emp.jspx page.
    Thanks
    Rama.
    Edited by: user634195 on Oct 31, 2008 5:10 AM
    Edited by: user634195 on Oct 31, 2008 5:13 AM

    "ORA-00932: inconsistent datatypes: expected - got CHAR"
    i got SQL error during statement preparation. Statement: SELECT Emp.EMPNO, Emp.ENAME, Emp.JOB, Emp.MGR, Emp.HIREDATE, Emp.SAL, Emp.COMM, Emp.DEPTNO, Emp.ROWID FROM EMP Emp WHERE (EMPNO in (SELECT * FROM TABLE(CAST(:no AS TABLE_OF_NO))))
    Oct 29, 2008 1:53:09 PM oracle.adf.controller.faces.lifecycle.FacesPageLifecycle addMessage
    WARNING: ORA-00932: inconsistent datatypes: expected - got CHAR
    while running the emp.jspx page.
    Thanks
    Rama.
    Edited by: user634195 on Oct 31, 2008 5:10 AM
    Edited by: user634195 on Oct 31, 2008 5:13 AM

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

    Hello
    Why in the following query I got the above error
      (SELECT distinct       K_PRESTAA_IMGA FROM
         (SELECT
                 NVL(IMG_ESAME, EMPTY_BLOB() ) K_PRESTAA_IMGA
           FROM  table
          UNION all
          SELECT  NVL(IMG_ESAME, EMPTY_BLOB() ) K_PRESTAA_IMGA
           FROM  table
         ) ) EE Thanks for any help

    from: http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_10002.htm#SQLRF01702
    DISTINCT | UNIQUE
    Specify DISTINCT or UNIQUE if you want the database to return only one copy of each set of duplicate rows selected. These two keywords are synonymous. Duplicate rows are those with matching values for each expression in the select list.
    Restrictions on DISTINCT and UNIQUE Queries These types of queries are subject to the following restrictions:
    When you specify DISTINCT or UNIQUE, the total number of bytes in all select list expressions is limited to the size of a data block minus some overhead. This size is specified by the initialization parameter DB_BLOCK_SIZE.
    You cannot specify DISTINCT if the select_list contains LOB columns.
    Regards
    Etbin
    Edited by: Etbin on 8.2.2012 16:25
    Look at the COMPARE functions within http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/d_lob.htm#i1016668

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

    getting error
    OPEN pio_cstdn_extract_cur FOR v_chr_sql;
    loop
    fetch pio_cstdn_extract_cur bulk collect into l_c1, l_c2, l_c3 limit l_limit;
    for i in 1 .. l_c1.count
    loop
    dbms_output.put_line( l_c1(i) || ',' || l_c2(i) || ',' || l_c3(i) );
    end loop;
    exit when pio_cstdn_extract_cur%notfound;
    end loop;
    close pio_cstdn_extract_cur;
    _______________________________________________

    select extractvalue(XMLTYPE('<rrr>13</rrr>'),'/rrr') from dual;

  • Oracle 10g Issue [ORA-00932: inconsistent datatypes: expected ]

    Hi,
    The following Code Snippet works fine in Oracle 9i DB but gives "ORA-00932: inconsistent datatypes: expected - got -; " error in 10g DB. We are facing lot of issues with this since we migrated application to 10g
    create or replace procedure cca is
    TYPE Cur_OPCols_Typ IS REF CURSOR;
    l_Cur_OPCols Cur_OPCols_Typ;
    str VARCHAR2(32767) :='select sysdate, 123 from dual';
    TYPE StringTyp IS TABLE OF VARCHAR2(7000) INDEX BY BINARY_INTEGER;
    capture StringTyp;
    BEGIN
         Open l_Cur_OPCols FOR str;
         FETCH l_Cur_OPCols BULK COLLECT INTO capture;
    dbms_output.put_line (capture.COUNT);
         Close l_Cur_OPCols;
    END cca;
    Please advise...
    Regards,
    Chinmay

    But...
    SQL> select * from v$version;
    BANNER
    Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
    PL/SQL Release 9.2.0.1.0 - Production
    CORE    9.2.0.1.0       Production
    TNS for Solaris: Version 9.2.0.1.0 - Production
    NLSRTL Version 9.2.0.1.0 - Production
    <br>
    <br>
    "afiedt.buf" 13 lines, 370 characters
      1  declare
      2   TYPE Cur_OPCols_Typ IS REF CURSOR;
      3   l_Cur_OPCols Cur_OPCols_Typ;
      4   str VARCHAR2(32767) :='select sysdate, 123 from dual';
      5   TYPE StringTyp IS TABLE OF VARCHAR2(7000) INDEX BY BINARY_INTEGER;
      6   capture StringTyp;
      7  BEGIN
      8   Open l_Cur_OPCols FOR str;
      9   FETCH l_Cur_OPCols BULK COLLECT INTO capture;
    10   dbms_output.put_line (capture.COUNT);
    11   Close l_Cur_OPCols;
    12* END cca;
    SQL> /
    declare
    ERROR at line 1:
    ORA-00932: inconsistent datatypes: expected - got -
    ORA-06512: at line 9                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for