How the below query is working

Hi,
I am newly joined in the group.
the emp table has 5 rows as below
100     ram     10000.00     10
200     kumar     15000.00     10
300     william     20000.00     10
400     ravi     25000.00     10
500     victor     30000.00     10
i execute the below query
select ename,sal from emp_test where case when sal < 10000 then sal + 1000
when sal < 20000 then sal + 2000
else sal
end < 20000
it gives the below output
ram     10000.00
kumar     15000.00
How the above query is working?
Please explain. thanks in advance

If you want it to show the changed salary, it has to be in the select line not the where:
select ename,
       (case when sal < 10000 then sal + 1000
           when sal < 20000 then sal + 2000
           else sal
        end) sal from emp_test
where  case when sal < 10000 then sal + 1000
           when sal < 20000 then sal + 2000
           else sal
        end < 20000

Similar Messages

  • How the Drill down functionality works if the source is Bex Query

    Dear All,
    How the Drill down functionality works if the source is Bex Query through the query browser in Dashboard 4.1
    Please let me know process.
    Thanks
    Regards,
    Sai

    Hi sai,
    Drill down can be done by two ways.
    1. you need to bring all the data in one shot to the spreadsheet and then by using the components you can achieve it. Below given link explains in detailed about that.
    Filtering Through Combo Box
    2. you can use different set of query to pass the value from one set to another to fetch the data using the prompt. please check the below which explain them.
    Difference between "When value Becomes & When value Changes"
    Revert any clarification required on this.
    --SumanT

  • How to execute the output of the below query automatically

    Hi All,
    I want to execute the output of the below query automatically, instead of manually copying it and execute.
    select 'alter database ['+name+'] set recovery simple' from master.sys.databases where database_id > 4 and state_desc = 'online'
    Please provide me a script to do this.
    ThanK
    Kate

    EXEC sp_MSforeachdb N'ALTER DATABASE [?] SET recovery simple';--- This will set the recovery model for all the system database.The query provided by Vikash16, meets my requirement. Thank you.

  • How the Sun Java Forums Work (Briefly)

    I am wondering if anyone could give me a brief overview of how the Java sun forums work -- esp. when someone creates a new thread.
    How exactly does the JSP know to link to that thread? Is it generating a unique ID from the database or using it's own custom code? How does it point to that thread? (I'm SO FRUSTRATED. I've tried to figure this one out for about a MONTH.)
    I've started to create a help desk, where it takes form data and posts it to the database. (That issue solved.) The database assigns it a unique ID -- primary key. I'm having trouble displaying the problem record for that ticket ID. (I'm new to Java and really been pulling my hair over this one for about a month.)
    Let me go into some more detail:
    I have these form objects:
    - Name
    - Technical Summary
    - Severity
    - Problem
    This is a standard html form page. The standard html page posts to a JSP page, where the JSP page uses a prepared statement to insert the form data into the database. The query page, (query.jsp) has a table, which only shows TicketID, Name, Technical Summary, and Severity. Obviously, the TicketID is an int and generated by the DB, as 1, 2, 3, 4, and so on...
    So if someone created an issue it'd be assigned a unique ticket id. Note that from the query page, it DOES not show the problem. I WANT there to be a link to get the problem record in that row.
    If anyone could help me out with this one, that would be great.

    Below is the CORE JSP Query Code. Obviously, I did NOT post the HTML b/c that would look **REALLY** weird. Any help on resolving my problem, would relly be helpful! Please hep! :)
    <%@ page import="java.sql.*"%>
    <%
    String first_name = user.getFirstName();
    String last_name = user.getLastName();
    %>
    <%
    String userid = user.getUserId();
    %>
    <%
    Connection conn = null;
    Statement stmt = null;
    ResultSet rs = null;
    try {
    Class.forName ("com.mysql.jdbc.Driver");
    conn = DriverManager.getConnection( "jdbc:mysql://localhost:3306/helpdesk", "root", "password" );
    stmt = conn.createStatement ();
    rs = stmt.executeQuery ("SELECT * FROM history WHERE userid = '"+userid+"' ");
    %>
    <% while( rs.next() ){%>
    <%
    int ticketid = rs.getInt("ticketid");
    String technical_subject = rs.getString("technical_subject");
    session.setAttribute("technical_subject", technical_subject);
    %>
    <TR>
    <TD width="76" align="center">
                   <font face="Arial" style="font-size: 8pt"> <%out.println(ticketid);%> </font></TD>
                   <TD align="center" width="131">
                   <font face="Arial" style="font-size: 8pt"> <%=rs.getString("severity")%> </font></TD>
                   <TD align="center">
                   <font face="Arial" style="font-size: 8pt"> <%=rs.getString("issue_type")%> </font></TD>
                   <TD align="center">
                   <font face="Arial" style="font-size: 8pt"> <%out.println(technical_subject);%> </font></TD>
                   <TD align="center">
                   <font face="Arial" style="font-size: 8pt; font-weight: 700">View
                   Complete Issue</font></TD>
    </TR>
    <%}%>
    </TABLE>
    </BODY>
    </HTML>
    <%
    }catch
         (Exception e){
    out.println("There was an exception. Stack trace will be printed to the error log.");
    e.printStackTrace();
    System.out.println ("A fatal exception occured when fetching the database results. See the stack trace error for more information. Verify you are requesteting the correct data type");
    }finally{
    //this is important. You should close all three to free up resources. Always. In a finally block.
    rs.close();
    stmt.close();
    conn.close();
    %>

  • Spell Check in New Forums- How The Heck does it work?

    Can somebody please tell me how the spell check works in this new forum format? I click on the abc icon and it does nothing. I do a two finger click on a word that is misspelled and it give me Insert Options. I really like the new format but hate the spell check. Can anyone offer advise? Thanks.

    The built-in ASC spell checker is -- to put it kindly -- quirky. First, you must turn it on using the 'abc' tool on the right in the editor toolbar. (When it's on, it highlights.) But it won't stay turned on if you click on the tool before you enter any text -- it will just tell you that no misspellings were found & won't stay on. It also sometimes fails to check the last word if followed by a space. You can tell it to ignore misspellings, but you can't tell it to learn words because the spell-checking dictionary is actually on the servers running the site, not on your Mac or PC.
    But from your remarks, you probably aren't even using the built-in checker. Instead, I suspect you are trying to use the far superior system-wide one built into OS X. The problem with that is the ASC editing tools are powered by Javascript supplied by the Jive SBS software running the site. Because that is platform independent it doesn't know anything about OS X's contextual menu (which includes suggestions for misspellings, the Dictionary lookup, & so on).
    So to make a long story short, what happens when you try to right click on a word the OS X checker has underlined in red, instead you get the Javascript's response to a right click, which brings up the editor's insert/alignment popup menu instead of the OS X contextual menu.
    The solution is to control click on the word -- believe it or not, within the ASC editor window a right click & a control click are not the same thing! You literally have to hold down the control key on the keyboard when you click to bypass the Javascript's right click response.
    To make things that much more confusing, this only applies if the pointer is not over empty space in the editor window, which in this case excludes lines that have any text on them, including invisible text like spaces or returns. (To see what I mean, drag the tab at the bottom right of the editor window down so there is a lot of empty space below what you have typed. In this empty area, right & control clicks both bring up the OS X contextual menu, but anywhere in the text you have typed, they behave differently.)
    In short, the problem is not that Apple has changed how the buttons or clicks work, it is that the new software that runs the site (not developed by Apple) does.
    Hope this helps.

  • I am getting "Invalid Identifier" while running the below query

    Iam getting the error "Invalid Identifier, c_rank" while running the below query. Please help.
    select a.*, b.pog_description pog_description, b.start_date,
    row_number() over(partition by b.pog_description order by b.start_date) c_rank
    from temp_codi_dept_35 a, pog_master_msi b, pog_skus_msi c
    where a.sku = c.pog_sku
    and b.pog_id = c.pog_id
    and b.pog_dept = c.pog_dept
    and b.pog_number = c.pog_number
    and b.pog_level = c.pog_level
    and a.sku = 10263477
    and c_rank = 1;

    >
    Iam getting the error "Invalid Identifier, c_rank" while running the below query. Please help.
    select a.*, b.pog_description pog_description, b.start_date,
    row_number() over(partition by b.pog_description order by b.start_date) c_rank
    from temp_codi_dept_35 a, pog_master_msi b, pog_skus_msi c
    where a.sku = c.pog_sku
    and b.pog_id = c.pog_id
    and b.pog_dept = c.pog_dept
    and b.pog_number = c.pog_number
    and b.pog_level = c.pog_level
    and a.sku = 10263477
    and c_rank = 1;
    >
    You can't use 'c_rank' in the where clause because it doesn't exist; you are computing it in the SELECT clause.
    Remove the last condition and wrap your query in another one to select by 'c_rank'.

  • How the stock determination process works

    Hi All
    Can any one tell me how the stock determination process works in inventory management?
    if possible give me the steps involved in stock determination process .
    Regards
    M S K

    Hi
    i hope this helps
    http://help.sap.com/saphelp_47x200/helpdata/en/d8/2f3746996611d1b5480000e82de955/frameset.htm
    regards
    maniraj

  • How the SQL Query Parsing is processing inside SQL/PLSQL engine?

    Hi all,
    Can you explain how the SQL Query Parsing is processing inside SQL/PLSQL engine?
    Thanks,
    Sankar

    Sankar,
    Oracle Database concepts - Chapter 24..
    You will find the explanation required under the heading parsing.
    http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14220/sqlplsql.htm

  • Request for tunning the below query

    Hi,
    Can any one help me on the below query while improving the performance,
    SELECT accdet, acceprec, accinvalid, accnetanal, accphy, accvalid,
    actlabcost, actlabhrs, actualcontactdate, actualfinish, actualstart,
    affecteddate, affectedemail, affectedperson, affectedphone,
    alteration, aslaiddwg, assetnum, assetorgid, assetsiteid,
    assumptions, basedet, basereq, bicounty, bidplo, bieasting,
    bihousename, bihouseno, binorthing, bipobox, bipostcode, biposttown,
    bistreet, bisubb as bisupp, boostcomp, boostcompdet, ccemail, cchouseno, ccid,
    ccname, cctel1type, cctel2type, cctelephone1, cctelephone2, cdm,
    changeby, changedate, CLASS, classstructureid, cocontact, cocounty,
    codplo, coeasment, coeasting, cohousename, conorthing, copobox,
    commodity, commoditygroup, coneasereq, consent, consents,
    copostcode, coposttown, costcon, costreet, cosubb, cpi90,
    createworelasset, customerref, custtype, depot, description, durt,
    ecvpressuretier, ecvsize, enduserid, engdifficult, exaoq, existin,
    existsdq, expid, exshq, externalrecid, extralanddetail, failurecode,
    fr1code, fr2code, fuelpovscheme, g17, gbna, glaccount,
    globalticketclass, globalticketid, govconf, govener, govenerdet,
    govhouse, hasactivity, hasld, historyflag, impact, infill,
    infoprovide, inheritstatus, internalpriority, interquote, isglobal,
    isknownerror, isknownerrordate, kioskdet, kioskreq, langcode,
    latecertdate, leadt, lengthpri, lengthpub, loadtype, LOCATION, m25,
    maindesac, mainusage, meterboxty, metercon, meterloc, meterser,
    mininforec, mininforeq, mprnno, newaoq, newpid, newsdq, newshq,
    np14, nrswa, nsgno, oldquotever, oldticketid, orgid, originsgn,
    origrecordclass, origrecordid, origrecorgid, origrecsiteid, owner,
    ownergroup, packagesent, paymethod, payterms, permittowork, physub,
    pressuretier, privateexc, problemcode, propertiesno, propertytype,
    publicexc, purgerel, quotedate, quotetype, quotever, reinforcement,
    reinforcementa, reinforcementb, relatedtoglobal, reportdate,
    reportedby, reportedemail, reportedphone, reportedpriority,
    rowstamp, sc, scj, scoreq, servicerelay, sgnbillcontact,
    sgnblkbyfin, sgncusttobill, sgncusttosite, sgndisreasoth,
    sgneasment, sgnenhance, sgneow, sgneowreq, sgngqmvalid,
    sgninfillcost, sgninfillver, sgninfprojno, sgnisstdchrg,
    sgnloadnoenter, sgnmainsreq, sgnmaxaccdate, sgnnoncont, sgnpipesiz,
    sgnpurord, sgnqdaysremain, sgnqstd, sgnquotdate, sgnquotval,
    sgnreasdis, sgntotalaoq, sgntotalshq, sgnvarreq, sicontact,
    sicounty, sidplo, sieasting, sihousename, sihouseno, sinorthing,
    sipobox, sipostcode, siposttown, sistreet, sisubb, sitecond, sitegt,
    siteid, sitel1, sitel2, siteplpro, sitevisit, solution, sos,
    sosrecdate, SOURCE, status, statusdate, subfinal, supervisor,
    supplytype, surveycarr, surveydef, surveyreas, surveyreq, surveyret,
    surveysent, targetcontactdate, targetfinish, targetstart, TEMPLATE,
    templateid, termtype, thirdpartyeas, thirdpartypipe, ticketid,
    ticketuid, totalaoq, totalpid, totalsdq, totalshq, traffictime,
    typewo, urgency, variat, vendor, customer_enquiry_ref,
    quote_version, costs, mains_infill_charge, mtr_housing_kiosk_charge,
    mtr_housing_kiosk_base_charge, specialist_reinstatement,
    easement_charge, total_quote_ex_vat, vat, total_quote_incl_vat,
    design_charge, reinforcement_charge, reinforcement_cost,
    connection_allowance, workorder.pscdate, workorder.ascdate,
    workorder.fincode, workorder.istask, workorder.status,
    workorder.targstartdate, workorder.targcompdate,
    workorder.schedfinish, workorder.actfinish, workorder.estdur,
    workorder.wonum, workorder.mprn,
    workorder.sihousename AS wositehousename,
    workorder.sihouseno AS wositehouseno,
    workorder.sistreet AS wositestreet,
    workorder.sicounty AS wositecounty,
    workorder.siposttown AS wositeposttown,
    workorder.sipostcode AS wositepostcode, workorder.workorderid
    FROM (maximo.sr
    INNER JOIN
    (maximo.relatedrecord INNER JOIN maximo.workorder
    ON relatedrecord.relatedreckey =
    (CASE
    WHEN workorder.PARENT IS NOT NULL
    THEN workorder.PARENT
    ELSE workorder.wonum
    END
    AND relatedrecord.orgid = workorder.orgid
    AND relatedrecord.siteid = workorder.siteid
    AND relatedrecord.relatedrecclass = 'WORKORDER')
    ON sr.ticketid = relatedrecord.recordkey
    AND sr.orgid = relatedrecord.orgid
    AND sr.siteid = relatedrecord.siteid
    AND relatedrecord.CLASS = 'SR')
    LEFT JOIN
    frozen_quote@gqmfof
    ON sr.ticketid = customer_enquiry_ref
    AND sr.quotever = quote_version
    Regards,
    grace

    Could you please provide more info.
    Refer to the following link.
    When your query takes too long ...
    thanks

  • How can I replace the cursor in the below query?

    I have this below query which calls a stored procedure that takes only 1 item's attributes at a time. But because of performance problems we are
    required to remove the cursor. How can I replace the below cursor logic with set operations or CTE? Please advice.
    DECLARE db_cursor_ava CURSOR
    FOR
    SELECT t.[agent-id],
    t.[start-date],
    t.[end-date],
    t.[monitor-days],
    t.[monitor-start],
    t.[monitor-end],
    t.[timezone-offset]
    FROM @tmpAgentPeriodTimeRange t
    OPEN db_cursor_ava
    FETCH NEXT FROM db_cursor_ava INTO @agentID_ava,
    @stDateTime_ava,
    @endDateTime_ava,
    @monDays_ava,
    @monSt_ava,
    @monEnd_ava,
    @offset_ava
    WHILE @@FETCH_STATUS = 0
    BEGIN
    DELETE
    FROM @tmpMonitorPeriod
    DELETE
    FROM @tmpFinalResult
    SET @runID = 1
    IF(@endDateTime_ava>DATEADD(MI,@offset_ava, GETUTCDATE()))
    BEGIN
    SET @endDateTime_ava=DATEADD(MI,@offset_ava, GETUTCDATE())
    END
    INSERT INTO @tmpMonitorPeriod
    EXEC core.usp_GetMonitoringPeriod
    @startDate = @stDateTime_ava,
    @endDate = @endDateTime_ava,
    @monitoringDays = @monDays_ava,
    @monitoringStart = @monSt_ava,
    @monitoringEnd = @monEnd_ava
    SELECT @maxID = MAX(tm.id)
    FROM @tmpMonitorPeriod tm
    FETCH NEXT FROM db_cursor_ava INTO @agentID_ava,
    @stDateTime_ava,
    @endDateTime_ava,
    @monDays_ava,
    @monSt_ava,
    @monEnd_ava,
    @offset_ava
    END
    CLOSE db_cursor_ava
    DEALLOCATE db_cursor_ava
    mayooran99

    You've been down this path before  - and the response is exactly the same.
    how to replace cursor logic
    And I'll suggest that you post the entire code - since you repeatedly delete 2 table variables but only populate one. The setting of @maxID also seems to have no purpose. And perhaps the issue here isn't the cursor but the general approach.  Who knows
    - but it appears you may have prematurely assumed that the cursor is the problem.

  • Need help on the below query or Pl-SQL

    Hello Every one,
    Please let me know if some one can help me out with the below scenario either in pl-sql or sql.
    Source Data:
    0000253800     0.25          0845A     0900A
    0000253800     1          0900A     1000A
    0000253800     1          1300P     1400P
    0000253800     1          1500P     1600P
    0000253800     1          1600P     1700P
    Output needed:
    0000253800     1.25          0845A     1000A
    0000253800     1          1300P     1400P
    0000253800     2          1500P     1700P
    Thanks in Advance....
    Edited by: user12564103 on Dec 11, 2011 5:54 PM

    Hi,
    Welcome to the forum!
    Depending on your data and your requirements:
    WITH     got_times     AS
         SELECT     column_1, column_2, column_3, column_4
         ,     TO_DATE ( substr (column_3, 1, 4)
                   , 'HH24MI'
                   )     AS time_3
         ,     TO_DATE ( SUBSTR (column_4, 1, 4)
                   , 'HH24MI'
                   )     AS time_4
         FROM     table_x
    ,     got_grp_id     AS
         SELECT     column_1, column_2, column_3, column_4
         ,     time_3, time_4
         ,     time_4 - SUM (time_4 - time_3) OVER ( PARTITION BY  column_1
                                        ORDER BY         time_3
                                      )     AS grp_id
         FROM     got_times
    SELECT       column_1
    ,       SUM (column_2)     AS sum_2
    ,       MIN (column_3) KEEP (DENSE_RANK FIRST ORDER BY time_3)
                        AS min_3
    ,       MAX (column_4) KEEP (DENSE_RANK LAST  ORDER BY time_4)
                        AS max_4
    FROM       got_grp_id
    GROUP BY  column_1
    ,       grp_id
    ORDER BY  column_1
    ,       grp_id
    ;Whenever you have a problem, please post CREATE TABLE and INSERT statements for your sample data, as well as the results you want from that data. Explain, with specific examples, how you get the results you want from that data.
    Always say which version of Oracle you're using. The query above will work in Oracle 9.1 (and higher).
    Since this is your first thread, I'll do this for you:
    CREATE TABLE     table_x
    (     column_1     NUMBER
    ,     column_2     NUMBER
    ,     column_3     VARCHAR2 (5)
    ,     column_4     VARCHAR2 (5)
    INSERT INTO table_x (column_1, column_2, column_3, column_4) VALUES (253800, .25, '0845A', '0900A');
    INSERT INTO table_x (column_1, column_2, column_3, column_4) VALUES (253800, 1,   '0900A', '1000A');
    INSERT INTO table_x (column_1, column_2, column_3, column_4) VALUES (253800, 1,   '1300P', '1400P');
    INSERT INTO table_x (column_1, column_2, column_3, column_4) VALUES (253800, 1,   '1500P', '1600P');
    INSERT INTO table_x (column_1, column_2, column_3, column_4) VALUES (253800, 1,   '1600P', '1700P');Column_1 identifes a day.
    Column_2 is an amount that I need to total.
    Column_3 and column_4 are starting and ending times. We can assume that they are all valid times (in 'HH24MI' format, plus a redundant 'A' or 'P') on the same day, column_3 is always less than column_4, and that the range of two rows for the same value of column_1 never overlap. Column_4 of one row may be equal to column_3 of another rows with the same column_1, but it will never be greater.
    Each row of the output represent a contiguous group of rows (each ending exactly when the next one begins) with the same column_1, with the common column_1, the total of column_2, and the range of the group.
    For example, the first two rows for a single group, because they have the same value for column_1, and one ends exactly when the other begins (at 9:00 AM). This group represents day 253800, from 8:45 AM to 10:00 AM. The totla of column_2 fro this group is .25 + 1 = 1.25.
    The next row (from 1:00 PM to 2:00 PM) is a group all by itself, because there is a gap one either side of it separating it from its nearest neighbor on the same day."
    Of course, I'm guessing at lots of things.
    Edited by: Frank Kulash on Dec 11, 2011 9:44 PM
    Changed TO_DATE calls.
    Edited by: Frank Kulash on Dec 11, 2011 9:52 PM
    Added sample question.

  • Reduce the execution time for the below query

    Hi,
    Please help me to reduce the execution time on the following query .. if any tuning is possible.
    I have a table A with the columns :
    ID , ORG_LINEAGE , INCLUDE_IND ( -- the org lineage is a string of ID's. If ID 5 reports to 4 and 4 to 1 .. the lineage for 5 will be stored as the string -1-4-5)
    Below is the query ..
    select ID
    from A a
    where INCLUDE_IND = '1' and
    exists (
    select 1
    from A b
    where b.ID = '5'
    and b.ORG_LINEAGE like '%-'||a.ID||'-%'
    order by ORG_LINEAGE;
    The only constraint on the table A is the primary key on the ID column.
    Following will be the execution plan :
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=406 Card=379 Bytes=2
    653)
    1 0 SORT (ORDER BY) (Cost=27 Card=379 Bytes=2653)
    2 1 FILTER
    3 2 TABLE ACCESS (FULL) OF 'A' (Cost=24 Card
    =379 Bytes=2653)
    4 2 TABLE ACCESS (BY INDEX ROWID) OF 'A' (Co
    st=1 Card=1 Bytes=6)
    5 4 INDEX (RANGE SCAN) OF 'ORG_LINEAGE'
    (NON-UNIQUE)

    I order it by the org_lineage to get the first person. So it is a result problem? The order by doesn't give you the first person, it gives you a sorted result set (of which there may be zero, one, or thousands).
    If you only want one row from that, then you're spending a lot of time tuning the wrong query.
    How do you know which ORG_LINEAGE row you want?
    Maybe it would help if you posted some sample data.

  • How the Replacement path is working in the variable.

    Hi SDNers,
    Can any one give the scenario, how the processing type "Replacement path" is working in the variable.
    Thanks,
    Satya

    Hi,
    For example..
    If you want to find the Ton 10 customers for company you will develop a query and based on some condition you will get the top 10 customers.. and again if you want to see the top 10 customers sales or products what they purchased then you go for another query to develop. In this case.
    In the second query create a variable on Customer object with Replacement path as processing type in that you have to mention the previous query (i.e., top 10 customers). Then it gets the values of top 10 customers from the previous query and generates the report for requirement you want.
    Hope this is clear.
    Veerendra.

  • How the below querry can be tuned

    Hi,
    Below is my querry. I just need a technique and how a below querry can be tuned
    SELECT DISTINCT rop1.routingid,rh.routing_id,rh.start_date,rh.location_id,rh.material
    FROM mst_routing_header rh,MST_ROUTINGOPERATION rop1
    WHERE (rop1.routingid,rh.material,rh.location_id) IN (SELECT DISTINCT rop.routingid,itm.mfr_item_id,ibr.producedlocationid
    FROM MST_ITEM itm,MST_ROUTINGHEADER rthdr,MST_ITEMBOMROUTING ibr,MST_ROUTINGOPERATION rop
    WHERE rthdr.routingid =ibr.routingid
    AND rthdr.location_id =ibr.producedlocationid
    AND ibr.produceditemid=itm.item_id
    AND rthdr.routingid=rop.routingid
    AND rthdr.location_id=rop.location_id
    AND rthdr.routingtype='TEST'
    AND ibr.sys_ent_state='ACTIVE'
    AND rthdr.sys_ent_state='ACTIVE'
    AND rop.sys_ent_state='NEW')
    AND rh.sys_ent_state='ACTIVE';
    Thanks in advance

    AFAIK,
    A very traditional way if you dont know how to read plan table.
    SELECT DISTINCT a.routing_id
         , a.platform
         , a.equipment_group
         , a.equipment_category
         , a.priority as eqpp
         , b.priority as rdtlp
    FROM   mst_equipment_priority  a
         , mst_routing_detail      b
         , mst_resource_master     c
    WHERE  a.routing_id = l_routingid
    AND    a.routing_id=b.routing_id
    AND    a.platform=b.platform
    AND    b.platform in
           ( SELECT DISTINCT platform
             FROM   mst_routing_detail
             WHERE  routing_id = l_routingid )
    AND    a.equipment_group = c.equipment_group
    AND    a.equipment_category = c.equipment_category
    AND    c.planning = 'Y'
    AND    c.equipment_type = l_equipment_type
    AND    a.sys_ent_state = 'ACTIVE'
    AND    b.sys_ent_state = 'ACTIVE'
    AND    c.sys_ent_state = 'ACTIVE'
    ORDER BY a.equipment_category DESC,rdtlp ASC, eqpp ASC;As above query just run it through by making remarks at
    SELECT DISTINCT a.routing_id
         , a.platform
         , a.equipment_group
         , a.equipment_category
         , a.priority as eqpp
         , b.priority as rdtlp
    FROM   mst_equipment_priority  a
         , mst_routing_detail      b
         , mst_resource_master     c
    WHERE  a.routing_id = l_routingid
    AND    a.routing_id=b.routing_id
    AND    a.platform=b.platform
    --AND    b.platform in
    --       ( SELECT DISTINCT platform
    --         FROM   mst_routing_detail
    --         WHERE  routing_id = l_routingid )
    AND    a.equipment_group = c.equipment_group
    AND    a.equipment_category = c.equipment_category
    AND    c.planning = 'Y'
    AND    c.equipment_type = l_equipment_type
    AND    a.sys_ent_state = 'ACTIVE'
    AND    b.sys_ent_state = 'ACTIVE'
    AND    c.sys_ent_state = 'ACTIVE'
    ORDER BY a.equipment_category DESC,rdtlp ASC, eqpp ASC;See is it the performance killer if not then remove DISTINCT from yours main query and see the is it main performance killer.
    SELECT a.routing_id
         , a.platform
         , a.equipment_group
         , a.equipment_category
         , a.priority as eqpp
         , b.priority as rdtlp
    FROM   mst_equipment_priority  a
         , mst_routing_detail      b
         , mst_resource_master     c
    WHERE  a.routing_id = l_routingid
    AND    a.routing_id=b.routing_id
    AND    a.platform=b.platform
    AND    b.platform in
           ( SELECT DISTINCT platform
             FROM   mst_routing_detail
             WHERE  routing_id = l_routingid )
    AND    a.equipment_group = c.equipment_group
    AND    a.equipment_category = c.equipment_category
    AND    c.planning = 'Y'
    AND    c.equipment_type = l_equipment_type
    AND    a.sys_ent_state = 'ACTIVE'
    AND    b.sys_ent_state = 'ACTIVE'
    AND    c.sys_ent_state = 'ACTIVE'
    ORDER BY a.equipment_category DESC,rdtlp ASC, eqpp ASC;if not then
    SELECT a.routing_id
         , a.platform
         , a.equipment_group
         , a.equipment_category
         , a.priority as eqpp
         , b.priority as rdtlp
    FROM   mst_equipment_priority  a
         , mst_routing_detail      b
         , mst_resource_master     c
    WHERE  a.routing_id = l_routingid
    AND    a.routing_id=b.routing_id
    AND    a.platform=b.platform
    AND    b.platform in
           ( SELECT DISTINCT platform
             FROM   mst_routing_detail
             WHERE  routing_id = l_routingid )
    AND    a.equipment_group = c.equipment_group
    AND    a.equipment_category = c.equipment_category
    AND    c.planning = 'Y'
    AND    c.equipment_type = l_equipment_type
    AND    a.sys_ent_state = 'ACTIVE'
    AND    b.sys_ent_state = 'ACTIVE'
    AND    c.sys_ent_state = 'ACTIVE'
    --ORDER BY a.equipment_category DESC,rdtlp ASC, eqpp ASC;If not then read yours plan table,and paste it here otherwise no one here can give you clue.
    Khurram

  • How can I learn the details of how the iBA video optimizer works?

    Although I appreciate the work done by the vide optimizer in iBooks Author, results vary depending upon the characteristics of the video I submit to it. Sometimes this is acceptable, sometimes not. I came to this conclusion by adding different versions of the same video clip to the iBA Media Widget and then deconstructing the resulting *.ibooks file and analyzing those video files using MediaInfo.   I think that if I could better understand how the optimizer works I could get more acceptable results.
    So where can I learn more about  how this optimizer works?

    In PO screen(me21n) delivery item tab over-delivery & under- delivery % is there.While creating PO you have to set it.Based on that goods receipt will be done.

Maybe you are looking for

  • Is there a BUG in Aurora under solaris 5.8?

    Mr Ravi is Aurora module certified for solaris 5.8 ? i put the maximum values for java_soft_sessionspace_limit and java_max_sessionspace_size (2147483647 for both) and i still get the Aurora Assertion failure at eox.c:187 we really need to use oracle

  • Linking PE51 Form and SAPScript Form

    I have found quite a few posts on this topic but I didn't find anything conclusive. We have an SAPScript form and a PE51 form. We run the Pre-program DME where we specify the PE51 form name. Then we run the DME program. But the form is not generated.

  • External Java Funcion in a OWF Notification

    In my workflow I need to execute some Java code after a notification (an "External Java") and I meet a problem: The java code (the class name is "JPOST_NOTIFICA") is correctly executed by the "Java Function Agent" (I can see the logs) While I call th

  • How to prevent itunes from connecting to my IOS devices over wifi

    I have a MBP retina that is set to sync  (over wifi) with the iOS devices for myself and my wife: 2 ipads, 1 ipad mini and 2 iphones. When I am launch iTunes in my other Mac - Macbook Air (mid 2010, 13inch, OS X 10.8.2), it will also start to connect

  • JDeveloper is loosing the uix path too often

    Hi there, From time to time I have to re-install JDevelopper version 903 in order to get uix working properly. In the log file of my workspace I have the following error in it. The UIX installable resource files could not be found under the following