incompatible data types: expected NUMBER got LONG

Version 3.2.20.09

Hello

I use SQL Developer and want to see trigger body using as a function but unfortunately its data type is long so that I get the error message, is there a way by which I can see the bodies of trigger...

Example query

TRIGGER_BODY

SELECT TRIGGER_BODY FROM user_triggers

WHERE TRIGGER_BODY LIKE '% HEAR. "

Error

ORA-00932: inconsistent data types: expected NUMBER got LONG

00932 00000 - ' incompatible data types: wait %s %s got. "

* Cause:

* Action:

Error on line: column 2: 7

This isn't a matter of SQL Developer.  Access quick, but partial, the answer is that the display of a LONG column in SQL * more / developer SQL can be done by issuing just one

1000 long - value (or some other, more)

You are referencing a LONG in a WHERE clause, however, is absolutely forbidden as I know.  Maybe something new (System invisible columns generated in LONG columns in the data mirrored dictionary?) are available in 12 c, but disapproval of LONG was announced in Oracle 8 in favour of the LOBs.

Anyway, if you do not want to ask this question in the forum of PL/SQL, see solution code of Laurent Schneider in this old debate...

Search long data type in the column

Tags: Database

Similar Questions

  • incompatible data types: expected - got CHAR, variable connection see detail

    Hello.
    Here's my problem:
    I have connected with a link master detail views. Variable binding that contain both have some session information views:
    It is a menu on the database and I'm trying to hide certain values based on the permissions of the user.
    When you run the application module, everything works fine. The problem occurs when I try to display the menu as a picture of the tree, or any other table, on a page.
    The root view runs correctly, but then I get a
    "java.sql.SQLSyntaxErrorException: ORA-00932: inconsistent data types: expected - got TANK.
    error in the method executeQueryForCollection of the detail view. (this method is overridden)

    Bind Variables are:
    -: menuRoot-> that contains the value of the root node. (In the Details view, it is just a dummy variable. It is explained later why I used it.)
    -: listOfUserPermmission-> permissions of the user table.

    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. see link that connects the master. CHILD_ID and detail PARENT_ID

    3 detail view, then linking 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, which connects CHILD_ID and PARENT_ID from this point of view 'detail '.

    Two views executeQuery methods are overridden to define Bind variables before execution.
    I get an arrayList of strings (permissions) of session and then convert it to a table.

    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 define bind variables (issues).
    So when I did use the variable menuRoot in Details view I had the
    ' incompatible data types: expected - got TANK.
    error in the module of the application.

    prepareRowSetForQuery() has solved the problem for me. The binding variable is null and that was the reason for the error incompatible data type.
    Regarding the error of the tree-> it was a mistake in the definition of the cardinality.

  • -Error ORA-00932: inconsistent data types: expected TANK got the NUMBER

    Here is my report query...
    select 
    *
    from   DW_RFA_JOBDATA
    where  FINISH_TIME >= :P1_START_DATE 
    and FINISH_TIME < :P1_END_DATE
         AND RFA_FLAG = (CASE :P1_JOB_CLASSIFICATION WHEN '0' THEN 'LSF'
                                      WHEN '1' THEN 'NON-LSF' 
                                      ELSE RFA_FLAG END)
    The column data type RFA_FLAG is NUMBER(*,0)... I'm view RSA and RSA - not the area of selection, but I get the error ORA-00932: inconsistent data types: expected TANK got the NUMBER >

    I have created a static LOV with LST display 0 return
    Display NON - RSA 1 return...

    Could any body please help me in truble shooting error? How to to convert the data type to number, I have no privileges to make changes to the table...

    Mark you my previous answer as correct? (MOST POINTS!  :))

  • ORA-00932: inconsistent data types: expected NUMBER obtained CURSER

    Hello

    I created a function that returns the cursor

    try to use the same report in

    Apex 4.2.3

    Select double hapx_details(:p5_brnach,:p5_remark)

    Help, please

    function is;

    create or replace function hapx_details
    (
    brcode in d009022.lbrcode%type,
    lheading in varchar2)
    return sys_refcursor
    is
    x_cursor   sys_refcursor;
    vquery varchar2(1000);
    begin
       if upper(trim(lheading))='TERMDEPOSITS' THEN
       vquery:='select lbrcode,t_cust(lbrcode,prdacctid) custno,short_acno(prdacctid) acno,ACNAME(LBRCODE,PRDACCTID) NAME,t_ost_new(lbrcode,prdacctid,SYSDATE) bal from dep_mast where lbrcode=brcode';
       elsif upper(trim(lheading))='ADVANCES' THEN
       VQUERY:='SELECT LBRCODE,CUSTNO,SHORT_ACNO(LBRCODE,PRDACCTID)ACNO,NAMETITLE,LONGNAME NAME ,t_ost_new(lbrcode,prdacctid,SYSDATE) bal FROM ac_mast WHERE LBRCODE=BRCODE AND (LBRCODE,TRIM(SUBSTR(PRDACCTID,1,8))) IN (SELECT LBRCODE,TRIM(PRDCD) FROM D009021 WHERE MODULETYPE IN (13,14,30)) AND ACCTSTAT<>3';
       ELSE
       VQUERY:='SELECT LBRCODE,CUSTNO,SHORT_ACNO(LBRCODE,PRDACCTID)ACNO,NAMETITLE,LONGNAME NAME,t_ost_new(lbrcode,prdacctid,SYSDATE) bal FROM ac_mast WHERE LBRCODE=BRCODE AND (LBRCODE,TRIM(SUBSTR(PRDACCTID,1,8))) IN (SELECT LBRCODE,TRIM(PRDCD) FROM D009021 WHERE MODULETYPE IN (11,12)) AND ACCTSTAT<>3';
       END IF;
    --
       OPEN X_CURSOR FOR
       VQUERY;
       RETURN X_CURSOR;
    END HAPX_DETAILS;
    
    
    

    The proper way is to define a function that returns the SQL statement (with bind variable) Apex need to run to the region to report.

    Say you have a region that reports of departments (Department variable is zero) or employed in a service (Department non-null variable).

    You have a page element called P1_DEPT that specifies the Department.

    You create the function call following the report:

    () MyDynamicReport

    depatvalue =>: P1_DEPT,-value of variable in apex

    deptvariable-online "P1_DEPT" - the apex variable name

    );

    The function can now determine what is SQL and who will return to the Apex engine for processing:

    create or replace function MyDynamicReport (deptValue number, deptVar varchar2) return varchar2 is

    sqlQuery varchar2 (1000);

    Start

    If deptValue is null then

    -no service selected, so ask all the departments

    sqlQuery: = ' select * from dept by dept_id';

    on the other

    -service selected, so display employees in the Department

    -(and use the link provided in the SQL query variable)

    sqlQuery: = ' select * from emp where dept_id = :'|| deptVar | "order by emp_id;

    end if;

    return (sqlQuery);

    end;

    When you create a ref cursor, you pass the VALUE of the variable for the ref cursor to be used as a variable binding.

    With a dynamic query Apex, you must pass the NAME of the variable for the function to use and add in the text of the dynamic query.

    To using a function table of pipeline to do this, is rather silly.

  • ORA-00932: inconsistent data types: expected NUMBER obtained DATE

    Hi all

    I have problem in the creation of report of the foregoing, it is can someone help me in this.

    Here is the code

    -------------------------

    Select ar_tab.account_number,

    ar_tab.party_name,

    ar_tab.trans_type,

    ar_tab.trans_type_name,

    ar_tab.invoice_currency_code,

    ar_tab.trx_num,

    ar_tab.trans_date,

    ar_tab.gl_date,

    ar_tab.due_date,

    (nvl (ar_tab.fcy_amt, 0) - nvl (ar_tab.ar_fcy_amt_due, 0)) outstanding_amount,.

    (case when trunc(:p_to_date) - trunc (ar_tab.trans_date) < = 0 then (ar_tab.inr_amt - ar_tab.ar_acctd_amt_due) end else 0) current_bal

    of (hca.account_number select account_number,)

    Party_name HP.party_name,

    CTA.customer_trx_id customer_trx_id,-, acl.name, collector_name

    Decode (ps.class,

    "INV', 'the Bill."

    "MD", "Débit Memo"

    "CM", "Credit memo")

    trans_type,

    rctt. Name trans_type_name,

    rctt.cust_trx_type_id cust_trx_type_id,

    CTA.invoice_currency_code invoice_currency_code,

    Hou.location_code location_code,

    PS.trx_number trx_num,

    PS.trx_date trans_date,

    PS.gl_date gl_date,

    PS.due_date end_date,

    PS.amount_due_original fcy_amt,

    round ((ps.amount_due_original * nvl (ps.exchange_rate, 1)), 2) inr_amt.

    PS.exchange_rate exchange_rate,

    PS.amount_due_remaining amount_due_remaining_fcy,

    PS.acctd_amount_due_remaining amount_remaining_inr,

    (select round (sum (nvl (a.amount_applied * nvl (ps.exchange_rate, 1), 0)), 2))

    of ar_receivable_applications_all one

    where a.applied_payment_schedule_id = ps.payment_schedule_id

    -a.APPLIED_CUSTOMER_TRX_ID = ps. CUSTOMER_TRX_ID

    and a.display = 'Y '.

    and trunc (a.gl_date) between: p_from_date and: p_to_date

    Group of a.applied_payment_schedule_id)

    ar_acctd_amt_due,

    (select round (sum (nvl (a.amount_applied, 0)), 2))

    of ar_receivable_applications_all one

    where a.applied_payment_schedule_id = ps.payment_schedule_id

    and a.display = 'Y '.

    and trunc (a.gl_date) between: p_from_date and: p_to_date

    Group of a.applied_payment_schedule_id)

    ar_fcy_amt_due

    of apps.ar_payment_schedules_all ps,.

    Apps.hz_cust_accounts AOB,

    HP apps.hz_parties,-, acl apps.ar_collectors

    Apps.ra_customer_trx_all cta,

    Apps.ra_cust_trx_types_all rctt,

    hr_organization_units_v hou

    where hca.cust_account_id = ps.customer_id

    and ps.customer_trx_id = cta.customer_trx_id

    and cta.cust_trx_type_id = rctt.cust_trx_type_id

    and ps.class <>"LMP".

    and hca.account_number = nvl (: p_cust_code, hca.account_number)

    and ps.class = nvl (: p_class, ps.class)

    and ps.class in ('INV', 'DM')

    and cta.invoice_currency_code <>'INR '.

    and hou.organization_id = cta.org_id

    and cta.org_id = nvl (: p_org_id, cta.org_id)

    and hp.party_id = hca.party_id

    and ps.invoice_currency_code <>'INR '.

    and rctt.org_id = cta.org_id

    and ps.amount_adjusted is null - added July 10, 2012

    and trunc (ps.gl_date) between nvl (: p_from_date, trunc (ps.gl_date))

    and nvl (: p_to_date, trunc (ps.gl_date))) ar_tab

    - AND AR_TAB. Amount_Remaining_INR <>0

    where (nvl (ar_tab.inr_amt, 0) - nvl (ar_tab.ar_acctd_amt_due, 0)) <>0

    OK well understood.

    But I asked you the query that you have changed as suggested by me.

    I guess you changed your query into a toad and copy then paste into the generator. So I want to check the query how you changed according to my suggestion.

    because, I've modified your request and took the new report and inserted, works very well.

  • ORA-00932: inconsistent data types: expected NUMBER INTERVAL

    How to overcome error mentioned topic for blowing the application


    Select b.corporationname, c.corporationname, a.nativeid as documentID, a.conversationid, a.doctimestamp,trunc(86400*(sysdate-a.doctimestamp)/60/60) BIZDOC hours, partner b, partner c where DOCTIMESTAMP < sysdate-1/24 and DOCTIMESTAMP > sysdate-3 and a.USERSTATUS = = b.partnerid 'Ramasasmy' and a.senderid and a.receiverid = c. partnerid order by hours desc



    Thank you
    REDA

    TIME will extract the hour of interval CURRENT_TIMESTAMP party - doctimestamp

    I agree that Solomon, if the INTERVAL given by CURRENT_TIMESTAMP - doctimestamp is greater than a day that it wouldn't work, thank you for the correction.

  • ORA-00932: inconsistent data types: expected DATE receipt NUMBER to call OIC OCIStmtExecute OBIEE 11g

    Hi friends,

    I get this error: ORA-00932: inconsistent data types: expected DATE got the NUMBER to the call of the OIC OCIStmtExecute when I'm putting the filter on the date column condition.

    "Sun Time". " Day' < = cast (MAX ("Sun time" "." ")) Date day")) and"Sun Time ". "' Day ' > = TIMESTAMPADD (SQL_TSI_MONTH,-1, cast (MAX ("Sun time".) "Day") as date). "

    I sank the date max, but if I get the above error. I think max (date) creates the problem.

    Please suggest your opinion on that.

    Thank you.

    Thank you for your suggestions.

    I used the variable, and it helped.

    "Sun Time". " Date' <= valueof(maxdate)="" and="" "dim-time"."date"="">= TIMESTAMPADD (SQL_TSI_MONTH-1, VALUEOF (Maxdate))

  • ADF: ORA-00932: inconsistent data types: expected - got TANK

    I get this error while casting. ORA-00932: inconsistent data types: expected - got TANK
    I had departments such as front number... .but must be able to take over the alpha characters... so I changed my Bind Variables in my model: Array string (decimal Big)

    This is the error:

    where dept in (SELECT * FROM TABLE (CAST (: depts AS glc.))) NUMTABTYPE)))

    How can I solve this?... probably need to delete interpreters from here... .but how I it... any help is appreciated.

    I also Type:
    create or replace TYPE NUMTABTYPE in the TABLE to the number; (also I tried to change this option for create or replace TYPE NUMTABTYPE in the TABLE to the varchar2 (200);)

    I changed the table to a string and

    [oracle.jbo.domain.Number]"with java.lang.String to support also supports departments alpha characters... dept can be AB123 (string) or 3344 (number only)

    The entire query
    ============
    SELECT * FROM (SELECT
    NVL ("DEPT", "Grand Total") as DEPT,
    PERIOD_YEAR,
    In summary (round ("Jan real CDA")) 'real Jan CDA. "
    In summary (round ("Feb real CDA")) 'Feb CDA real. "
    In summary (round ("Mar real CDA")) 'Mar CDA real. "
    In summary (round ("Apr CDA")) real 'Real CDA Apr',
    In summary (round ("peut CDA")) real "can actual CDA."
    In summary (round ("Jun real CDA")) 'Jun CDA real. "
    sum (round ("Jul real CDA")) 'Real CDA Jul',
    In summary (round ('Aug real CDA")) 'Aug CDA real."
    In summary (round ("Ms real CDA")) 'Ms CDA real. "
    In summary (round ("Oct real CDA")) 'Oct CDA real. "
    In summary (round ("Nov real CDA")) 'real CDA Nov. "
    In summary (round ('Dec real CDA")) 'Dec CDA real."
    In summary (round ("Jan CDA Budget")) 'Budget of CDA Jan. "
    In summary (round ("Feb CDA Budget")) 'Feb CDA Budget. "
    In summary (round ("Mar CDA Budget")) 'Mar CDA Budget. "
    In summary (round ("Apr CDA Budget")) 'Apr CDA Budget. "
    In summary (round ("can CDA Budget")) 'Budget of CDA can. "
    In summary (round ("Jun CDA Budget")) 'Jun CDA Budget. "
    In summary (round ("Jul CDA Budget")) 'Jul CDA Budget. "
    In summary (round ("Aug CDA Budget")) 'Aug CDA Budget. "
    In summary (round ("Sep CDA Budget")) 'Ms CDA Budget. "
    In summary (round ("Oct CDA Budget")) 'Oct CDA Budget. "
    In summary (round ("Nov CDA Budget")) 'Nov CDA Budget. "
    In summary (round ("CDA Budget Dec")) 'Dec CDA Budget. "
    In summary (round ('Total Budget uncorrected')) "Annual_Budget."
    In summary (round ("Total Budget")) "Revised_BUDGET."
    sum (round ("real CDA")) "YTD_ACTUALS."
    In summary (round ("Jan Actual")) "Jan_ACTUAL."
    In summary (round ('Jan Budget')) "Jan_BUDGET."
    In summary (round ("Jan Actual")) "JanYTDACTUAL."
    In summary (round ('Jan Budget')) "JanYTDBUDGET."
    sum (round ("real Feb")) "Feb_ACTUAL."
    In summary (round ('Feb Budget')) "Feb_BUDGET."
    sum (round ("real Mar")) "Mar_ACTUAL."
    In summary (round ("Budget de Mar")) "Mar_BUDGET."
    sum (round ("real Apr")) "Apr_ACTUAL."
    In summary (round ("Apr Budget")) "Apr_BUDGET."
    In summary (round ("can real")) "May_ACTUAL."
    In summary (round ("Budget can")) "May_BUDGET."
    sum (round ("real Jun")) "Jun_ACTUAL."
    In summary (round ('Jun Budget')) "Jun_BUDGET."
    sum (round ("real Jul")) "Jul_ACTUAL."
    In summary (round ('Jul Budget')) "Jul_BUDGET."
    sum (round ("real Aug")) "Aug_ACTUAL."
    In summary (round ('Aug Budget')) "Aug_BUDGET."
    sum (round ("real Sep")) "Sep_ACTUAL."
    In summary (round ('Ms Budget')) "Sep_BUDGET."
    sum (round ("real Oct")) "Oct_ACTUAL."
    In summary (round ('Oct Budget')) "Oct_BUDGET."
    sum (round ("real Nov")) "Nov_ACTUAL."
    In summary (round ('Nov Budget')) "Nov_BUDGET."
    sum (round ("real Dec")) "Dec_ACTUAL."
    In summary (round ("Dec Budget")) "Dec_BUDGET."
    sum (round ("Jan Budget" + "Jan Budget Adj")) "Jan_Budget_Orig."
    sum (round ("Budget Feb" + "Feb Budget Adj")) "Feb_Budget_Orig."
    sum (round ("Mar Budget" + "Mar Budget Adj")) "Mar_Budget_Orig."
    sum (round ("Apr Budget" + "After Budget Adj")) "Apr_Budget_Orig."
    sum (round ("Budget can" + "Can Budget Adj")) "May_Budget_Orig."
    sum (round ("Jun Budget" + "Jun Budget Adj")) "Jun_Budget_Orig."
    sum (round ("Jul Budget" + "Jul Budget Adj")) "Jul_Budget_Orig."
    sum (round ("Aug Budget" + "August Budget Adj")) "Aug_Budget_Orig."
    sum (round ("Ms Budget" + "Ms Budget Adj")) "Sep_Budget_Orig."
    sum (round ("Oct Budget" + "Oct Budget Adj")) "Oct_Budget_Orig."
    sum (round ("Budget Nov" + "Nov Budget Adj")) "Nov_Budget_Orig."
    sum (round ('Dec Budget '' + '' Dec Budget Adj")) 'Dec_Budget_Orig '.
    GLC. GLC_BUDANAL_ACT_BUD_ADJ_VAR_V mainanal
    where dept in (SELECT * FROM TABLE (CAST (: depts AS glc.))) NUMTABTYPE))) and period_year =: year and substr ("OBJECT", 1, 3). =: excludeObject
    and mainanal. FERC not like 4% '
    Group by the Department, period_year) QRSLT ORDER BY DEPT

    As you say your table does not number but the strings. If you must change the table in an array of strings.

    Timo

  • ORA-00932: inconsistent data types: expected - got CURSER

    Hi all

    I created a function and tried to run SQL Plus, but I get an error

    ORA-00932: inconsistent data types: expected - got CURSER

    I tried to debug for centuries, but are unable to the root of what could be the problem. I'd appreciate any help or idea people could offer

    The only consolation I take from this is that Oracle have typo in one of their error messages :)



    SQL MORE CODE
    select * FROM TABLE(CAST(tsoraimpdb.QueryAuthorsFunc(116, 1, -1, 1, 0) as tsoraimpdb.ENTITYIDTABLE));
    THE 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;

    You cannot get the ref cursor in a table like this. Either use a PL/SQL program to extract the lines of ref cursor and display them via dbms_output.put_line (or something) or load the results into a collection and then cast the collection in a table in your select statement.

  • -Error function of incompatible data types

    Hi all

    I created a function that will take 3 IN parameters and return the result in type. Here's the code.

    Created a table type:

    {code}

    CREATE OR REPLACE TYPE FEATURES_ROW_TYPE

    AS AN OBJECT

    (VARCHAR2 (100) OF THE ENVIRONMENT)

    MNR VARCHAR2 (100),

    GUID VARCHAR2 (100),

    USER_ID VARCHAR2 (1000).

    RGN VARCHAR2 (100),

    RGN_NM VARCHAR2 (5000).

    FEATURE_NAME VARCHAR2 (5000).

    DATE OF LAST_SIGON_DATE

    );

    CREATE OR REPLACE TYPE FEATURES_TABLE_TYPE

    AS THE FEATURES_ROW_TYPE TABLE;

    {code}

    Here's the function:

    {code}

    CREATE OR REPLACE FUNCTION FETCH_FEATURES_FN (P_ENVIRONMENT IN VARCHAR2,

    P_FEATURE_ID NUMBER,

    P_RGN IN VARCHAR2

    )

    RETURN FEATURES_TABLE_TYPE

    IS

    V_ROWS FEATURES_TABLE_TYPE: = FEATURES_TABLE_TYPE ();

    V_CUR_ENV VARCHAR2 (100);

    V_ENV VARCHAR2 (50);

    V_WHERE VARCHAR2 (1000);

    V_SQL VARCHAR2 (10000);

    BEGIN

    V_ENV: = '@DBL_ ' | P_ENVIRONMENT;

    V_CUR_ENV: = P_ENVIRONMENT;

    IF P_RGN = "ALL" THEN

    V_WHERE: = ' WHERE FD. WPP_FTR_IK = ' | P_FEATURE_ID;

    ON THE OTHER

    V_WHERE: = ' WHERE FD. WPP_FTR_IK = ' | P_FEATURE_ID | "AND FD. RGN = ' | '''' || P_RGN | '''';

    END IF;

    V_SQL: =.

    "WITH USER_DATA ' | ' ' ||

    "ACE" | ' ' ||

    ' (SELECT DISTINCT EB. GUID, AD. USER_ID_ACCT_AFFECTED AS USER_ID, MAX (TRANSACTION_TS) AS LAST_SIGNON_DATE ' | ' ' ||

    "TO WPP_EBIZ_ACCT" | V_ENV | '  EB'                                                                || ' ' ||

    "INNER JOIN WPP_SECURITY_AUDIT_LOG | V_ENV | ' AD'                                                   || ' ' ||

    ' ON EB. GUID = AD. USER_UNIQUE_ID_ACCT_AFFECTED ' | ' ' ||

    ' WHERE AD. APP_NAME = "consumer" AND AD. TRANSACTION_TYPE_CD = "SIGN_ON" AND AD. FEATURE_NAME = "sign" AND AD. TRANSACTION_RESULT_CD = "S" ' | ' ' ||

    ' GROUP BY EB. GUID, AD. USER_ID_ACCT_AFFECTED ' | ' ' ||

    '), ' || ' ' ||

    "FEATURE_DATA" | ' ' ||

    'AS '           || ' ' ||

    "(MY SEPARATE SELECT." MNR, EB. GUID, MY. RGN, RGN. RGN_NM, FTR. WPP_FTR_IK, FTR. NM AS FEATURES_SUPPORTED ' | ' ' ||

    "TO WPP_MBRSHP_ACCT" | V_ENV | "MY" | ' ' ||

    "INNER JOIN WPP_EBIZ_ACCT | V_ENV | ' EB WE MY. WPP_EBIZ_ACCT_IK = EB. WPP_EBIZ_ACCT_IK' | ' ' ||

    "INNER JOIN WPP_RGN | V_ENV | «RGN WE MY.» RGN = RGN. RGN_ID ' | ' ' ||

    "INNER JOIN WPP_RGN_APLCTN_STS | V_ENV | ' RGN_ST ON RGN_ST. RGN_ID = RGN. RGN_ID ' | ' ' ||

    "INNER JOIN WPP_FTR_APLCTN | V_ENV | ' FTR_APP ON FTR_APP. WPP_FTR_APLCTN_IK = FTR_APP. WPP_FTR_APLCTN_IK ' | ' '||

    "INNER JOIN WPP_FTR | V_ENV | "FTR ON FTR. WPP_FTR_IK = RDFS. WPP_FTR_IK' | ' ' ||

    ') ' || ' ' ||

    "SELECT DISTINCT"HINT1"LIKE ENVIRONMENT, | ' ' ||

    "FD. MNR, FD. GUID, UD. USER_ID, FD. RGN, FD. RGN_NM, FD. FEATURES_SUPPORTED ACE FEATURE_NAME, TO_DATE (TRUNC (UD. LAST_SIGNON_DATE)) AS LAST_SIGNON_DATE' | ' ' ||

    "FROM FEATURE_DATA INNER JOIN USER_DATA UD ON FD FD. GUID = UD. GUID ' | ' ' || V_WHERE;

    -DBMS_OUTPUT. PUT_LINE (V_SQL);

    RUN IMMEDIATELY V_SQL

    BULK COLLECT INTO V_ROWS;

    RETURN V_ROWS;

    END FETCH_FEATURES_FN;

    {code}

    When I tried to run as below.

    SELECT * FROM TABLE (FETCH_FEATURES_FN ('HINT1', 2, 'ALL'));

    but I get the error message

    ORA-00932: inconsistent data types: expected - was -.

    ORA-06512: at "KPGCPY. FETCH_FEATURES_FN', line 57

    00932 00000 - ' incompatible data types: wait %s %s got. "

    * Cause:

    * Action:

    Please guide to solve this problem.

    Thank you

    So after running actual query:

    -DBMS_OUTPUT. PUT_LINE (V_SQL);

    You said the line that will do.

    Firstly - I suggest replace this long, complex query with a VERY SIMPLE one until your code actually works.

    When you do this, you will see that the TYPE that you defined (FEATURES_ROW_TYPE) is NOT mentioned anywhere in your code.

    You need create instances of this TYPE, then a collection of these instances.

    Some EXAMPLES of code that shows what I mean by VERY SIMPLE and shows how interrogate instances of a TYPE in a collection

    -type to match record emp

    create or replace type emp_scalar_type as an object

    (EMPNO NUMBER 4,

    ENAME VARCHAR2 (10),

    USE VARCHAR2 (9).

    MGR NUMBER 4,

    HIREDATE DATE,

    NUMBER OF SAL (7, 2)

    NUMBER OF COMM (7, 2)

    DEPTNO NUMBER (2)

    )

    /

    -records of the emp table

    create or replace type emp_table_type to table of emp_scalar_type

    /

    declare

    TB emp_table_type;

    sys deptnoList. OdciNumberList;

    BEGIN

    Select emp_scalar_type (empno, ename, job, mgr, hiredate, sal, comm, deptno)

    bulk collect into tb emp;

    Collect SELECT deptno in bulk

    IN deptnoList

    DEPARTMENT where deptno not in (select deptno table (tb));

    I'm looping 1.deptnoList.count

    dbms_output.put_Line (deptnoList (i));

    end loop;

    END;

    40

    Try this code and work with it until you understand what makes each piece.

    Select emp_scalar_type (empno, ename, job, mgr, hiredate, sal, comm, deptno)

    bulk collect into tb emp;

    See how this SIMPLE query creates instances of the EMP_SCALAR_TYPE and then use COLLECT in BULK to put them in the collection?

    Modify your code to use a SIMPLE QUERY like in my example, until you get the code to work.

  • Incompatible data type problem in the ADF

    Hello

    I'm new to ADF. I'm writing a logic in the implementation of the entity class.
    The logic contains below two lines.

    Integer itemQty = row.getQuantity ();
    Number Qty = (Number) (itemQty);

    However when compiling, error comes which says 'incompatible data types' that is the integer and the number are not compatible.
    Please let me how can know I convert an integer in Number type.

    Thank you
    Anuj
    Integer  itemQty = row.getQuantity();
    oracle.jbo.domain.Number n= null;
        try
        {
          n = new oracle.jbo.domain.Number(itemQty);
        }
        catch (SQLException e)
        {
          //handle the exception here.
        }  
    

    But why do you need to cast to oracle.jbo.domain.Number?

  • Insert the ROWNUM in a column of data type of NUMBER table

    Hello

    I have a table that has a column named "rank" of the NUMBER data type. Basically, I want to make an analysis of top-n and insert the ROWNUM with other columns in the table.

    Definition of table1:

    CREATE TABLE

    (

    col1 VARCHAR2 (10),

    Col2 NUMBER,

    NUMBER of col3,

    rank NUMBER

    );

    INSERT INTO table1

    SELECT col1, col2, col3, rownum

    DE)

    SELECT col1, col2, col3

    FROM table2

    ORDER BY DESC of col3

    )

    WHERE rownum < = 5;

    I get an error ORA-01722: invalid number. I think the mistake is virtual ROWNUM is not data type of NUMBER, so I tried to cast as CAST (ROWNUM AS NUMBER), but it does not work, same error. Can can you please shed some light on how to convert a ROWNUM number or if the issue is something else.

    you're right, your example worked. It is an example of table I just created just to illustrate the problem, but my real table was always showing the same problem. Weird, isn't? However when I added the column names after that insert the question but statement I resolved. Adding code

    INSERT INTO TABLE1

    (col1, col2, col3, rank) - added

    SELECT col1, col2, col3, rownum

    DE)

    SELECT col1, col2, col3

    FROM table2

    ORDER BY DESC of col3

    )

    WHERE rownum<=>

    So that means ROWNUM returns number; and another confusion: why the inclusion of the column has solved my problem when it is not necessary for your example. in any case thank you.

  • Change the data type of number (1) to number (3)

    Y at - it a command to change the data type for an existing column? I just need to go long number 1 to 3... or I have to delete column and then use Edit to add the new field?

    Thank you
    Mark

    Hello

    alter table  modify  NUMBER(3);
    

    Kind regards

  • incompatible data type

    Hi iam new on oracle plsql,.

    I have small precision please help me in this.


    CREATE or REPLACE TYPE emp_type2 AS OBJECT

    (empno NUMBER (4));

    CREATE OR REPLACE TYPE T_EMP_TYPE AS TABLE EMP_TYPE2;

    CREATE OR REPLACE PROCEDURE test12 (pout on t_emp_type)

    AS

    BEGIN

    -Emp_type2 (e.empno) SELECT COLLECT LOOSE pout OF emp e; - updated successfully

    Emp_type2 (e.EMPNO) SELECT INTO emp e pout; - getting error below

    END;

    =====================================================================================

    • Error (6.1): PL/SQL: statement ignored
    • Error (6,8): PL/SQL: ORA-00932: inconsistent data types: waiting for the TEST. EMP_TYPE2's TEST. T_EMP_TYPE

    =====================================================================================

    Please explain to me why this statement error SELECT emp_type2 (e.EMPNO) INTO pout of emp e;

    Thank you

    RAMU.

    -Emp_type2 (e.empno) SELECT COLLECT LOOSE pout OF emp e; - updated successfully

    Emp_type2 (e.EMPNO) SELECT INTO emp e pout; - getting error below


    The TYPE is the data type that can contain multiple lines.

    So by the way of multiple lines between two TYPES of needs COLLECT LOOSE (here IN won't work, INTO used to Exchange simple rows)

    That's why your 1st statement is t is successful. and the statement with INTO is a failure.

  • Problem with the incompatible data type

    Hi all

    I wrote this query and trying to run it and got the following error.

    I got this error when I add column.if description I do not add the description column query works fine. _

    Attempted to solve by other means but did not work.

    Please help on this.

    SELECT the description, product, /*Defect.Product*/
    TO_CHAR (BG_DETECTION_DATE, 'yyyy') year,
    TO_CHAR (BG_DETECTION_DATE, 'Q'). ' Q'Quarter
    BUG
    where service_type as "Incident".
    and produced in ("Siebel", "Intg_Mgmt", "SOA", "NICE", "Genesys", "DW Analytics")
    AND DETECTION_DATE
    BETWEEN TO_DATE('01-01-2009','MM-DD-YYYY')
    AND TO_DATE (OCTOBER 30, 2010 ","DD-MM-YYYY")

    Group of to_char(bg_detection_date,'yyyy'), to_char(bg_detection_date,'Q'),
    product, description

    order by product, year desc, asc quarter


    error: ORA-00932: given inconsistent type.expected get clob_

    Try to replace every occurrence of "description" by 'dbms_lob.substr (description, 100, 1)' in your query, for example.

    It of OK if you want to show how only and group using the first 100 characters of the column "description".

Maybe you are looking for