Using in clause in oracle

Hi,
I am facing the following issue when trying to retrieve the data from a view.If i specify literals inside the in clause (example id's inside in clause) it's working fine,but when i try to use the subquery inside in clause to retrieve the id's from the base table it's taking longer time and no results are observed.I am trying to give the subquery inside in clause due to the in clause cannot handle literals(id's) more than 1000.
Any suggestions on this will help me a lot for this.

user13469868 wrote:
... due to the in clause cannot handle literals(id's) more than 1000.
Any suggestions on this will help me a lot for this.I often do a simple approach. If I need an IN list with more then 1000 values, then simply use two more more in lists and the OR operator.
Example: instead of
select * from emp
where id in
( 1,
  2,
  3,
  1000,  /* problem point */
  1001,
  2000,  /* problem point */
  2001,
)I write the statement like this:
select * from emp
where (id in  /* see the addition starting parenthesis! */
( 1,
  2,
  3,
   999)
OR id in  /* start of the second list */
  (1000,
  1001,
   1999)
OR id in   /* start of the next list */
(2000,
  2001,
) /* remember to add the closing parenthesis */Edited by: Sven W. on Jun 28, 2011 4:39 PM - formatting

Similar Messages

  • Using MIN clause in Oracle to get a ticket number with an oldes date

    i am stuck with the following simple syntax..
    i need to pull the oldest billnumber ..ultimately i need to see the ticket number with the oldest date .
    here is my select statement using an openquery from SQL server to oracle..
    (SELECT * FROM OPENQUERY(B_COUNT,
    'SELECT
    TICKETID,
    MIN(CREATE_DATE)
    FROM TABLE
    WHERE
    CREATE_DATE >= ''1262304001'' AND CREATE_DATE < (trunc(SYSDATE) - to_date(''01-JAN-1970'',''DD-MON-YYYY'')) * (86400) AND
    STATUS = ''0''
    any help will be appreciated
    thanks

    938115 wrote:
    I also got this text file after the command was executed along with the GIS.bad file
    SQL*Loader: Release 11.2.0.1.0 - Production on Fri Jun 1 09:56:52 2012
    Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
    Control File: bill.ctl
    Data File: GIS.csv
    Bad File: GIS.bad
    Discard File: none specified
    (Allow all discards)
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 50
    Bind array: 64 rows, maximum of 256000 bytes
    Continuation: none specified
    Path used: Conventional
    I have thousands of records in this file and only 64 of them updated.How many record were in the table before and after? I doubt the difference is 64, unless you have exactly 64 rows but you said thousands. I believe you are probably misinterpreting the log file. can you share the full log file? As a test, create a empty table, use the same script and load same data file in this empty table. Once loading is complete, check if it has 64 rows or more. I believe what log file is saying, it is 'commiting after every 64 rows', not 'stopping after loading 64 rows'.
    So, unless you show us the log file there is no way to be certain, feel free to mask confidential info, at-least top 15 and bottom 15 lines ?

  • Unable to use the with clause in oracle 9.0.2

    Hi,
    I need to use oracle SQL with clause in oracle 9.0.2 database. Its a 9i feature but i am unable to use it.
    It is giving internal error, when i try to execute it.
    Even for simple query:
    WITH acct_summary as ( select TOT_COLL_AMT from tdc_acct)
    select TOT_COLL_AMT from acct_summary WHERE TOT_COLL_AMT>100;
    Error message while using 8.0.5 sql plus client:
    SP2-0642: SQL*Plus internal error state 2091, context 0:0:0
    Unsafe to proceed
    Please help to find out why i am not able to use the sql with clause in oracle 9.0.2 database.
    Thanks and regards,
    Raajkathir

    Hi Jens Petersen,
    Yes, You are correct. Thank you very much.
    Regards,
    Raja

  • Clarification on using function in where clause of oracle sql query

    I have an issue in regarding function using where clause of sql query..
    We are facing performance issue while executing query, so in what ways to improve the performance of the query which i have posted below.
    select col ,case when my_function(parameter)
    from tab1 a ,tab2 b,tabl3 c
    where a.column1=b.column2
    and b.column3 =c.column6
    and my_function(parameter)>0
    Regards
    Dinesh
    Edited by: wild fire on May 18, 2012 4:15 PM

    Dinesh,
    remind that when you use a function in the where clause it normally will get started for each record in the table.
    So your answer is two-fold:
    1. make the function only start when needed by adding a function based index on the table (this will make inserts and updates slower)
    2. make the function faster by adding the DETERMINISTIC clause if possible. this will make Oracle "cache" the result of the function.
    Regards,
    Richard
    blog: http://blog.warp11.nl
    twitter: @rhjmartens
    If this question is answered, please mark the thread as closed and assign points where earned..

  • Can't use ";" in sql clause with Oracle 8.X

    Can't use ";" in sql clause with Oracle 8.X
    I can't use ";" at the ending of sql clause in VB program. First this program can use with Oracle 7.3.4 database. But now i need to upgrade DB to Oracle 8.1.7 ,program can't operate. It show error Runtime 40002
    and 37000:ODBC driver for oracle/invalid charactor
    Thankyou

    I've seen a lot of discussion about semicolons in SQL
    sent from 3rd party applications. A web search should
    bring up the discussions.
    Also you might get more response if you ask this question
    somewhere else. This is not a VB forum, so you may
    not reach relevant people.
    -- CJ

  • Using WITH clause in Pro*Cobol

    Hi!
    I am trying to improve the performance of a query by introducing WITH clause.
    The query is in Pro*Cobol Release 9.2.0.6.0 - Production.
    I got compilation error
    WITH DPTCOST AS (
    ...............1
    PCB-S-00400, Encountered the symbol "DPTCOST" when expecting one of the following:
    END-EXEC
    ....continued
    So I wonder if we could use that clause at all with Pro*Cobol
    Here is the excerp of the code
    EXEC SQL
    DECLARE INPUT_ACTUAL CURSOR FOR
    WITH DPTCOST AS (
    SELECT /*+ rule */
    A.CODE_COMBINATION_ID,
    A.SEGMENT1, A.SEGMENT2, A.SEGMENT3,
    A.SEGMENT6,
    D.COSTING, D.PROCESS,
    D.MTL_CODE, D.FACTOR
    FROM
    GL_CODE_COMBINATION A,
    ALCGL_DEPARTMENT_COSTINGS D
    WHERE
    A.TEMPLATE_ID IS NULL
    AND A.SUMMARY_FLAG <> 'Y'
    AND A.SEGMENT1 = D.PLANT_NUMBER
    AND A.SEGMENT3 <> '6999001'
    AND A.SEGMENT3 <> '6999002'
    AND SUBSTR(A.SEGMENT2,4,3) = D.DEPARTMENT
    AND D.ACTUAL_FLAG = 'A'
    ) ... continued

    Materialized views are basically stored query results. They offer advanced functionality like query rewrite, refresh on commit, and more;
    http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_6002.htm
    Unlike a view, they actually store the results of the query - not just the query;
    SQL> create table t (cid number primary key)
    Table created.
    SQL> insert into t select object_id from dba_objects where object_id is not null
    12791 rows created.
    SQL> create materialized view mv
       as select * from t
    Snapshot created.
    SQL> select object_name, object_type from user_objects where object_name ='MV'
    OBJECT_NAME                    OBJECT_TYPE       
    MV                             TABLE             
    MV                             MATERIALIZED VIEW 
    2 rows selected.
    SQL> select segment_name, bytes from user_segments where segment_name in ('T', 'MV')
    SEGMENT_NAME                        BYTES
    T                                  196608
    MV                                 196608
    2 rows selected.Temporary tables are simply tables that are created then dropped. GLOBAL TEMPORARY TABLES have the advantage (or disadvantage) of only existing until commit or the end of the session. They results are visible to the user that inserted the data - but only temporarily;
    http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_7002.htm#sthref7483

  • Using FILTER function in oracle answers

    Gurus,
    I have a question related to using Filter function in oracle answers.
    When trying to insert a Filter (expr) Using (expr) clause in the formula area of a fact table field, It errored out with msg saying about using a wrong measure.
    I know this can be done with a case expression but I tried filter clause since this is available in oracle answers.
    Please help me figuring out this scenario.
    Thanks.

    David / Raghu - Thanks for u'r replies and apologizes for not posting question with proper material.
    Am posting my code and the error message from the screen.
    Code :
    IFNULL(FILTER("Fact - MBS Loan Transactions"."OUTSTANDING PRINCIPAL" USING "Dim - MBS Loan"."LOAN TYPE HPD/HDC/BNK" = 'HDC'),0)
    Error :
    nQSError: 10058] A general error has occurred. [nQSError: 22032] Function FILTER requires at least one measure attribute in its first argument. (HY000)
    SQL Issued: SELECT "Dim - MBS Loan"."LOAN AMOUNT", "Dim - MBS Loan"."LOAN TYPE HPD/HDC/BNK", "Dim - MBS Loan"."LOAN TYPE SEN/SUB", "Dim - MBS Project"."PROJECT NAME", "Dim - MBS Project"."PROJECT NUMBER", "Fact - MBS Loan Transactions"."AR BALANCE INTEREST", "Fact - MBS Loan Transactions"."GL BALANCE INTEREST", IFNULL(FILTER("Fact - MBS Loan Transactions"."OUTSTANDING PRINCIPAL" USING "Dim - MBS Loan"."LOAN TYPE HPD/HDC/BNK" = 'HDC'),0) FROM "Financials - MBS"
    OK (Ignore Error)
    Please continue answering my queries. Since am a newbie your answers won't be just a reply but it's actually learning for me.
    Thanks.

  • Bug in WITH clause (subquery factoring clause) in Oracle 11?

    I'm using WITH to perform a set comparison in order to qualify a given query as correct or incorrect regarding an existing solution. However, the query does not give the expected result - an empty set - when comparing the solution to itself in Oracle 11 whereas it does in Oracle 10. A minimal example os posted below as script. There are also some observations about changes to the tables or the query that make Oracle 11 returning correct results but in my opinion these changes must not change the semantics of the queries.
    Is this a bug or am I getting something wrong? The Oracle versions are mentioned in the script.
    -- Bug in WITH clause (subquery factoring clause)
    -- in Oracle Database 11g Enterprise Edition 11.2.0.1.0?
    DROP TABLE B PURGE;
    DROP TABLE K PURGE;
    DROP TABLE S PURGE;
    CREATE TABLE S (
         m     number NOT NULL,
         x     varchar2(30) NOT NULL
    CREATE TABLE K (
         k char(2) NOT NULL,
         x varchar2(50) NOT NULL
    CREATE TABLE B (
         m     number NOT NULL ,
         k char(2) NOT NULL ,
         n     number
    INSERT INTO S VALUES(1, 'h');
    INSERT INTO S VALUES(2, 'l');
    INSERT INTO S VALUES(3, 'm');
    INSERT INTO K VALUES('k1', 'd');
    INSERT INTO K VALUES('k2', 'i');
    INSERT INTO K VALUES('k3', 'm');
    INSERT INTO K VALUES('k4', 't');
    INSERT INTO K VALUES('k5', 't');
    INSERT INTO K VALUES('k6', 's');
    INSERT INTO B VALUES(1, 'k1', 40);
    INSERT INTO B VALUES(1, 'k2', 30);
    INSERT INTO B VALUES(1, 'k4', 50);
    INSERT INTO B VALUES(3, 'k1', 10);
    INSERT INTO B VALUES(3, 'k2', 20);
    INSERT INTO B VALUES(3, 'k1', 30);
    INSERT INTO B VALUES(3, 'k6', 90);
    COMMIT;
    ALTER TABLE S ADD CONSTRAINT S_pk PRIMARY KEY (m);
    ALTER TABLE K ADD CONSTRAINT K_pk PRIMARY KEY (k);
    ALTER TABLE B ADD CONSTRAINT B_S_fk
    FOREIGN KEY (m) REFERENCES S(m) ON DELETE CASCADE;
    CREATE OR REPLACE VIEW v AS
    SELECT S.m, B.n
    FROM S JOIN B ON S.m=B.m JOIN K ON B.k=K.k
    WHERE K.x='d'
    ORDER BY B.n DESC;
    -- Query 1: Result should be 0
    WITH q AS
    SELECT S.m, B.n
    FROM S JOIN B ON S.m=B.m JOIN K ON B.k=K.k
    WHERE K.x='d'
    ORDER BY B.n DESC
    SELECT COUNT(*)
    FROM
    SELECT * FROM q
    MINUS
    SELECT * FROM v
    UNION ALL
    SELECT * FROM v
    MINUS
    SELECT * FROM q
    -- COUNT(*)
    -- 6
    -- 1 rows selected
    -- Query 2: Result set should be empty (Query 1 without counting)
    WITH q AS
    SELECT S.m, B.n
    FROM S JOIN B ON S.m=B.m JOIN K ON B.k=K.k
    WHERE K.x='d'
    ORDER BY B.n DESC
    SELECT *
    FROM
    SELECT * FROM q
    MINUS
    SELECT * FROM v
    UNION ALL
    SELECT * FROM v
    MINUS
    SELECT * FROM q
    -- M N
    -- null 10
    -- null 30
    -- null 40
    -- 1 40
    -- 3 10
    -- 3 30
    -- 6 rows selected
    -- Observations:
    -- Incorrect results in Oracle Database 11g Enterprise Edition 11.2.0.1.0:
    -- Query 1 returns 6, Query 2 returns six rows.
    -- Correct in Oracle Database 10g Enterprise Edition 10.2.0.1.0.
    -- Correct without the foreign key.
    -- Correct if attribute x is renamed in S or K.
    -- Correct if attribute x is left out in S.
    -- Correct without the ORDER BY clause in the definition of q.
    -- Only two results if the primary key on K is left out.
    -- Correct without any change if not using WITH but subqueries (see below).
    -- Fixed queries
    -- Query 1b: Result should be 0
    SELECT COUNT(*)
    FROM
    SELECT * FROM
    SELECT S.m, B.n
    FROM S JOIN B ON S.m=B.m JOIN K ON B.k=K.k
    WHERE K.x='d'
    ORDER BY B.n DESC
    MINUS
    SELECT * FROM v
    UNION ALL
    SELECT * FROM v
    MINUS
    SELECT * FROM
    SELECT S.m, B.n
    FROM S JOIN B ON S.m=B.m JOIN K ON B.k=K.k
    WHERE K.x='d'
    ORDER BY B.n DESC
    -- COUNT(*)
    -- 0
    -- 1 rows selected
    -- Query 2b: Result set shoud be empty (Query 1b without counting)
    SELECT *
    FROM
    SELECT * FROM
    SELECT S.m, B.n
    FROM S JOIN B ON S.m=B.m JOIN K ON B.k=K.k
    WHERE K.x='d'
    ORDER BY B.n DESC
    MINUS
    SELECT * FROM v
    UNION ALL
    SELECT * FROM v
    MINUS
    SELECT * FROM
    SELECT S.m, B.n
    FROM S JOIN B ON S.m=B.m JOIN K ON B.k=K.k
    WHERE K.x='d'
    ORDER BY B.n DESC
    -- M N
    -- 0 rows selected

    You're all gonna love this one.....
    The WITH clause works. But not easily.
    Go ahead, build the query, (as noted in a recent thread, I, too, always use views), set the grants and make sure DISCOVERER and EULOWNER have SELECT privs.
    1. Log into Disco Admin as EULOWNER. Trust me.
    2. Add the view as a folder to the business area.
    3. Log into Disco Desktop as EULOWNER. Don't laugh. It gets better.
    4. Build the workbook and the worksheet (or just the worksheet if apropos)
    5. Set the appropriate "sharing" roles and such
    6. Save the workbook to the database.
    7. Save the workbook to your computer.
    8. Log out of Desktop.
    9. Log back into Desktop as whatever, whoever you usually are to work.
    10. elect "open existing workbook"
    11. Select icon for "open from my computer". See? I told you it would get better!
    12. Open the save .dis file from your computer.
    13. Save it to the database.
    14. Open a web browser and from there, you're on your own.
    Fortran in VMS. Much easier and faster. I'm convinced the proliferation of the web is a detriment to the world at large...On the other hand, I'm also waiting for the Dodgers to return to Brooklyn.

  • Using Like Clause in Prepared Statement

    Hi,
    I want to use LIKE clause in prepared statement. This is not returning any record.
    This is the query. Please help me in this.
    SELECT EMPLYR_GRP,EMPLYR_GRP_NAME FROM EMPLOYER_GROUP WHERE EMPLYR_GRP_NAME LIKE ? AND EMPLYR_GRP = ?
    This is giving Oracle SQL Error.
    SELECT EMPLYR_GRP,EMPLYR_GRP_NAME FROM EMPLOYER_GROUP WHERE EMPLYR_GRP_NAME LIKE %?% AND EMPLYR_GRP = ?

    The first variant should work just fine as long as you use stmt.setString(1, '%' + pattern + '%') to set the parameter. The second query is just plain wrong.
    Alin.

  • Performance hit using "where" clause in the query

    Hi All,
    I am facing a huge performance hit in the java code when using "where" clause in queries. Following are the details:
    1. SELECT * FROM Employee
    2. SELECT * FROM Employee where employeeid in (26,200,330,571,618,945)
    There is no difference in Query Execution Time for both queries.
    Business Logic Time is huge in second case as compared to first one (ratio - 1:20).
    Rows returned are more in first case as compared to second case.(ratio - 1:4)
    Business Logic is same for both the cases where I iterate through the ResultSet, get the objects and set them in a data structure.
    Does anybody know the reason of unexpected time difference for the business logic in the second case?

    Since you're mentioning clustering your index, I'll assume you are using Oracle. Knowing what database you are using makes it a lot easier to suggest things.
    Since you are using Oracle, you can get the database to tell you what execution plan it is using for each of the 2 SQL statements, and figure out why they have similar times (if they do).
    First, you need to be able to run SQL*Plus; that comes as part of a standard database installation and as part of the Oracle client installation - getting it set up and running is outside the scope of this forum.
    Second, you may need your DBA to enable autotracing, if it's not already:
    http://asktom.oracle.com/~tkyte/article1/autotrace.html
    http://www.samoratech.com/tips/swenableautotrace.htm
    Once it's all set up, you can log in to your database using sql*plus, issue "SET AUTOTRACE ON", issue queries and get execution plan information back.
    For example:
    SQL> set autotrace on
    SQL> select count(*) from it.ticket where ticket_number between 10 and 20;
      COUNT(*)
            11
    Execution Plan
    Plan hash value: 2983758974
    | Id  | Operation         | Name       | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |            |     1 |     4 |     1   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE   |            |     1 |     4 |            |          |
    |*  2 |   INDEX RANGE SCAN| TICKET_N10 |    12 |    48 |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("TICKET_NUMBER">=10 AND "TICKET_NUMBER"<=20)
    Statistics
              0  recursive calls
              0  db block gets
              1  consistent gets
              0  physical reads
              0  redo size
            515  bytes sent via SQL*Net to client
            469  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processed
    SQL> This tells me that this query used an INDEX RANGE SCAN on index TICKET_N1; the query can't do much better than that logically... In fact, the statistic "1 consistent gets" tells me that Oracle had to examine only one data block to get the answer, also can't do better than that. the statistic, "0 physical reads" tells me that the 1 data block used was already cached in Oracle's memory.
    the above is from Oracle 10g; autotrace is available back to at least 8i, but they've been adding information to the output with each release.
    If you have questions about sql_plus, check the forums at asktom.oracle.com or http://forums.oracle.com/forums/category.jspa?categoryID=18
    since sql*plus is not a JDBC thing...
    Oh, and sql*plus can also give you easier access to timing information, with "set timing on".

  • How to use bind variables using in  clause in SQL

    Hi
    Can any one help me in regards Bind variables usage using in clause in sql for String data?
    thans

    Are you looking for a dynamic IN list? As in something like this:
    SELECT ... FROM .. WHERE some_col IN (<dynamic list of stuff that is always changing>)If so check this out:
    [ How can I do a variable IN list?|http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:210612357425]

  • 'Missing select' error for update statement using WITH clause

    Hi,
    I am getting the below error for update statement using WITH clause
    SQL Error: ORA-00928: missing SELECT keyword
      UPDATE A
      set A.col1 = 'val1'
         where
      A.col2 IN (
      WITH D AS
      SELECT col2 FROM
      (SELECT col2, MIN(datecol) col3 FROM DS
      WHERE <conditions>
        GROUP BY PATIENT) D2
      WHERE
      <conditions on A.col4 and D2.col3>

    Hi,
    The format of a query using WITH is:
    WITH  d  AS
        SELECT  ...  -- sub_query
    SELECT  ...   -- main query
    You don't have a main query.  The keyword FROM has to come immediately after the right ')' that ends the last WITH clause sub-query.
    That explains the problem based on what you posted.  I can't tell if the real problem is in the conditions that you didn't post.
    I hope this answers your question.
    If not, post a complete test script that people can run to re-create the problem and test their ideas.  Include a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
    In the case of a DML operation (such as UPDATE) the sample data should show what the tables are like before the DML, and the results will be the contents of the changed table(s) after the DML.
    Explain, using specific examples, how you get those results from that data.
    Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • Construct a Sql block using With Clause to improve the performance

    I have got four diff parametrized cursor in my Pl/Sql Procedure. As the performance of the Procedure is very pathetic,so i have been asked to tune the Select statements used in those cursors.
    So I am trying to use the With Clause in order to club all those four Select Statements.
    I would appreciate if anybody can help me to construct the Sql Block using With Clause.
    My DB version is..
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    PL/SQL Release 11.1.0.7.0 - Production
    Four Diff cursors are defined below.
    CURSOR all_iss (
          b_batch_end_date   IN   TIMESTAMP,
       IS
          SELECT isb.*
                FROM IMPLMN_STEP_BREKPN  isb
               , ISSUE iss
          WHERE isb.issue_id = iss.issue_id
           AND iss.issue_status_id  =  50738
           AND ewo_no IN
          (SELECT TO_CHAR(wo_no)
            FROM MGO_PLANT_AUDIT
           WHERE dml_status = 'U' OR dml_status = 'I')
          UNION ALL
          SELECT isb.*
           FROM IMPLMN_STEP_BREKPN  isb
            , ISSUE iss
           WHERE isb.issue_id = iss.issue_id
           AND iss.issue_status_id  =  50738
           AND CAST (isb.last_updt_timstm AS TIMESTAMP) >=
                                                                  b_batch_end_date;
          CURSOR ewo_plant  ( p_ewo_no IN  IMPLMN_STEP_BREKPN.ewo_no%TYPE)
          IS
          SELECT DISTINCT wo_no ,
          plant_code
          FROM MGO_PLANT
          WHERE TO_CHAR(wo_no) = p_ewo_no;
          CURSOR iss_ewo_plnt (
          p_issue_id IN IMPLMN_STEP_BREKPN.issue_id%TYPE ,
          p_ewo_no IN IMPLMN_STEP_BREKPN.EWO_NO%TYPE,
          p_plnt_code IN IMPLMN_STEP_BREKPN.PLT_FACLTY_ID%TYPE)
          IS
          SELECT *
          FROM IMPLMN_STEP_BREKPN
          WHERE issue_id = p_issue_id
          AND ewo_no = p_ewo_no
          AND
          (plt_faclty_id = p_plnt_code
          OR
          plt_faclty_id IS NULL);
          CURSOR iss_ewo_plnt_count (
          p_issue_id IN IMPLMN_STEP_BREKPN.issue_id%TYPE ,
          p_ewo_no IN IMPLMN_STEP_BREKPN.EWO_NO%TYPE,
          p_plnt_code IN IMPLMN_STEP_BREKPN.PLT_FACLTY_ID%TYPE)
          IS
          SELECT COUNT(*)
          FROM IMPLMN_STEP_BREKPN
          WHERE issue_id = p_issue_id
          AND ewo_no = p_ewo_no
          AND
          (plt_faclty_id = p_plnt_code
          OR
          plt_faclty_id IS NULL);

    Not tested. Some thing like below. i just made the queries as tables and given name as a,b,c and substituted columns for the parameters used in the 2nd cursor and third cursor. Try like this.
    CURSOR all_iss (
    b_batch_end_date IN TIMESTAMP,
    IS
    select a.*,b.*,c.* from
    ( SELECT isb.*
    FROM IMPLMN_STEP_BREKPN isb
    , ISSUE iss
    WHERE isb.issue_id = iss.issue_id
    AND iss.issue_status_id = 50738
    AND ewo_no IN
    (SELECT TO_CHAR(wo_no)
    FROM MGO_PLANT_AUDIT
    WHERE dml_status = 'U' OR dml_status = 'I')
    UNION ALL
    SELECT isb.*
    FROM IMPLMN_STEP_BREKPN isb
    , ISSUE iss
    WHERE isb.issue_id = iss.issue_id
    AND iss.issue_status_id = 50738
    AND CAST (isb.last_updt_timstm AS TIMESTAMP) >=
    b_batch_end_date) a,
    ( SELECT DISTINCT wo_no ,
    plant_code
    FROM MGO_PLANT
    WHERE TO_CHAR(wo_no) = p_ewo_no) b,
    ( SELECT *
    FROM IMPLMN_STEP_BREKPN
    WHERE issue_id = p_issue_id
    AND ewo_no = p_ewo_no
    plt_faclty_id IS NULL) c
    where b.wo_no = c.ewo_no and
    c.issue_id = a.issue_id ;
    vinodh
    Edited by: Vinodh2 on Jul 11, 2010 12:03 PM

  • How to use From clause as a block datasources

    Hi,
    I want to know how to use from clause as a block datasource.
    Could anyone give me an example to do that? I couldn't find it
    in the help file.
    I sincerely ask someone help me.
    Many thanks
    Diana

    Diana,
    I presume you are getting a "FRM-40505: error unable to perform
    query" when you try to execute query. I suggest you select the
    "Display Error" item from the "Help" menu to see the query that
    Oracle is generating. If the query that Oracle generates as a
    result of your "Query data source name" is not formed correctly,
    you will get the FRM-40505 error.
    Copy and paste the query that is displayed into SQLPLUS and test
    to see what happens when you try to execute the query from
    SQLPLUS. That will give you a better idea of what the cause of
    the problem is.
    From your example, a query that works should look like "select
    c_no from (select c_no from books)".
    Keep in mind that for blocks based on FROM clause, the query that
    produces the data is of the form :
    SELECT <all columns in the block>
    FROM <select statement entered in the "Query Data Source Name"
    blockproperty>
    The data source for the block is the select statement embedded in
    the from clause.
    Hope this helps.

  • How to use RAW partition for Oracle for placing data?

    Dear all,
    I have installed Oracle on a SUN machine and use database mount point /oracle which is a UFS system.
    But now I would like to use RAW partition instead of a UFS system to place Oracle database data...
    The installation guide mentions that database mount points have to be prepared before installation, could I just use /dev/rdsk/c0t0d0s5 as database mount points after partitioning c0t0d0s5?
    I am attempting to create a tablespace in the above partition... Could any experts tell me if the above works?
    Thanks a lot!

    kwan,
    Raw partion is used to store Oracle data files and not Oracle software. Oracle home is going be in regular file system. More than one file can not share the same raw device.
    You create the raw device at the OS level using the OS command. Then create tablespace on Oracle and use the clause DATAFILE 'Raw file Name'
    Hope this helps
    Best,
    G

Maybe you are looking for

  • How can I use the same session for different components acroos application ?

    I am trying to include the components(chat, filesharing, whitboard) in different parts of my application. User should be able to access any of the component. We would like to have a single "ConnectSessionContainer" so that we don't see same user crea

  • Can't open pdf files after downloading from Safari 6.0.5

    I was wondering whether anyone else has encountered this bug. Ihave a retina MBP with Safari and Firefox. If I save a pdf to the desktop via Safari I get the following message when I try to open it "There was an error opening this document. The file

  • How to copy an Excel, Word, music or video file from my Windows computer to iphone 4s?

    I am using my new iphone 4s for 2 weeks now.  I am not able to copy my favourite old music and video files and some useful Excel, Word and Pdf files from my Sony Vaio.  Why doesn't it allow for copy paste when it is connected to my laptop by USB cabl

  • DVI to HDMI overscan issue 1080p

    Hello, I have a LCD Samsung LE46A656 FullHD and a new macbook pro late 2008. And have the 1080p resolution sized in mac osx but on the lcd left and right a black free place. i see this thread, and a solution for 720p, now i search one for 1080p: http

  • I just got the latest iPad to replace my 1st generation iPad.

    I have one set of contacts on my iPhone and a different set on the first iPad. How do I combine them both in iCloud so that I can get it on the newest iPad without losing any? I assume that once I get them combined, iCloud will keep them all in sync.