The INSTR function in where clause

Hello

I need to check if part of the separate past comma is there in one of the values of table column, if its present, then I need to go looking for this file in the same table.

Example of
--------
Table1:

col1 col2
-----------
01 john
Raj 02

and I'm passing '02,04,06' as the value of parameter input and according to this value, I need to check in a table and get a record.

procedure p1 (v_string varchar2)
is
Select col1, col2
in a, b
FROM table1
where instr (v_string, - here I need to apply the logic

end;

output
------
Raj 02

Please help me with this logic

RDS,
Naga
instr(','||v_string||',',','||col1||',') > 0

Nicolas.

Tags: Database

Similar Questions

  • Using the index function in where clause of Exchange.

    Hello friends,

    I need your help with a problem.

    I have a query that uses two table Say T1 and T2, where C1 is common column with which both are joined.
    C1 is the primary key in T1, but no index available in Q2 for the C1. T1C2 is the column that we want to select.
    (Note that table may be a Master table)

    Now let's see the query:
    Select T1C2
    From T1, T2
    where T2. C1 = T1. C1

    Here where the clause may have other conditions and From clause can have other tables as needed.

    I want to know that if I have change the query as continuation of leave my query to use the index available of T1. C1.

    Select T1C2
    from T1, T2
    where T1. C1 = T2.C1

    Then, the query uses the index available of T1. and I get better performance. Even a small improvement of performance help me much because this type of query is used in a loop where clause (so it will be run several times).

    Please advise on this...

    Kind regards
    Lifexisxnotxsoxbeautiful...

    Hello

    18:43:17 rel15_real_p>create table t1(c1 number primary key, c2 number);
    
    Table created.
    
    18:43:26 rel15_real_p>create table t2(c1 number, c2 number);
    
    18:45:08 rel15_real_p>
    18:45:09 rel15_real_p>begin
    18:45:09   2  for i in 1..100
    18:45:09   3  loop
    18:45:09   4        insert into t1(c1,c2) values (i,i+100);
    18:45:09   5  end loop;
    18:45:09   6  commit;
    18:45:09   7  end;
    18:45:09   8  /
    
    PL/SQL procedure successfully completed.
    
    18:45:09 rel15_real_p>
    18:45:09 rel15_real_p>
    18:45:09 rel15_real_p>begin
    18:45:09   2  for i in 1..100
    18:45:09   3  loop
    18:45:09   4        insert into t2(c1,c2) values (i,i+200);
    18:45:09   5  end loop;
    18:45:09   6  commit;
    18:45:09   7  end;
    18:45:09   8  /
    
    18:45:23 rel15_real_p>select count(*) from t1;
    
      COUNT(*)
    ----------
           100
    
    18:45:30 rel15_real_p>select count(*) from t2;
    
      COUNT(*)
    ----------
           100
    
    18:45:49 rel15_real_p>select index_name,index_type from user_indexes where table
    _name='T1';
    
    INDEX_NAME                     INDEX_TYPE
    ------------------------------ ---------------------------
    SYS_C0013059                   NORMAL
    
    18:48:21 rel15_real_p>set autotrace on
    18:52:25 rel15_real_p>Select T1.C2
    18:52:29   2  From T1, T2
    18:52:29   3  where T2.C1 = T1.C1
    18:52:29   4  /
    
            C2
    ----------
           101
           102
           103
           104
           105
      .....
      ......
    
            C2
    ----------
           200
    
    100 rows selected.
    
    Execution Plan
    ----------------------------------------------------------
       0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=7 Card=100 Bytes=
              900)
    
       1    0   HASH JOIN (Cost=7 Card=100 Bytes=3900)
       2    1     TABLE ACCESS (FULL) OF 'T1' (TABLE) (Cost=3 Card=100 By
              es=2600)
    
       3    1     TABLE ACCESS (FULL) OF 'T2' (TABLE) (Cost=3 Card=100 By
              es=1300)
    
    Statistics
    ----------------------------------------------------------
              0  recursive calls
              0  db block gets
             21  consistent gets
              0  physical reads
              0  redo size
           1393  bytes sent via SQL*Net to client
            562  bytes received via SQL*Net from client
              8  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
            100  rows processed
    
    18:52:31 rel15_real_p>analyze table t1 compute statistics;
    
    Table analyzed.
    
    18:55:35 rel15_real_p>analyze table t2 compute statistics;
    
    18:55:38 rel15_real_p>set autotrace on
    18:55:42 rel15_real_p>Select T1.C2
    18:55:43   2  From T1, T2
    18:55:45   3  where T2.C1 = T1.C1
    18:55:46   4  /
    
            C2
    ----------
           101
           102
           103
           104
           105
    
      .....
      ......
    
            C2
    ----------
           200
    
    100 rows selected.
    
    Execution Plan
    ----------------------------------------------------------
       0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=6 Card=100 Bytes=7
              00)
    
       1    0   MERGE JOIN (Cost=6 Card=100 Bytes=700)
       2    1     TABLE ACCESS (BY INDEX ROWID) OF 'T1' (TABLE) (Cost=2 Ca
              rd=100 Bytes=500)
    
       3    2       INDEX (FULL SCAN) OF 'SYS_C0013059' (INDEX (UNIQUE)) (
              Cost=1 Card=100)
    
       4    1     SORT (JOIN) (Cost=4 Card=100 Bytes=200)
       5    4       TABLE ACCESS (FULL) OF 'T2' (TABLE) (Cost=3 Card=100 B
              ytes=200)
    
    Statistics
    ----------------------------------------------------------
              1  recursive calls
              0  db block gets
             23  consistent gets
              0  physical reads
              0  redo size
           1393  bytes sent via SQL*Net to client
            562  bytes received via SQL*Net from client
              8  SQL*Net roundtrips to/from client
              1  sorts (memory)
              0  sorts (disk)
            100  rows processed
    
    18:56:56 rel15_real_p>Select T1.C2
    18:56:56   2  From T1, T2
    18:56:56   3  where T1.C1 = T2.C1
    18:56:58   4  /
    
            C2
    ----------
           101
           102
           103
           104
           105
    
      .....
      ......
    
            C2
    ----------
           200
    
    100 rows selected.
    
    Execution Plan
    ----------------------------------------------------------
       0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=6 Card=100 Bytes=7
              00)
    
       1    0   MERGE JOIN (Cost=6 Card=100 Bytes=700)
       2    1     TABLE ACCESS (BY INDEX ROWID) OF 'T1' (TABLE) (Cost=2 Ca
              rd=100 Bytes=500)
    
       3    2       INDEX (FULL SCAN) OF 'SYS_C0013059' (INDEX (UNIQUE)) (
              Cost=1 Card=100)
    
       4    1     SORT (JOIN) (Cost=4 Card=100 Bytes=200)
       5    4       TABLE ACCESS (FULL) OF 'T2' (TABLE) (Cost=3 Card=100 B
              ytes=200)
    
    Statistics
    ----------------------------------------------------------
              1  recursive calls
              0  db block gets
             23  consistent gets
              0  physical reads
              0  redo size
           1393  bytes sent via SQL*Net to client
            562  bytes received via SQL*Net from client
              8  SQL*Net roundtrips to/from client
              1  sorts (memory)
              0  sorts (disk)
            100  rows processed
    

    -Pavan Kumar N

  • I need a little help with the INSTR function

    Hello everyone,

    im still new to pl sql and experienced an issue with the INSTR function. I need to analyze some values of a CLOB containing the xml code and use INSTR to determine the beginning and end of the value, I would like to analyze.

    the data I need is in a <!-[CDATA [[Some Text]]]-> block. up to this point, I managed to take the start of the word, but I can't seem to capture the end of the CDATA block. I use this statement:

    POS: = INSTR (TO_CHAR (input_clob) [,'] ', pos2 + 6, 1);

    but it doesn't have the desired effect. [It seems to sort of go back to the length of the string, while the]-sign is actually in the xml file. my result would look to "Some Text]]--> < xmlxml >... < / xmlxml >...» ». [I tried to escape by writing ' \] "but if I do, the function returns zero and my parsed string is left blank.

    Unfortunately I can't use regular expressions, because I work with oracle 9.2i. Anyone know what I'm doing wrong?

    Thank you

    Edited by: user8719779 the 25.08.2009 02:23
    with my_tab as (select ''||chr(10)||
                           '  '||chr(10)||
                           '   '||chr(10)||
                           '  '||chr(10)||
                           '' col1 from dual)
    -- end of mimicking your data; USE SQL below:
    select substr(col1, instr(col1, '', 1, 1) - instr(col1, '
    SELECT * FROM table_1 t
    WHERE
    (
    -- Clause A (very long clause that filters a lot of rows)
    )
    AND f(t.field) = 'Y' -- This function is heavy but it should filter few rows
    

    This query, it is very slow because I think he's trying to evaluate f() for all rows in table_1.

    Howerver, if I have database query:

    SELECT f(t.field) FROM table_1 t
    WHERE
    (
    -- very long clause that filters a lot of rows
    )
    

    It's very fast.

    How can I reference the query to filter the lines of division A, then by function?

    Thanks in advance!

    If you wrap the function in a select clause then the optimizer can use a scalar subquery caching:

    SELECT * FROM table_1 t 

    WHERE  (  -- Clause A (very long clause that filters a lot of rows)  ) 

    AND (Select f(t.field) From Dual) = 'Y' -- This function is heavy but it should filter few rows

  • If the INSTR function will not use the INDEX o?

    Hi all


    I have a querry as
        Select * from Tab1 Where Instr(Tab1.Col1,'XX') >0 ;
    Is simple index on column Col1. If we use the index will be used or full table scan will happen in this scenario?

    Please give me explanatory answer because I have doubts


    Dhabas

    Hello

    You must use the index function if you want to avoid the full table scan. Check this box

    SQL> create table tab1(col1 varchar(20))
      2  /
    
    Table created.
    
    SQL> insert into tab1 values ('XXAB')
      2  /
    
    1 row created.
    
    SQL> create index col1_idx on tab1(col1);
    
    Index created.
    
    SQL> explain plan for Select * from Tab1 Where Instr(Tab1.Col1,'XX') >0;
    
    Explained.
    
    SQL> set autotrace on
    SQL> Select * from Tab1 Where Instr(Tab1.Col1,'XX') >0;
    XXAB
    
    Execution Plan
    ----------------------------------------------------------
       0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=5 Card=1 Bytes=12)
       1    0   TABLE ACCESS (FULL) OF 'TAB1' (TABLE) (Cost=5 Card=1 Bytes
              =12)
    
    Statistics
    ----------------------------------------------------------
              4  recursive calls
              0  db block gets
             32  consistent gets
              0  physical reads
              0  redo size
            234  bytes sent via SQL*Net to client
            280  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processed
    
    SQL>  create index col1_idx2 on tab1(Instr(Col1,'XX'));
    
    Index created.
    
    SQL> Select * from Tab1 Where Instr(Tab1.Col1,'XX') >0;
    XXAB
    
    Execution Plan
    ----------------------------------------------------------
       0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=2 Card=1 Bytes=12)
       1    0   TABLE ACCESS (BY INDEX ROWID) OF 'TAB1' (TABLE) (Cost=2 Ca
              rd=1 Bytes=12)
    
       2    1     INDEX (RANGE SCAN) OF 'COL1_IDX2' (INDEX) (Cost=1 Card=1
              )
    
    Statistics
    ----------------------------------------------------------
             28  recursive calls
              0  db block gets
             22  consistent gets
              0  physical reads
              0  redo size
            234  bytes sent via SQL*Net to client
            280  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processed
    
    SQL> 
    

    Thank you
    AJ

  • Conditional function on "where clause".

    Hi guys,.

    How can I get a condition with function on "where to?"

    something like that:

    Get-VM | where{@{N="Path";E={Get-Path -Object $_}} -Like "*SAP*"}
    

    I don't want to get a container with properties of select objects, I want to take an object.

    It works when I call the function Select-object level and then check the result in "where" column

    PS. Sorry for my English I'm not native.

    You could do something like that

    Get-VM | where{(Get-Path -Object $_) -Like "*SAP*"}
    

    But it depends on what the function Get-path is in effect?

    Is it returns a [string] object? If so, the above should work.

  • Best place to initialize the View object query where clause or params

    Where is the best place to initialize the View object 'where' clause before the page is initially rendered? Or how should it be done?
    Specifically, I can't set these values in the entity or view objects because I need information from the user or information Session
    the user has entered before you navigate to the page. I want to prepare the View object so that the results of the query appears something reasonable
    the first time before using chooses search.

    Note: The view object must exist and I need to access managed beans to define the query.

    Is there an event hook (java code) that can be called before the page is rendered?
    Also, there are hooks that can be called when the user navigates to another tab or page?

    Published by: Greateful Sep 6, 2012 19:48

    Hello

    Check out this blog: https://blogs.oracle.com/aramamoo/entry/an_epic_question_how_to

    Arun-

  • How to use the instruction box in where clause

    Hi all


    I need to use cases where clause guide me please how I can do it.


    AND WHEN BOX: KAPCO = "KAPCO" THEN cla. CLASS_NAME LIKE '% KAPCO % '.
    WHEN: KAPCO = "NON_KAPCO" THEN SUPERIOR (cla. CLASS_NAME) NOT LIKE '% KAPCO % '.
    WHEN: KAPCO = 'ALL' GOLD: KAPCO IS NULL SO SUPERIOR (cla. CLASS_NAME) LIKE '% '.
    END



    Concerning

    Published by: user10941925 on March 4, 2012 22:31

    Hello

    CASE expressions return a single value, for example a VARCHAR2. They do refer to code fragments.

    You usually don't need (or want) an expression BOX in a WHERE clause, or any other condition. I think that you were trying to do the equivalent of:

    AND     (     (:KAPCO = 'KAPCO'          AND cla.CLASS_NAME       LIKE '%KAPCO%')     -- Don't you want UPPER on this line?
         OR     (:KAPCO = 'NON_KAPCO'           AND UPPER(cla.CLASS_NAME) NOT LIKE '%KAPCO%')
         OR     (NVL (:KAPCO, 'ALL') = 'ALL'       AND cla.CLASS_NAME IS NOT NULL)
         )
    

    If you would care to post some sample data (CREATE TABLE and INSERT statements) and the results desired from this data, I was able to test this.

  • How to filter the result with a where clause clause?

    Hello

    I have a nice sql query. I would like to include a where clause with a joker clause.

    If the user selects for example a "AGENT_ID", then where clause would include the AGENT_ID, otherwise, every thing would appear.
    SELECT 
       "FICHE"."FICHE_ID" "FICHE_ID", 
       "FICHE"."AGENT_ID" "AGENT_ID", 
       "FICHE"."EQUIPE_ID" "EQUIPE_ID", 
       "FICHE"."DATE_ACTIVITE" "DATE_ACTIVITE", 
       "FICHE"."DATE_CREATION" "DATE_CREATION", 
       "FICHE"."TYPE_FICHE" "TYPE_FICHE", 
       "FICHE"."FICHE_CREE_PAR" "FICHE_CREE_PAR", 
       "FICHE"."TOTAL_HEURES" "TOTAL_HEURES", 
       "FICHE"."TOTAL_HEURES_EXCEPTIONNELLES" "TOTAL_HEURES_EXCEPTIONNELLES", 
       "FICHE"."DATE_MODIFICATION" "DATE_MODIFICATION"
    FROM 
       "FICHE"
    The WHERE clause:
    WHERE AGENT_ID = ' * ' if nothing is selected.

    WHERE AGENT_ID = "4290" If an agent ID is selected.

    Hope I'm clear that English is not my mother tongue.

    Thanks for you help.

    Christian

    Hello

    Try this

    WHERE "FICHE".AGENT_ID like NVL(:val, '%')
    

    see you soon

    VT

  • Need help with the INSTR function

    I try to use SUBSTR and INSTR function to parse a variable without breaking to the top of the variable. As you can see that the problem is space, negotiating
     
    DECLARE
         blank_space NUMBER(2);
         full_name VARCHAR2(30) := 'Robert P. Simmons');
         first_name VARCHAR2(30);
         last_name VARCHAR2(30);
         
    BEGIN 
         blank_space := INSTR(full_name, ' ');
         first_name := SUBSTR(full_name, 1, (blank_space -1));
         DBMS_OUTPUT.PUT_LINE( 'Your first name is ' || first_name);
         last_name := SUBSTR(full_name, (blank_space + 1),
         (LENGTH(full_name) - blank_space));                
         DBMS_OUTPUT.PUT_LINE( 'You have ' || 
         LENGTH(last_name) || ' characters in your last name!');
         
    END;     
    How can I enter the number of characters in name only? It lists just to the right of the 1st blank_space.

    Thank you
    SQL> declare
       blank_space   number (2);
       full_name     varchar2 (30) := 'Robert P. Simmons';
       first_name    varchar2 (30);
       last_name     varchar2 (30);
    begin
       blank_space := instr (full_name, ' ');
       first_name := substr (full_name, 1, (blank_space - 1));
       dbms_output.put_line ('Your first name is ' || first_name);
    
       dbms_output.put_line ('You have ' || length (substr (full_name, instr (full_name, ' ', -1) + 1)) || ' characters in your last name!');
    end;
    /
    Your first name is Robert
    You have 7 characters in your last name!
    PL/SQL procedure successfully completed.
    
  • Problem with Textfield autocomplete--&gt; only use the INSTR function

    Hello team dev,

    I use the new "textfield autocomplete" item type APEX and you have a crazy problem with it.

    I have a table with an index on the same column I want to search with AutoComplete field.

    Index:
    CREATE BITMAP INDEX TEST.GEO_DATA_IDX1 ON TEST.GEO_DATA (postcode)
    NOLOGGING TABLESPACE TS_INDEX;
    Select which is automatically generated by APEX 4:
    SELECT   a.*
      FROM   (  SELECT   DISTINCT postcode AS RV
                  FROM   TEST.GEO_DATA
                 WHERE   country_id = :P1_COUNTRY
              ORDER BY   1) a
     WHERE   INSTR ("RV", :p$_search_string) > 0 AND ROWNUM <= :p$_max_rows;
    
    -- plan
    Plan
    SELECT STATEMENT  ALL_ROWSCost: 4,308  Bytes: 45,31  Cardinality: 1,97            
         2 SORT UNIQUE  Cost: 4,307  Bytes: 45,31  Cardinality: 1,97       
              1 TABLE ACCESS FULL TABLE #TABLE# Cost: 4,306  Bytes: 47,311  Cardinality: 2,057  
    The APEX 3, I used the addon of Tyler Muth with my own Select:
    SELECT   DISTINCT
                postcode AS DV,
                postcode AS RV
         FROM   TEST.GEO_DATA
         WHERE   country_id = L_COUNTRY
         AND    postcode like l_search||'%'
         ORDER BY 1
    
    -- Plan
    SELECT STATEMENT  ALL_ROWSCost: 840  Bytes: 152,867  Cardinality: 13,897                                
         8 SORT ORDER BY  Cost: 840  Bytes: 152,867  Cardinality: 13,897                           
              7 HASH UNIQUE  Cost: 838  Bytes: 152,867  Cardinality: 13,897                      
                   6 VIEW VIEW index$_join$_001 Cost: 836  Bytes: 232,111  Cardinality: 21,101                 
                        5 HASH JOIN            
                             2 BITMAP CONVERSION TO ROWIDS  Cost: 31  Bytes: 232,111  Cardinality: 21,101       
                                  1 BITMAP INDEX RANGE SCAN INDEX (BITMAP) #INDEX#
                             4 BITMAP CONVERSION TO ROWIDS  Cost: 45  Bytes: 232,111  Cardinality: 21,101       
                                  3 BITMAP INDEX SINGLE VALUE INDEX (BITMAP) #INDEX#
    Is there a chance to get my INDEX used by the new element of the APEX? I do not. But I still want to ask before I just rebuild. :)

    Best regards

    Tobias

    Hi Tobias,.

    I guess that you are currently using "contains and case sensitivity ' to the attribute of"search ". Have you ever tried out "Exact and case sensitivity? Because that internally uses the LIKE operator as does your original query and the % is at the end, she must allow the use of an index. But it might still work, because ORDER BY can be run at a different time in your original example, but it's worth a try.

    Concerning
    Patrick
    -----------
    My Blog: http://www.inside-oracle-apex.com
    APEX 4.0 Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • Explanation of the instr function

    Hello

    I have been helped with a query and received the following code. The code does what I wanted to do, but I don't really understand how it works. I tried Googling, but examples are different in this one and do not contain the value > 0 or | (Which I guess makes reference to a column. Could someone please explain it to me.
     SET Financial_Review = ( case when instr(Debt_Review||Judgement||Liquidation||under_admin,'Y') > 0 then  'Y' else 'N' end) 
    Banner:
    Oracle Database 11 g Release 11.2.0.2.0 - 64 bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    "CORE 11.2.0.2.0 Production."
    AMT for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    
    Debt_Review||Judgement||Liquidation||under_admin 
    

    You concatenate 4 columns. then

    
    instr(Debt_Review||Judgement||Liquidation||under_admin,'Y') 
    

    You check if the letter there exist in the concatenated string. INSTR returns the position of the character of research. So if the position is greater than 0 that means that the search string exists.

    So eventually, if it exists, you define Y n else.

  • Using a variable in the "LOVE" of a WHERE clause part

    How could I go to achieve this?

    I SELECT... WHERE AS 123% person_number';

    While observing the percent symbol, how I would substitute and explicit value with an implicit reference to a variable, I already assigned a value to?

    Thank you very much.

    don't know if that's what you need, but you can simply concatenate your variable with '% '.

    for example;

    SQL> select * from emp1 where job like 'A%';
    
         EMPNO JOB                  START_DAT        SAL       DEPT
    ---------- -------------------- --------- ---------- ----------
             3 Author
          4444 AUTHOR               24-MAY-10       5001          3
          3333 ANALYST              24-MAY-09       5004          2
    
    SQL> variable prefix char(1);
    SQL> exec :prefix :='A';
    
    SQL> select * from emp1 where job like :prefix||'%';
    
         EMPNO JOB                  START_DAT        SAL       DEPT
    ---------- -------------------- --------- ---------- ----------
             3 Author
          4444 AUTHOR               24-MAY-10       5001          3
          3333 ANALYST              24-MAY-09       5004          2
    
  • Using the Case statement in Where clause with operator

    Hi all

    I'm doing the following work (this is just a simple version of what I'll eventually need):

    Sorry, I forgot how to use the code tags...

    and li. MAJOR_ACCT in case
    When: prompt = 'Energy' then ('9320906 ', ' 9321471')
    end


    Problem is that I get a missing closing parenthesis error.

    Wouldn't - that evaluate against a value(as below) it works fine:

    and li. MAJOR_ACCT in case
    When: prompt = 'Energy' then ('9320906')
    end


    Any thoughts? Is it possible to use a box (or decode) in an In clause with multiple values? I tried to use decode as well and get the same results.

    Thank you.

    Darren.

    What:

    and ( case
            when :prompt = 'Energy' and li.MAJOR_ACCT in ('9320906', '9321471') then 1
            when :prompt = 'Vehicle' and li.MAJOR_ACCT in ('9812180', '9812320')  then 1
            when :prompt = 'Meals' and li.MAJOR_ACCT in ('983120', '983452') then 1
          end
        ) = 1
    
  • Implementation of subqueries in the WHERE clause

    Hi all

    First of all, here are the technical info:

    Oracle JDeveloper 12 c 12.1.3.0.0

    Studio Edition Version 12.1.3.0.0

    Build JDEVADF_12.1.3.0.0_GENERIC_140521.1008.S

    Version of the component

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

    Oracle IDE 12.1.3.0.41.140521.1008

    Java (TM) Platform 1.7.0_51

    Support versioning 12.1.3.0.41.140521.1008

    Secondly, the issue I'm facing is I'm trying to implement a query with three sous-sélections them in the (see image below) WHERE clause. I don't know what is the best way to implement something like this.

    I have implemented this by creating a display object and add a view criteria. I put the whole SQL fragment in the view as a literal value criteria. Is there a better (or best?) approach to implement something like this?

    This implementation is a problem is because as well as query tests out fine when I click on explain Plan even recognized that there is no bind variables in subqueries and allows me to.

    When I run this test by the tester of AM, that it fails to recognize and define the binding (projCategory) variable that appears only in subqueries. All your comments and/or help is very appreciated.

    Query.JPG

    Thank you

    Vladimir

    Vladimir, there is something wrong in the view Definition of criteria dialog box. The button "explain plan...". "running the whole statement generated (as a string) and returns the result. The entire statement is valid and returns the correct result. However, the view criteria, when it is running in the application work differently. Here the literal that you entered is not passed as a string, but the framework does something internally with her (it is necessary to do things as in the research of memory and other things). If you run the criteria to view in the app Tester I get

    SQL error in the preparation of the statement.  Instruction: SELECT Employees.EMPLOYEE_ID, Employees.FIRST_NAME, Employees.LAST_NAME, Employees.EMAIL, Employees.PHONE_NUMBER, Employees.HIRE_DATE, Employees.JOB_ID, Employees.SALARY, Employees.COMMISSION_PCT, Employees.MANAGER_ID, Employees.DEPARTMENT_ID from employees WHERE (((Employees.SALARY< :vc_temp_1="" )="" )="" )="" ):="" ora-01722:="" invalid="">

    Accordingly, for the display criteria

    employes.salaire< (select="" max(e2.salary)="" from="" employees="" e2="" where="" e2.department_id="">

    As you can see the literal is passed as: vc_temp_1 and my binding variable is not visible at all. You can open an SR and ask for the support of working on it. I guess that they do not see a bug here as help for the dialog box says:

    Literal

    Select when you want to provide a value for the attribute, or when you want to set a default value for a lookup field specified by the user for a search query-by-example form.

    When the criteria of view defines a search query for the user interface form, you can leave the field blank. In this case, the user will provide the value. Alternatively, you can provide a value that will act as a default value to the field search that the user will be able to substitute. This entry can include wildcards * or %.

    When the attribute is of type Date, specify the value of the date in the format YYYY-MM-DD; for example, to December 16, 2010, enter 2010-12-16.

    Here, it tells you that a value is expected. Your sub query is not interpreted, but is simply converted to the appropriate data type. In my example, I get an invalid number as expected.

    So I guess my suggestion to use a custom sql statement stands.

    Timo

Maybe you are looking for

  • can not read the background tabs because they are now transparent in version 29.0.1

    With this new version, 29.0.1, it became difficult to read the tabs in the background. I now have in my eyes to read the tabs of the strain. Is it possible to restore the inactive tabs (background) the way in which they were posted before. Before it

  • HP 19-2114 Memory Upgrade

    I recently had a 19-2114 all-in-One PC HP free and I discovered that I can improve my same 4 GB to 8 GB and 16 GB memory. I was wondering where I can buy 8GB memory upgrade because I was looking on Amazon and I found that the improvements of memory o

  • write to cd

    Any who have automatically no matter what code of the example on how burn (using Labview 2012) an entire directory of files *.txt on a CD... I try to avoid that the user select the whole directory, drag files in the cd burning application window, the

  • Desktop Pavilion 500: Disc startup problems

    My computer fails to start, and I have to manually select the startup disk so that it can work. I also backup problems all partitions. After running a check disk hard eroor, I get the code. u0f4q8 - 72181 g-qffv61-61vk03 Is it a hard drive failure? D

  • How can I sync my ipod to a new computer

    I get an error 43 code, which says that windows does not recognize my ipod.  I grew up the content on this device, and there is no music.  I have over 900 songs.  Windows says to replace this unit, I can't.  Where should I go from here?