In clause oracle 9i

Hi ,
I have very simple query
SELECT CUSTNO, TYPE FROM CUST WHERE TYPE IN ('a', 'b', 'c')
it's only returns rows with type = 'a' (to be specific only first parameter rows)
Env: 9i with UTF settingd
Any Pointers?
Mahesh

What happens when you try the query
SELECT DISTINCT '|' || type || '|'
  FROM custDo you really have rows whose type values are 'b' or 'c'?
Justin

Similar Messages

  • How to pass more than 1000 entries in 'IN' clause, Oracle 11g

    Hi All,
    I know this is a very common question in Oracle discussion forum. But, Im in different zone.
    I use C#, .NET and Oracle 11g. I have a situation where I will create a query statement using 'IN' clause in C# code based on my requirement and execute that statement from code itself with oracle connection object. I do not have any procedures. I must phrase my query statement and pass it on to OracleConnection object to execute it.
    My code looks like this....
    List<decimal> x_Ids = new List<decimal>();
    I will load my IDs into x_Ids here;
    string whereInClause = ........I will prepare a 'IN' clause (All IDs separated by ',')
    My query would looks like this....
    string query = select * from MYTABLE where X_ID in [ whereInClause with more than 1000 entries]
    oraConn.ExecuteQuery(query);
    I have a workaround with OR operator with 'IN' clause like below.
    X_ID in [ Ids till 1000 entries] OR X_ID in [Next 1000 entries] OR X_ID in [Next 1000 entries] ....so on.....
    It is working, but, I heard that this may slowdown the performance of the application. Is this really a performance hit to my application?
    Can you please suggest any other workaround to overcome this situation?

    >
    I have a workaround with OR operator with 'IN' clause like below.
    X_ID in [ Ids till 1000 entries] OR X_ID in [Next 1000 entries] OR X_ID in [Next 1000 entries] ....so on.....
    It is working, but, I heard that this may slowdown the performance of the application. Is this really a performance hit to my application?There should be no performance difference between a statement like
    select * from myTab
    where ID in (1,2,3,4,5)
    OR ID in (6,7,8,10,12) and
    select * from myTab
    where ID in (1,2,3,4,5,6,7,8,10,12) The execution plan should be identical.
    However those values might better be send as a single object (collection or table of numbers type).
    I think the ODP or OO4O connectivity allows to create and such oracle object types.
    Another way could be to think about how all the values are created? Did any user enter them manually? Certainly not. Then maybe you can apply the same logic to the SQL statement that created those values in your .Net application.
    something like
    select * from myTab
    where ID in (select t2.FK_ID from otherTab t2 where t2.Col1 = 100) This approach would probably beat all others performancewise. Since you avoid the overhead of constructing the in-lists.

  • WITH clause, Oracle, UNION problem

    I have a table with two fields, SYSTEM and DATEOPENED.  It's basically a log of events.
    For each row, I need to calculate how much time has elapsed between one row and the next for the same system.
    Basically, when I execute this directly against the database (replacing parameters with actual TO_DATE('...','...')), this works flawlessly.
    The problem when I run this in Crystal Reports is that the WHERE clause of the CUMULATIVE portion of the UNION is completely ignored.  I get ALL the data from the database for the CUMULATIVE.
    I inverted both portions of the UNION (DISCRETE first and CUMULATIVE second), which had the result of completely removing the CUMULATIVE portion of the result set.
    I'm using Crystal Reports 11.5.0.313 (XI R2)
    The query looks like this:
    WITH ACCT_DATA AS (
      SELECT SYSTEM, Round(DateOpened,'IW') WeekDate, Sum(IsUDRWithinThreshold) CNT_WITHINTHRESHOLD, Count(1) CNT
      FROM (
        SELECT SYSTEM, DateOpened, (
          CASE
            WHEN SYSTEM='system1' AND ((Lead (DateOpened,1) over (PARTITION BY SYSTEM ORDER BY SYSTEM, DateOpened))-DateOpened)*24 < 5 THEN 1
            WHEN SYSTEM='system2' AND ((Lead (DateOpened,1) over (PARTITION BY SYSTEM ORDER BY SYSTEM, DateOpened))-DateOpened)*24 < 5 THEN 1
            WHEN SYSTEM='system3' AND ((Lead (DateOpened,1) over (PARTITION BY SYSTEM ORDER BY SYSTEM, DateOpened))-DateOpened)*24 < 9 THEN 1
            ELSE 0
          END
        ) IsUDRWithinThreshold
        FROM  ACCT_FILES
        WHERE SYSTEM IN ('system1','system2','system3')
        AND Round(DateOpened,'YYYY')=Round({?ToDate},'YYYY')
      GROUP BY SYSTEM, Round(DateOpened,'IW')
      ORDER BY SYSTEM, Round(DateOpened,'IW')
    SELECT 'CUMULATIVE' DATA_TYPE, d1.SYSTEM, d1.WeekDate, Sum(d2.CNT_WITHINTHRESHOLD) CNT_WITHINTHRESHOLD, Sum(d2.CNT) CNT
    FROM ACCT_DATA d1 INNER JOIN ACCT_DATA d2 ON d1.SYSTEM=d2.SYSTEM AND d2.WeekDate<=d1.WeekDate
    WHERE d1.WeekDate BETWEEN {?FromDate} AND {?ToDate}
    GROUP BY d1.SYSTEM, d1.WeekDate
    UNION
    SELECT 'DISCRETE' DATA_TYPE, SYSTEM, WeekDate, CNT_WITHINTHRESHOLD, CNT
    FROM ACCT_DATA
    WHERE WeekDate BETWEEN {?FromDate} AND {?ToDate}
    ORDER BY DATA_TYPE, SYSTEM, WeekDate

    Hello,
    First, you can't use that SQL directly in Crystal Reports unless you are using a Command object. In which case CR does not modify the SQL at all. It may be due to multiple results sets in which case CR will have problems logically with this type of SQL.
    what happens if you use SQLPlus to test the SQL and results?
    Also, before doing any of that you are using the original release of Crystal Reports XI R2. Go to the Businessobjects tab above and download SP4, full build. Easier than applying all of the incremental patches but it does require you to un-install CR first.
    Test again, if you still get the same problem then do more debugging.
    Also note in you reply what DB driver you are using, ODBC, OLE DB etc., and who's driver, Oracle's DataDirect, Microsoft etc.?
    Thank you
    Don

  • Returning 250 rows with 1000 Values in "IN" Clause Oracle 10g On IBM AIX !!

    Hi,
    Recently we have done the OS migration of Oracle 10g Server from Windows Server to IBM AIX. Everything is fine, But today we came across one crucial bug in the code, i.e In the Select Query, though we're expecting 1000 rows with 1000 values in "IN" Clause , It's returning Only 250 rows. Where as it's returning 1000 rows in Windows Environment with 1000 values in "IN" Clause. I have browsed throgh Google for the resolution but failed to get that.
    This is something like,
    In Oracle 10g On windows :-
    select * from emp
    where dept_id in (1,2,3,...................1000);
    Assuming there  are the dept_id values in Emp table from 1 ... 1000, It's returning 1000 rows.
    In Oracle 10g On IBM AIX ,
    select * from emp
    where dept_id in (1,2,3,...................1000);
    Assuming there  are the dept_id values in Emp table from 1 ... 1000, It's returning 250 rows. Pls help me, what could be the reason for this. and what needs to be checked to fix this.
    Pls suggest !!!
    Raja

    mmmh. Did you compared the select count(*) from your_table; in the two cases.
    If the result is not good and nobody has deleted rows between migration and your test, you migration need to be replayed.
    Which migration did you select, Transportable database or exp/imp...?
    Edited by: Dba Z on 16 août 2009 08:56

  • Understanding multiple conditions in connect by prior clause Oracle

    Hi ,
    Can some one please explain me how to comprehend/understand  multiple conditions in connect by prior conditions with some example data.
    I am creating a table like this
    CREATE TABLE FAMiLY_TREE
    GRAND_FATHERID number,
    FATHER_ID number,
    SON_ID number,
    person_name varchar(20)
    INSERT INTO  FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
    (NULL, NULL , 5 , 'Mr X ' );
    INSERT INTO  FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
    (null, 5 , 6 , 'Dave' );
    INSERT INTO  FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
    (5, 6 , 7 , 'Vinny' );
    INSERT INTO  FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
    (5, 6 , 16 , 'Omy' );
    INSERT INTO  FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
    (5, 6 , 17 , 'Vijjy' );
    INSERT INTO  FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
    (6, 7 , 8 , 'Vicky' );
    INSERT INTO  FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
    (6, 7 , 9 , 'Varis' );
    INSERT INTO  FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
    (7, 8 , 10 , 'Vshnu' );
    INSERT INTO  FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
    (7, 8 , 11 , 'dyna' );
    INSERT INTO  FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
    (8, 10 , 14 , 'Marry' );
    INSERT INTO  FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
    (8, 10 , 15 , 'Mac' );
    INSERT INTO  FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
    (7, 9 , 12 , 'Garry' );
    INSERT INTO  FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
    (7, 9 , 13 , 'Ganny' );
    SELECT
    LPAD(' ', LEVEL*3) || PERSON_NAME FROM FAMILY_TREE
    START WITH SON_ID= 6
    CONNECT BY PRIOR SON_ID = FATHER_ID
    AND PRIOR FATHER_ID = GRAND_FATHERID ;
    SELECT
    LPAD(' ', LEVEL*3) || PERSON_NAME FROM FAMILY_TREE
    START WITH SON_ID= 6
    CONNECT BY PRIOR SON_ID = FATHER_ID ;
    Both These query return the same o/p
       Dave
          Vinny
             Vicky
                Vshnu
                   Marry
                   Mac
                dyna
             Varis
                Garry
                Ganny
          Omy
          Vijjy
    Can some one please explain me comprehension of both these query or give me a example where i can understand multiple connect by prior conditions
    Thanks

    Maybe (something to play with)
    with
    family_tree as
    (select 'Green' family,null ancestor,1 person,'Mr X' person_name,1900 born from dual union all
    select 'Green',1,2,'Dave',1920 from dual union all
    select 'Green',2,3,'Vinny',1940 from dual union all
    select 'Green',2,4,'Omy',1945 from dual union all
    select 'Green',2,5,'Vijjy',1950 from dual union all
    select 'Green',3,6,'Vicky',1960 from dual union all
    select 'Green',3,7,'Varis',1965 from dual union all
    select 'Green',6,8,'Vshnu',1980 from dual union all
    select 'Green',6,9,'Dyna',1985 from dual union all
    select 'Green',8,10,'Mary',2000 from dual union all
    select 'Green',8,11,'Mac',2005 from dual union all
    select 'Green',7,12,'Garry',1985 from dual union all
    select 'Green',7,13,'Ganny',1990 from dual union all
    select 'Brown',null,14,'Joe',1950 from dual union all
    select 'Brown',14,15,'Jim',1970 from dual union all
    select 'Brown',14,16,'Joy',1975 from dual union all
    select 'Brown',14,17,'Jay',1980 from dual union all
    select 'Brown',16,18,'Jack',1995 from dual union all
    select 'Brown',18,19,'Jake',2010 from dual union all
    select 'Brown',18,20,'Jess',2012 from dual
    select family,
           root_name||' ('||to_char(root_born)||')' "(FA/MO)THER",
           children
      from (select family,
                   root_born,
                   root_name,
                   ltrim(sys_connect_by_path(person_name||' ('||to_char(born)||')',', '),', ') children
              from (select family,
                           connect_by_root(person_name) root_name,
                           connect_by_root(born) root_born,
                           person_name,
                           born,
                           row_number() over (partition by family,connect_by_root(person_name) order by born) rn
                      from family_tree
                     where level = 2
                    connect by prior person = ancestor
             where connect_by_isleaf = 1
             start with rn = 1
            connect by prior root_name = root_name
                   and prior family = family
                   and prior rn + 1 = rn
    order by family desc,root_born
    Regards
    Etbin

  • Select List with a Contains clause (oracle text)

    Hi, I am trying to create a dynamic select list, but am running into problems using bind variables.
    I am trying to do this:
    select distinct country d, country r
    from table1
    where contains(:P6_LIST_VALUE,''''|| :P6_NAME||'''');
    I keep getting the error: "LOV query is invalid, a display and return value are needed, the column names need to be different...."
    If I hard code the :P6_LIST_VALUE to be 'NAME' (which is what I named my context index) it works fine:
    where contains(name, ''''||:P6_NAME||'''');
    Is there any way to get around this error?

    anonymous - Please tell us your first name.
    CONTAINS Operator
    Syntax
    CONTAINS(
    [schema.]column,
    text_query VARCHAR2
    [,label       NUMBER])
    RETURN NUMBER;
    So you can't use a bind variable for the column name, just like you can't do "SELECT :COL FROM DUAL".
    Try &P6_LIST_VALUE. (with trailing period). This effects a textual substitution before the SQL is parsed.
    Scott

  • Can I use an expression in order by clause

    SELECT
    PERIOD_NUM, period_num *12,
    period_name,
    --TO_DATE(SUBSTR(PERIOD_NAME,1,3)&#0124; &#0124;SUBSTR(PERIOD_NAME,INSTR(PERIOD_NAME,'-'),3),'MON-RR'),
    TO_NUMBER(TO_CHAR(TO_DATE((SUBSTR(PERIOD_NAME,1,3)&#0124; &#0124;SUBSTR(PERIOD_NAME,INSTR(PERIOD_NAME,'-')+1,2)),'MONRR'),'RRRRMM'))
    FROM GL.GL_PERIODS
    order by 2--TO_NUMBER(TO_CHAR(TO_DATE(SUBSTR(PERIOD_NAME,1,3)&#0124; &#0124;SUBSTR(PERIOD_NAME,INSTR(PERIOD_NAME,'-')+1,2),'MONRR'),'RRRRMM'))
    desc
    gl_periods is a table, period_name consists of values like oct-01_fy-01 etc and oct01_01_fy-01
    I want to sort on this column based on period_name, so I am trying to convert into number like for oct-01_fy-01, the query gives
    200110 and so on. the recent period comes first, But my question is I can't use the same to_number(.....) in the order by clause. oracle gives an error
    ORA-01843: not a valid month.
    Let me know whether anyone come across with this kind of situation

    If you are sure the expression is correct, since you are using it in the select clause, give an alias and use the alias in the order by clause.
    null

  • How to implement invoker rights in oracle 9i

    implement invoker rights in oracle 9i

    Invoker rights is a new model for resolving references to database elements in a PL/SQL program unit. From Oracle 8i onwards, we can decide if a program unit should run with the authority of the definer or of the invoker. This means that multiple schemas, accessing only those elements belonging to the invoker, can share the same piece of code.
    To enable code to run with Invoker rights, an AUTHID clause needs to be used before the IS or AS keyword in the routine header. The AUTHID clause tells Oracle whether the routine is to be run with the invoker rights (CURRENT_USER), or with the Owner rights (DEFINER). If you do not specify this clause, Oracle by default assumes it to be AUTHID DEFINER.
    create or replace procedure update_par(pi_parcod  in     varchar2,
                                           pi_val     in     varchar2,
                                           pio_status in out varchar2)
    authid current_user is
    begin
      pio_status = 'OK';
      update appparmst
      set    parval = pi_val
      where  parcod = pi_parcod
      and    rownum = 1;
      if sql%notfound then
        pio_status = 'Error in resetting the parameter';
      end if;
    end; Restriction in using Invoker rights
    1. When compiling a new routine, direct privileges are only considered to resolve any external references. Grants through roles are ignored. The same applies when executing a routine created with invoker rights.
    2. AUTHID is specified in the header of a program unit. The same cannot be specified for individual programs or methods within a package or object type.
    3. Definer rights will always be used to resolve any external references when compiling a new routine.
    4. Maintain extra caution on privileges being assigned to a different user. If the wrong privileges are assigned, a routine with invoker rights may have a mind of its own! Such issues would be difficult to debug. So ensure that the grants are perfectly in place.
    5. For an invoker rights routine referred in a view or a database trigger, the owner of these objects is always considered as the invoker, and not the user triggering it.
    ~ Madrid.

  • Derived tables and Order by clause

    Hi,
    I have a query that looks as below.
    The execution time of the query (10 sec) is fine when order by clause is removed from the query. But with order by clause, the execution time is 40 times more(400 sec). How to optimize this query so that it will execute within a minute, with ORDER BY clause included?
    select X.a1, X.a2, X.a3, X.a4, Y.b1, Y.b2, Y.b3
    from (select A.a1 a1, A.a2 a2, A.a3 a3, A.a4 a4
    from A_table A
    where A.a1 = 'something') X,
    (select B.b1 b1, B.b2 b2, B.b3 b3
    from B_table B
    where B.b1 = 'some') Y
    where
    X.a1 = Y.a1 (+) AND (some other conditions)
    order by X.a1, X.a2, Y.b1, Y.b2, X.a3, X.a4
    thanks in advance,
    Venkat

    You do need the inline view Y if you are outer joining it because you must apply the
    where B.b1 = 'some'
    condition first.
    However, the inline view X is not needed. Still, I'm not sure that getting rid of it is going to improve performance. Try it and see.
    Incidentally, the outer join condition
    where X.a1 = Y.a1 (+)
    refers to Y.a1, but the inline view Y has no column named a1. Did you mean Y.b1?
    What are the "some other conditions"? Do any of them involve the inline view Y alone (that is, are not join conditions)? If so, it may be that either: a) you don't need an outer join, or, b) those conditions should be moved into the inline view Y. In either case, this may improve performance.
    Are you sure the execution time without the order by clause is really 10 seconds? Or, is that just the elapsed time to return the first row? With the order by clause, Oracle must identify all the rows before it can return the first row.

  • Group by clause will try to group the primay key's

    hi all,
    For my requiremments and to avoid the the subquery i am using join and group by clause in my sql query in oracle 10g r2 database.my question is if i put a primary column the group clause then oracle try to group the records?.
    i know if we use a primary key column in group by clause there is no grouping will occur.
    but i have doubt oracle will try to group ? because it will take some amount of time to achive?
    else due presense of primay key column in group by clause oracle won't try?
    Please advice ??

    My query return the records less then the min v_date(date datatype) column.
    i check this condition in having clause
    my old query is
    select emp_id,emp_name,voldate,volume,productivity
    from volume v1
    where v1.voldate<=(select min(v2.voldate) form volume v2 where v2.emp_id=1)
    and v1.emp_id=1
    i change it as
    select emp_id,emp_name,voldate,volume,productivity
    from volume v1,volume v2
    where v1.emp_id=v2.emp_id
    having v1.voldate<=min(v2. voldate)
    group by emp_id,emp_name,voldate,volume,productivity
    above the query's emp_id is primay key for volume table
    comparing both query's which one is the best while looking th response time.
    else any other alternative for both the queries.??

  • Problem with IN clause in..........

    hello
    select RECPT_FRM_DE,tenq_no from enq_folloup where tenq_no in (:dumy_enq)
    in this :dummy_enq is a field with char as data type and tenq_no of the table is varchar2. when i enter more than one value in the :dummy_enq field with comma seperation ( eg. 1260,1265 ) no data is selected. how to correct this ?
    regrds
    Kris
    Message was edited by:
    Kris

    First, could you edit your post above and change the subject to something like: Problem with IN (...) clause
    Oracle does not parse the value in :dummy_enq. If you really want to use an IN list, you need to create multiple fields, and use:
    select RECPT_FRM_DE,tenq_no from enq_folloup
      where tenq_no in (:dumy_enq1, :dumy_enq2, :dumy_enq3)

  • IFS-32656: Unable to get the FolderRestrictedQuery search clause

    Hi!,
    I have a new problem. I have created a portal with Oracle Portal and cmsdk to manage a set of documents. When I try to visualize documents on portlet my application failures. I receive this exception
    06/08/28 15:33:56 oracle.ifs.common.IfsException: IFS-32656: Unable to get the FolderRestrictedQuery search clause
    oracle.ifs.common.IfsException: IFS-32659: Error determining Folder Index level
    java.sql.SQLException: Parametro IN o OUT mancante nell'indice:: 3
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:137)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:174)
         at oracle.jdbc.driver.OraclePreparedStatement.processCompletedBindRow(OraclePreparedStatement.java:1552)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2927)
         at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:2973)
         at oracle.ifs.server.FolderIndexService.isFolderAtMaplevel(FolderIndexService.java:1877)
         at oracle.ifs.server.FolderIndexService.determineMapLevel(FolderIndexService.java:1842)
         at oracle.ifs.server.FolderIndexService.getFrqInClause(FolderIndexService.java:890)
         at oracle.ifs.server.FolderIndexService.getFrqClause(FolderIndexService.java:833)
         at oracle.ifs.server.SQLGeneration_Helper.getFrqClause(SQLGeneration_Helper.java:907)
         at oracle.ifs.search.toSQLVisitor.visitFRQualifier(toSQLVisitor.java:437)
         at oracle.ifs.search.FolderRestrictQualification.accept(FolderRestrictQualification.java:393)
         at oracle.ifs.search.toSQLVisitor.visitSearchClause(toSQLVisitor.java:546)
         at oracle.ifs.search.SearchClause.accept(SearchClause.java:391)
         at oracle.ifs.search.SQLGenerator.generateWhereClause(SQLGenerator.java:318)
         at oracle.ifs.search.SQLGenerator.getSQLStatement(SQLGenerator.java:754)
         at oracle.ifs.search.SQLGenerator.getSQLStatement(SQLGenerator.java:180)
         at oracle.ifs.search.AttributeSearchSpecification.getSQLString(AttributeSearchSpecification.java:490)
         at oracle.ifs.search.AttributeSearchSpecification.getSQL(AttributeSearchSpecification.java:457)
         at oracle.ifs.search.SearchSpecification.getSQL(SearchSpecification.java:252)
         at oracle.ifs.server.S_Search.open(S_Search.java:273)
         at oracle.ifs.server.S_LibrarySession.DMOpenSearch(S_LibrarySession.java:6230)
         at oracle.ifs.beans.LibrarySession.DMOpenSearch(LibrarySession.java:11328)
         at oracle.ifs.beans.Search.open(Search.java:541)
         at oracle.ifs.beans.Search.open(Search.java:500)
         at oracle.ifs.beans.Search.open(Search.java:452)
    Really this exception is launched only if I set in Oracle Portal a provider that points to an oc4j who runs on an application server 10.1.2.0.2 version (this is the version of application server installed on server machine). If I set a provider that points to oc4j on my pc every thing runs finally. The only difference between two machine is that on my pc is installed an application server 9.0.4.0.1 version. I suppose that this behaviour is caused by driver odbc, but I don’t know how can I resolve it. Can you help me to configure every thing correctly?
    Thanks in advance

    Make sure the searchbase is correct. Make sure to restart the identity server and web server (after selecting the 'Person' and 'Group' objectclasses, and before clicking on 'Next' ) during the Product Setup.

  • Can anyone tell me what is wrong with the simple sql?

    Hi,
    I have a simple SQL (see attached). It returns records when it does not include the Order By sorting clause. However, if it includes the Order By clause, Oracle says no data found. Anyone can give me some ideas what could cause the problem?
    Thanks in advance.
    SELECT ih.item_key, e.episode_key, e.episode_date, wp.work_package_key, p.patient_name, c.codes_key
    FROM work_package wp, episodes e, item_header ih, patients p, codes c, station_element se, station_data sd
    WHERE wp.work_item_key = e.episode_key
    and e.episode_key = ih.item_key
    and ih.logical_parent_key = p.patient_key
    and e.episode_type = c.code_value
    and wp.asgn_station_key = se.item_key
    and se.station_name like 'DICT FIX%'
    and sd.station_key = wp.asgn_station_key
    and (sd.facility = '0' or sd.facility = 1)
    and wp.on_hold <> 'Y' and c.code_type = 'CEPT'
    and c.setup_group = 1
    ORDER BY e.episode_date, e.medrec_no;

    Hmmm...can you post a SQL Plus session that demonstrates this?

  • Using order by and rownum in massive tables

    Hi,
    I need to retreive paginated and ordered data from a big table.
    I know some different tips using rownum or the RANK() function and subqueries, these tips work well for small amount of data, but I need to get the data from a table with 200.000 entries (not under my control), and with all those methods is necessary to order first the data and then select your range, so performance is extremely poor.
    Anybody knows a better solution? it doesn't matter if is plain SQL(better) or PL/SQL.
    Thanks in advance

    but I was looking for something like the LIMIT in MySQL or TOP in msSQL where all the sorting is made internally and it's really fast If the data needs sorting, I do not think Oracle would take any longer to do that than the others mentioned, unless the other DBs mentioned, only sort the rows that are actually being returned.
    As for the LIMIT clause, Oracle already has that clause available when FETCHing from a CURSOR:
    SQL> DECLARE
      2      CURSOR emp_cur IS
      3          SELECT * FROM scott.emp;
      4      TYPE emp_rec_table IS TABLE OF emp_cur%ROWTYPE INDEX BY BINARY_INTEGER;
      5      emp_tbl emp_rec_table;
      6  BEGIN
      7      OPEN emp_cur;
      8      LOOP
      9          emp_tbl.DELETE;
    10          FETCH emp_cur BULK COLLECT
    11              INTO emp_tbl LIMIT 5;
    12          EXIT WHEN emp_tbl.COUNT <= 0;
    13          dbms_output.put_line(emp_tbl.COUNT || ' rows fetched using LIMIT clause.');
    14      END LOOP;
    15      CLOSE emp_cur;
    16  END;
    17  /
    5 rows fetched using LIMIT clause.
    5 rows fetched using LIMIT clause.
    4 rows fetched using LIMIT clause.
    PL/SQL procedure successfully completed.
    SQL> disconnect
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.3.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.3.0 - Production
    SQL>

  • Performance Problem with view

    We are using a view which comprises of 5 to 6 union queries.Each union query of the view returns large number of rows when we do a normal select without any where clause on that view it takes a long time any clue ???.
    Also our main requirement is to just get very few rows depending upon the where clause which for which we are forming a query over the view but that also takes very long time...????
    Any idea how we ensure that each union query inside the view first takes the where clause passed by the user and then does the union...????
    Or any clue how do we overcome this problem >>>>

    Without seeing the actual queries, it is really difficult to give any specific advice. However, a couple of general points that may help.
    Do you use UNION or UNION ALL in your view? UNION requires a sort to remove duplicate rows from the set of unioned queries. If each of the unioned queries is independent (that is, no two queries will return the same row), you can use UNION all and save a sort.
    If you are using the Cost Based Optimizer and have up to date statistics, and the individual queries in the union view have where clauses, Oracle may be able to only evaluate one of the queries if the WHERE clause in your main query matches the WHERE clause in one of the unioned queries, and the unioned queries are mutually exclusive.
    Finally, can you re-write the view to not use a UNION at all?
    HTH
    John

Maybe you are looking for

  • Ad-hoc Query & Ad-hoc Query Designer

    Hi Experts,                Please present some information about following question: 1) Ad-hoc Query and Ad-hoc Query Designer. 2) Under which senario we go for Ad-hoc Query instead of normal query. 3) How it will be effective in reporting. 4) How to

  • Work status from the BPC for Excel interface

    Hello everyone ! I got an issue on version 7.0M of BPC with WorkStatus. When i try to access to the work status from BPC the page won't load but i can access to it by the Web. Do you have any clue about that ?  It it the BPC server configuration ? Th

  • Camera Raw preference

    How do I set Camera Raw preference to: Save image settings in: Sidecar ".xmp" files?

  • Kernel upgrade → "unable to reset IRR for apic"

    Hi, I just upgraded to 3.2.1, and at boot I now have 256 error messages: Unable to reset IRR for apic:2, pin:{n} (with {n} from 0 to 255) It still boots, but takes a bit more time. I wasn't able to find anything about it (except a patch I don't under

  • Jump from FBL5 to KSB5

    Hello Guru, I want to jump from FB55 to KSB5. From financial  to analytic , is-it possible ? Best regards, Thierry