Urgent query on joins --Please Help!!

Hi Experts,
We have two table T1 and T2 with A three columns in T1 as A(uniquie constraint and not null )and in table T2 as X.
We need to find rows in T1 for which no value of A exists in X of T2.Please provide your suggestion on the query we can frame for this requirement.
Thanks and Regards
Debashis
Edited by: user13267825 on Aug 27, 2010 3:08 AM

Maybe something like this then:
SELECT a FROM t1 WHERE b = :something
MINUS
SELECT x FROM t2
/ This is a case where it is always helpful to provide the following:
1. Oracle version (SELECT * FROM V$VERSION)
2. Sample data in the form of CREATE / INSERT statements.
3. Expected output
4. Explanation of expected output (A.K.A. "business logic")
5. Use \ tags for #2 and #3. See FAQ (Link on top right side) for details.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Similar Messages

  • Query Using Joins.Please Help

    Hi,
    A Query please
    I have a Customer table and an Order Table
    The customer can place multiple orders
    Create Table Customers
    (Cust_id      number(2),
    cust_name    varchar2(15),
    constraint   pk_custid PRIMARY KEY(Cust_id)
    Create Table Orders
    (Order_no    number(2),
    Cust_id     number(2),
    order_status varchar2(1),
    constraint  pk_orderno PRIMARY KEY(order_no),
    constraint  fk_custid  FOREIGN KEY(cust_id)
    REFERENCES  Customers(cust_id)
    )Now,the Customer table has a single record
    whereas the Order Table has multiple records
    for the same customer.
    SQL> Select * from Orders
    ORDER_NO   CUST_ID ORDER_STATUS
            1         1 P
            2         1 PI'd like to view the different orders for that same customer
    Using a simple Join DOES NOT give the right output:
    SQL> Select C.cust_id,C.cust_name,
      2  O.order_no,O.order_status
      3  From Customers C,Orders O
      4  where C.cust_id = O.order_no;
      CUST_ID CUST_NAME        ORDER_NO O
            1 ABCD              1       PThere are 2 records in the Orders Table?
    How to view both the records from Orders Table?
    Do I need to use the EXISTS clause?
    Can someone please help?

    Well, I would have thought that you would join C.cust_id with the O.cust_id (and not O.order_no)???
    SQL> Select C.cust_id,C.cust_name,
      2  O.order_no,O.order_status
      3  From Customers C,Orders O
      4  where C.cust_id = O.order_no;

  • JSP Question..Very Very Urgent....Please help....

    Hi...
    I am working on customizing existing JSP Page. The idea is to retrieve the customer name as show in 1 and send is as run time parameter to SQL query and use the result of select statement to pass it to 2.
    <INPUT TYPE="HIDDEN" NAME="soldtoCustPartyName" VALUE="<%= soldtoCustPartyName %>">.............1
    The above line of code gives the customer name. We need to find the site id for the above customer and pass it to the following line of code. site id will replace the hardcoded number '7945'.
    pageContext.setAttribute("party_site_id", new BigDecimal(7945), PageContext.REQUEST_SCOPE);...............2
    Hence we create database connection to find out site id. The query will return the site id depending upon the customer name as in 1. SQL statement will be something like:
    select site_id from ..... where fixed conditions and sitename = (from 1).
    How can we create SQL statement to take run time values.
    For eg. we do the following to execute Query after connecting to the databse..
    Statement statement = connection.createStatement();
    ResultSet rs = null;
    rs = statement.executeQuery("SELECT party_id from apps.hz_party_sites where cust_name='IBM'");
    <% rs.next(); %>
    <% out.print(rs.getInt("party_id")); %>
    How can the above query be modified to take run time value for cust_name.
    THIS IS VERY VERY URGENT.....PLEASE HELP.......

    Where are these run time values coming from? The user is entering the values into a form with that input?
    If so, then the user will need to submit the form, you need a servlet to process the form, take the value from the parameter with the same name as the input, insert it into the SQL statement, and run the database query, get the results and store them in the context you want.

  • How to know the most queried item? (please help me)

    I'm doing a library's bookkeeping.
    In a report I wanna know what's the book more queried or the most looked. But I dont know how to put the query in SQL.
    can you please tell me?
    the columns in the table are:
    books varchar2(30)
    author varchar2 (30)
    (THERE's NOT any Book_id) or something.
    please help me.

    That's not a Forms question. Please direct your question to the appropriate forum.
    However, using those columns, there is no way to tell the book most queried, unless you store that information yourself, or use some sort of auditing in the database.
    Regards,
    Robin Zimmermann
    Forms Product Management

  • Very urgent!!! Please help! Anybody from Oracle who can help?

    I am using Oracle9i with oracle pool in my JSP for database handling.
    I am using OracleConnectionCacheImpl and OracleConnectionCacheImpl.DYNAMIC_SCHEME.
    I am also setting max and min limit for connections
    ocacheimpl.setMinLimit (5);
    ocacheimpl.setMaxLimit (10);
    I have used a startup servlet that loads on tomcat startup
    creating pool ( that is, OracleConnectionCacheImpl)
    This OracleConnectionCacheImpl in then I am putting as
    application wide object and getting access to it in all my JSPs
    Initially it creates 5 connections. But after some time (2 hrs or
    so) all the connections are getting killed. (I can see this
    from the "Sessions" tab of the enterprise manager)
    Now if I request my JSP then I get error. But after around 30mins
    again 5 connections are created automatically( I hope thats what
    DYNAMIC_SCHEME would do) and then my JSp works.
    My question is why all connections are getting killed and why it
    takes so much time to reset the connections again!
    Is Oracle's DYNAMIC_SCHEME has got some bug? or I have to do
    some settings in my oracle server. Please help
    I am using oracle9i in Japanese OS(Windows).

    Check once *REMADV *.
    Amit.

  • Urgent iMovie 6 Question--PLEASE HELP!!!

    Hey everyone in the Support Community,
    I was recently editing a school project on iMovie 6 (on a Mac OS X Tiger 10.4.11) when the screen just froze. Nothing on the entire screen would respond. So I foolishly pulled the plug on the computer, and when I turned it back on, I was unable to open the movie file. I would double click on the icon, it would load about a third of the way, and then iMovie would quit. Because it always stopped loading and quit at the same point, I figure I corrupted a file by pulling the plug. So, basically, I screwed up an iMovie file and now can't open it.
    (This is where it would always lock up)
    (And here's what happened)
    I am really clueless about what to do. I tried searching web forums, spent a half-hour just trying to brute force it, and even called the Apple Support Hotline (they apparently don't offer assistance for computers/apps as old as mine ) If I haven't been clear enough about the problem, I'd be happy to give any additional information.
    I would super-appreciate any help. This project needs to be completed by this coming Tuesday (it's currently Friday) and I have a couple other guys relying on me to finish up the editing. PLEASE HELP ME!!! I WOULD BE FOREVER GRATEFUL!!!
    -Dannie

    Unless you saved the project it will have become corrupted by that sudden shut-down.
    You may need to re-create the project.
    But first try this:
    Close iMovie. Go to to Home/Library/Preferences and delete the file com.apple.iMovie.plist
    Restart iMovie and reset all your preferences, then try opening that project again.

  • URGENT!!! PLEASE HELP SO URGENT

    okay, so about an hour ago some of my apps werent opening properly so i decided to restart my phone. once i did, HALF of my apps were gone - including pre installed ones. i have tried to reset home layout but it doesnt work. music, mail, camera, facebook, and a lot more apps have been deleted. i tried contacting my service provider but they couldnt do anything. please help me some of my apps that were deleted have a lot of important stuff in there!!

    Try a hard reboot. To do this hold down the power button and home button for ten seconds. After the ten seconds release the home button and wait for the screen to go black again. Once this is complete try to turn the device on again. Do not have the device plugged in during this procedure.
    If that doesn't work put device into DFU mode and restore it through iTunes on your computer. To get into DFU mode plug device in to computer and hole power button and home button for ten seconds, after the ten seconds release the power button and continue to hold the home button until the computer recognizes it is plugged in. ( The device screen will be black and wont turn on once in DFU mode) then just restore it through iTunes.

  • Urgent....PLEASE HELP... FINDER, SAFARI and MAIL acting up

    Hi,
    I have a powerbook G4 17' with 10.4.4 and it will start and all seems fine, but when I am looking through the finder it will relaunch automatically after 1 minute or so, and then I have to reopen the finder. Then Safari won't open, it does a one bounce and stops as does Mail.
    I have tried trashing the mail and safari preferences, didn't work, I trashed the icons folder in safari, didn't work. Should I trash everything or what other things should I try before backing up and reloading 10.4??? Please help
    Thanks
    Daniel

    Hi, Daniel. If you have access to another FireWire equipped Mac, then boot your machine into target disk mode (as described in the linked article, below), and move your personal data to the other Mac's Desktop.
    http://docs.info.apple.com/article.html?artnum=58583
    Post back here if you are unable to boot your machine into target disk mode.
    Good luck!

  • How to write this query.. Please Help

    Hello Guys,
    I have a table that contains all possible leave types, it is a look up table. Table name is Att_Leave_Types and data in the table is:
    Leavetype_ID Leavetype_Desc
    1 Annaul
    2 Sick
    3 Casual
    4 Long
    5 Maternity
    Now, another table Att_Emp_Leaves Contains leaves of an employee
    Columns and values are
    Emp_ID leave_date levetype_id
    14210 28-AUG-06 2
    14210 30-AUG-06 3
    14210 12-JUL-06 1
    14210 13-JUL-06 1
    14210 14-JUL-06 1
    6902 27-AUG-06 2
    6902 30-AUG-06 3
    Now i want to get the following result from the query:
    Group by month and year
    list all leavetypes and leaves employee have availved, if no leavetype availved then the result must show 0 for the leavetype. calculate leaves for a month based on leavetype ID.
    This result will help you clear what i result i want by my query.
    MON_YYYY employee_id leavetype_id number_of_leaves
    JUL-2006 14210 1 3
    JUL-2006 14210 2 0
    JUL-2006 14210 3 0
    JUL-2006 14210 4 0
    JU:-2006 14210 5 0
    AUG-2006 14210 1 0
    AUG-2006 14210 2 1
    AUG-2006 14210 3 1
    AUG-2006 14210 4 0
    AUG-2006 14210 5 0
    AUG-2006 6902 1 0
    AUG-2006 6902 2 1
    AUG-2006 6902 3 1
    AUG-2006 6902 4 0
    AUG-2006 6902 5 0
    Please guide me and help me, its very urgent.
    I will be thankful to you.
    Regards,
    Imran Baig

    Here we are:
    DROP TABLE Att_Leave_Types;
    CREATE TABLE Att_Leave_Types
               Leavetype_ID NUMBER
              ,Leavetype_Desc VARCHAR2(30)
    INSERT INTO Att_Leave_Types VALUES(1, 'Annual');
    INSERT INTO Att_Leave_Types VALUES(2, 'Sick');
    INSERT INTO Att_Leave_Types VALUES(3, 'Casual');
    INSERT INTO Att_Leave_Types VALUES(4, 'Long');
    INSERT INTO Att_Leave_Types VALUES(5, 'Maternity');
    DROP TABLE Att_Emp_Leaves;
    CREATE TABLE Att_Emp_Leaves
               Emp_ID NUMBER
              ,leave_date DATE
              ,leavetype_id NUMBER
    INSERT INTO Att_Emp_Leaves VALUES (14210, TO_DATE('01-JUL-2006', 'DD-MON-YYYY'), 1);
    INSERT INTO Att_Emp_Leaves VALUES (14210, TO_DATE('10-JUL-2006', 'DD-MON-YYYY'), 1);
    INSERT INTO Att_Emp_Leaves VALUES (14210, TO_DATE('15-JUL-2006', 'DD-MON-YYYY'), 1);
    INSERT INTO Att_Emp_Leaves VALUES (14210, TO_DATE('15-AUG-2006', 'DD-MON-YYYY'), 2);
    INSERT INTO Att_Emp_Leaves VALUES (14210, TO_DATE('25-AUG-2006', 'DD-MON-YYYY'), 3);
    INSERT INTO Att_Emp_Leaves VALUES (6902, TO_DATE('15-AUG-2006', 'DD-MON-YYYY'), 2);
    INSERT INTO Att_Emp_Leaves VALUES (6902, TO_DATE('25-AUG-2006', 'DD-MON-YYYY'), 3);
    SELECT
              LP.*
              ,EL.Leave_date
    COLUMN Emp_ID FOR 999999
    COLUMN Leave_Month FOR A8
    COLUMN Leavetype_ID FOR 999
    COLUMN Leavetype_desc FOR A10
    COLUMN Leave_Count FOR 999
    SELECT
               LP.Emp_ID
              ,TO_CHAR(LP.Leave_Month, 'MON-YYYY') Leave_Month
              ,LP.Leavetype_ID
              ,LP.Leavetype_desc
              ,COUNT(EL.Emp_ID) Leave_Count
         FROM
              SELECT *
                   FROM
                        SELECT
                                   Emp_ID
                                  ,ADD_MONTHS(Min_Leave_month, RN - 1) Leave_Month
                                  ,Max_Leave_month
                             FROM
                                  SELECT ROWNUM RN FROM
                                       USER_OBJECTS
                                       WHERE ROWNUM <= 100
                                  SELECT
                                             Emp_ID
                                            ,TRUNC(MIN(Leave_date), 'MM') Min_Leave_month
                                            ,TRUNC(MAX(Leave_date), 'MM') Max_Leave_month
                                       FROM Att_Emp_Leaves
                                       GROUP BY Emp_ID
                             WHERE ADD_MONTHS(Min_Leave_month, RN - 1) <= Max_Leave_month
                        ,Att_Leave_Types
                   -- ORDER BY Emp_ID, Leave_Month, Leavetype_ID
              ) LP -- Leave periods
              ,Att_Emp_Leaves EL -- Employee leaves
         WHERE EL.Emp_ID(+) = LP.Emp_ID
              AND EL.Leavetype_ID(+) = LP.Leavetype_ID
              AND EL.Leave_date(+) >= LP.Leave_Month
              AND EL.Leave_date(+) < ADD_MONTHS(LP.Leave_Month, 1)
         GROUP BY
               LP.Emp_ID
              ,LP.Leave_Month
              ,LP.Leavetype_ID
              ,LP.Leavetype_desc
         ORDER BY
               LP.Emp_ID
              ,LP.Leave_Month
              ,LP.Leavetype_ID
    EMP_ID LEAVE_MO LEAVETYPE_ID LEAVETYPE_ LEAVE_COUNT
      6902 AUG-2006            1 Annual               0
      6902 AUG-2006            2 Sick                 1
      6902 AUG-2006            3 Casual               1
      6902 AUG-2006            4 Long                 0
      6902 AUG-2006            5 Maternity            0
    14210 JUL-2006            1 Annual               3
    14210 JUL-2006            2 Sick                 0
    14210 JUL-2006            3 Casual               0
    14210 JUL-2006            4 Long                 0
    14210 JUL-2006            5 Maternity            0
    14210 AUG-2006            1 Annual               0
    14210 AUG-2006            2 Sick                 1
    14210 AUG-2006            3 Casual               1
    14210 AUG-2006            4 Long                 0
    14210 AUG-2006            5 Maternity            0
         BW

  • Sql Query Tuning. Please help me to tune this query

    Hi All ,
    I have this problematic Sql . It is taking huge time to execute. It contains a view CIDV, which i think is the bottleneck.
    I have pasted the query below. I will be pasting TKPROF and explain plan for the same. Please advice me to tune this query.
    SELECT GCC.SEGMENT1 || '.' || GCC.SEGMENT2 || '.' || GCC.SEGMENT3 || '.' ||
           GCC.SEGMENT4 || '.' || GCC.SEGMENT5 || '.' || GCC.SEGMENT6 || '.' ||
           GCC.SEGMENT7 || '.' || GCC.SEGMENT8 || '.' || GCC.SEGMENT9 OFFSET_ACCOUNT,
           OOD.ORGANIZATION_CODE,
           CIDV.SUBINVENTORY_CODE OFFSET_SUBINV,
           MIL.SEGMENT1 || '.' || MIL.SEGMENT2 || '.' || MIL.SEGMENT3 || '.' ||
           MIL.SEGMENT4 || '.' || MIL.SEGMENT5 OFFSET_LOCATOR,
           CIDV.LAST_UPDATE_LOGIN
      FROM APPS.CST_INV_DISTRIBUTION_V       CIDV,
           APPS.GL_CODE_COMBINATIONS         GCC,
           APPS.MTL_ITEM_LOCATIONS           MIL,
           APPS.ORG_ORGANIZATION_DEFINITIONS OOD
    WHERE CIDV.TRANSACTION_ID = :B2
       AND CIDV.PRIMARY_QUANTITY = (-1) * :B1
       AND CIDV.REFERENCE_ACCOUNT = GCC.CODE_COMBINATION_ID
       AND OOD.ORGANIZATION_ID = CIDV.ORGANIZATION_ID
       AND MIL.INVENTORY_LOCATION_ID = CIDV.LOCATOR_ID
       AND GCC.ACCOUNT_TYPE = 'A'****************
    TKPROF
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute  68337     10.32      10.32          0          0          0           0
    Fetch    68337    229.75     936.36      58819    6743323       1121       68232
    total   136675    240.07     946.69      58819    6743323       1121       68232
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 203     (recursive depth: 1)
    Number of plan statistics captured: 1
    Rows (1st) Rows (avg) Rows (max)  Row Source Operation
             1          1          1  MERGE JOIN CARTESIAN (cr=102 pr=15 pw=0 time=193608 us cost=56 size=219 card=1)
             1          1          1   NESTED LOOPS  (cr=100 pr=15 pw=0 time=193483 us cost=53 size=219 card=1)
             1          1          1    NESTED LOOPS  (cr=99 pr=15 pw=0 time=193407 us cost=52 size=215 card=1)
             1          1          1     NESTED LOOPS  (cr=96 pr=15 pw=0 time=193378 us cost=51 size=190 card=1)
             1          1          1      NESTED LOOPS  (cr=93 pr=15 pw=0 time=193284 us cost=49 size=162 card=1)
             1          1          1       NESTED LOOPS  (cr=89 pr=14 pw=0 time=185515 us cost=46 size=138 card=1)
             1          1          1        NESTED LOOPS  (cr=85 pr=12 pw=0 time=157975 us cost=44 size=81 card=1)
             1          1          1         NESTED LOOPS  (cr=83 pr=12 pw=0 time=157925 us cost=43 size=73 card=1)
             1          1          1          NESTED LOOPS  (cr=81 pr=12 pw=0 time=157641 us cost=43 size=132 card=2)
             1          1          1           VIEW  CST_INV_DISTRIBUTION_V (cr=78 pr=12 pw=0 time=156386 us cost=41 size=118 card=2)
             1          1          1            UNION-ALL  (cr=78 pr=12 pw=0 time=156378 us)
             0          0          0             NESTED LOOPS OUTER (cr=44 pr=9 pw=0 time=124997 us cost=20 size=291 card=1)
             0          0          0              NESTED LOOPS  (cr=44 pr=9 pw=0 time=124993 us cost=18 size=255 card=1)
             0          0          0               NESTED LOOPS  (cr=44 pr=9 pw=0 time=124990 us cost=18 size=251 card=1)
            33         33         33                MERGE JOIN CARTESIAN (cr=25 pr=6 pw=0 time=98544 us cost=14 size=192 card=1)
             1          1          1                 NESTED LOOPS OUTER (cr=22 pr=5 pw=0 time=85754 us cost=12 size=156 card=1)
             1          1          1                  NESTED LOOPS  (cr=19 pr=4 pw=0 time=79830 us cost=10 size=120 card=1)
             1          1          1                   NESTED LOOPS OUTER (cr=17 pr=4 pw=0 time=79813 us cost=9 size=113 card=1)
             1          1          1                    NESTED LOOPS  (cr=15 pr=4 pw=0 time=79752 us cost=8 size=106 card=1)
             1          1          1                     NESTED LOOPS  (cr=11 pr=2 pw=0 time=43120 us cost=6 size=93 card=1)
             1          1          1                      NESTED LOOPS  (cr=7 pr=2 pw=0 time=43087 us cost=4 size=83 card=1)
             1          1          1                       NESTED LOOPS  (cr=6 pr=2 pw=0 time=43072 us cost=4 size=80 card=1)
             1          1          1                        TABLE ACCESS BY INDEX ROWID MTL_MATERIAL_TRANSACTIONS (cr=5 pr=2 pw=0 time=43042 us cost=4 size=76 card=1)
             1          1          1                         INDEX UNIQUE SCAN MTL_MATERIAL_TRANSACTIONS_U1 (cr=4 pr=2 pw=0 time=43011 us cost=3 size=0 card=1)(object id 12484094)
             1          1          1                        INDEX UNIQUE SCAN MTL_TRANSACTION_TYPES_U1 (cr=1 pr=0 pw=0 time=20 us cost=0 size=764 card=191)(object id 9983)
             1          1          1                       INDEX UNIQUE SCAN MTL_TXN_SOURCE_TYPES_U1 (cr=1 pr=0 pw=0 time=7 us cost=0 size=54 card=18)(object id 9987)
             1          1          1                      INDEX UNIQUE SCAN MTL_SYSTEM_ITEMS_B_U1 (cr=4 pr=0 pw=0 time=27 us cost=2 size=736324450 card=73632445)(object id 12484155)
             1          1          1                     INDEX UNIQUE SCAN MTL_SYSTEM_ITEMS_TL_U1 (cr=4 pr=2 pw=0 time=36626 us cost=2 size=957481070 card=73652390)(object id 12484137)
             1          1          1                    TABLE ACCESS BY INDEX ROWID MTL_PARAMETERS (cr=2 pr=0 pw=0 time=42 us cost=1 size=3290 card=470)
             1          1          1                     INDEX UNIQUE SCAN MTL_PARAMETERS_U1 (cr=1 pr=0 pw=0 time=28 us cost=0 size=0 card=1)(object id 9847)
             1          1          1                   TABLE ACCESS BY INDEX ROWID MTL_PARAMETERS (cr=2 pr=0 pw=0 time=12 us cost=1 size=3290 card=470)
             1          1          1                    INDEX UNIQUE SCAN MTL_PARAMETERS_U1 (cr=1 pr=0 pw=0 time=7 us cost=0 size=0 card=1)(object id 9847)
             0          0          0                  INDEX RANGE SCAN FND_LOOKUP_VALUES_U1 (cr=3 pr=1 pw=0 time=5915 us cost=2 size=36 card=1)(object id 705891)
            33         33         33                 BUFFER SORT (cr=3 pr=1 pw=0 time=12713 us cost=12 size=36 card=1)
            33         33         33                  INDEX RANGE SCAN FND_LOOKUP_VALUES_U1 (cr=3 pr=1 pw=0 time=12582 us cost=2 size=36 card=1)(object id 705891)
             0          0          0                TABLE ACCESS BY INDEX ROWID MTL_TRANSACTION_ACCOUNTS (cr=19 pr=3 pw=0 time=26591 us cost=4 size=59 card=1)
            66         66         66                 INDEX RANGE SCAN MTL_TRANSACTION_ACCOUNTS_N1 (cr=18 pr=2 pw=0 time=13607 us cost=3 size=0 card=3)(object id 12484127)
             0          0          0               INDEX UNIQUE SCAN MTL_PARAMETERS_U1 (cr=0 pr=0 pw=0 time=0 us cost=0 size=4 card=1)(object id 9847)
             0          0          0              INDEX RANGE SCAN FND_LOOKUP_VALUES_U1 (cr=0 pr=0 pw=0 time=0 us cost=2 size=36 card=1)(object id 705891)
             1          1          1             NESTED LOOPS  (cr=34 pr=3 pw=0 time=31269 us cost=21 size=288 card=1)
             1          1          1              NESTED LOOPS  (cr=30 pr=3 pw=0 time=31161 us cost=19 size=275 card=1)
             1          1          1               NESTED LOOPS  (cr=26 pr=3 pw=0 time=31105 us cost=17 size=265 card=1)
             1          1          1                NESTED LOOPS  (cr=25 pr=3 pw=0 time=31082 us cost=17 size=261 card=1)
             1          1          1                 NESTED LOOPS OUTER (cr=23 pr=3 pw=0 time=31027 us cost=16 size=254 card=1)
             1          1          1                  NESTED LOOPS  (cr=21 pr=3 pw=0 time=30980 us cost=15 size=247 card=1)
             1          1          1                   NESTED LOOPS  (cr=20 pr=3 pw=0 time=30957 us cost=15 size=243 card=1)
             1          1          1                    NESTED LOOPS OUTER (cr=19 pr=3 pw=0 time=30926 us cost=15 size=240 card=1)
             1          1          1                     NESTED LOOPS  (cr=16 pr=3 pw=0 time=30389 us cost=13 size=204 card=1)
             1          1          1                      NESTED LOOPS  (cr=11 pr=0 pw=0 time=665 us cost=9 size=131 card=1)
             1          1          1                       NESTED LOOPS OUTER (cr=8 pr=0 pw=0 time=306 us cost=7 size=95 card=1)
             1          1          1                        TABLE ACCESS BY INDEX ROWID MTL_TRANSACTION_ACCOUNTS (cr=5 pr=0 pw=0 time=37 us cost=5 size=59 card=1)
             2          2          2                         INDEX RANGE SCAN MTL_TRANSACTION_ACCOUNTS_N1 (cr=4 pr=0 pw=0 time=17 us cost=4 size=0 card=3)(object id 12484127)
             1          1          1                        INDEX RANGE SCAN FND_LOOKUP_VALUES_U1 (cr=3 pr=0 pw=0 time=216 us cost=2 size=36 card=1)(object id 705891)
             1          1          1                       INDEX RANGE SCAN FND_LOOKUP_VALUES_U1 (cr=3 pr=0 pw=0 time=352 us cost=2 size=36 card=1)(object id 705891)
             1          1          1                      TABLE ACCESS BY INDEX ROWID MTL_MATERIAL_TRANSACTIONS (cr=5 pr=3 pw=0 time=29716 us cost=4 size=73 card=1)
             1          1          1                       INDEX RANGE SCAN MTL_MATERIAL_TRANSACTIONS_N23 (cr=4 pr=3 pw=0 time=29588 us cost=3 size=0 card=1)(object id 12484133)
             0          0          0                     INDEX RANGE SCAN FND_LOOKUP_VALUES_U1 (cr=3 pr=0 pw=0 time=520 us cost=2 size=36 card=1)(object id 705891)
             1          1          1                    INDEX UNIQUE SCAN MTL_TXN_SOURCE_TYPES_U1 (cr=1 pr=0 pw=0 time=22 us cost=0 size=3 card=1)(object id 9987)
             1          1          1                   INDEX UNIQUE SCAN MTL_TRANSACTION_TYPES_U1 (cr=1 pr=0 pw=0 time=16 us cost=0 size=4 card=1)(object id 9983)
             1          1          1                  TABLE ACCESS BY INDEX ROWID MTL_PARAMETERS (cr=2 pr=0 pw=0 time=34 us cost=1 size=7 card=1)
             1          1          1                   INDEX UNIQUE SCAN MTL_PARAMETERS_U1 (cr=1 pr=0 pw=0 time=19 us cost=0 size=0 card=1)(object id 9847)
             1          1          1                 TABLE ACCESS BY INDEX ROWID MTL_PARAMETERS (cr=2 pr=0 pw=0 time=44 us cost=1 size=7 card=1)
             1          1          1                  INDEX UNIQUE SCAN MTL_PARAMETERS_U1 (cr=1 pr=0 pw=0 time=14 us cost=0 size=0 card=1)(object id 9847)
             1          1          1                INDEX UNIQUE SCAN MTL_PARAMETERS_U1 (cr=1 pr=0 pw=0 time=13 us cost=0 size=4 card=1)(object id 9847)
             1          1          1               INDEX UNIQUE SCAN MTL_SYSTEM_ITEMS_B_U1 (cr=4 pr=0 pw=0 time=49 us cost=2 size=10 card=1)(object id 12484155)
             1          1          1              INDEX UNIQUE SCAN MTL_SYSTEM_ITEMS_TL_U1 (cr=4 pr=0 pw=0 time=96 us cost=2 size=13 card=1)(object id 12484137)
             1          1          1           TABLE ACCESS BY INDEX ROWID HR_ALL_ORGANIZATION_UNITS (cr=3 pr=0 pw=0 time=1246 us cost=1 size=7 card=1)
             1          1          1            INDEX UNIQUE SCAN HR_ORGANIZATION_UNITS_PK (cr=2 pr=0 pw=0 time=24 us cost=0 size=0 card=1)(object id 250158)
             1          1          1          INDEX UNIQUE SCAN HR_ALL_ORGANIZATION_UNTS_TL_PK (cr=2 pr=0 pw=0 time=275 us cost=0 size=7 card=1)(object id 689101)
             1          1          1         TABLE ACCESS BY INDEX ROWID MTL_PARAMETERS (cr=2 pr=0 pw=0 time=38 us cost=1 size=8 card=1)
             1          1          1          INDEX UNIQUE SCAN MTL_PARAMETERS_U1 (cr=1 pr=0 pw=0 time=15 us cost=0 size=0 card=1)(object id 9847)
             1          1          1        TABLE ACCESS BY INDEX ROWID GL_CODE_COMBINATIONS (cr=4 pr=2 pw=0 time=27531 us cost=2 size=57 card=1)
             1          1          1         INDEX UNIQUE SCAN GL_CODE_COMBINATIONS_U1 (cr=3 pr=1 pw=0 time=19925 us cost=1 size=0 card=1)(object id 51426)
             1          1          1       TABLE ACCESS BY INDEX ROWID MTL_ITEM_LOCATIONS (cr=4 pr=1 pw=0 time=7758 us cost=3 size=24 card=1)
             1          1          1        INDEX RANGE SCAN MTL_ITEM_LOCATIONS_U1 (cr=3 pr=0 pw=0 time=51 us cost=2 size=0 card=1)(object id 9761)
             1          1          1      TABLE ACCESS BY INDEX ROWID HR_ORGANIZATION_INFORMATION (cr=3 pr=0 pw=0 time=85 us cost=2 size=28 card=1)
             1          1          1       INDEX RANGE SCAN HR_ORGANIZATION_INFORMATIO_FK2 (cr=2 pr=0 pw=0 time=29 us cost=1 size=0 card=2)(object id 5379798)
             1          1          1     TABLE ACCESS BY INDEX ROWID HR_ORGANIZATION_INFORMATION (cr=3 pr=0 pw=0 time=25 us cost=1 size=25 card=1)
             1          1          1      INDEX RANGE SCAN HR_ORGANIZATION_INFORMATIO_FK2 (cr=2 pr=0 pw=0 time=11 us cost=1 size=0 card=1)(object id 5379798)
             1          1          1    INDEX FULL SCAN GL_SETS_OF_BOOKS_U2 (cr=1 pr=0 pw=0 time=69 us cost=1 size=4 card=1)(object id 1380842)
             1          1          1   BUFFER SORT (cr=2 pr=0 pw=0 time=110 us cost=55 size=0 card=1)
             1          1          1    TABLE ACCESS FULL FND_PRODUCT_GROUPS (cr=2 pr=0 pw=0 time=59 us cost=3 size=0 card=1)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      library cache lock                              2        0.00          0.00
      library cache pin                               2        0.00          0.00
      Disk file operations I/O                      249        0.00          0.00
      db file sequential read                     58819        2.61        714.28
      gc cr grant 2-way                            5198        0.16          4.52
      gc current grant busy                           1        0.00          0.00
      KJC: Wait for msg sends to complete           517        0.00          0.05
      library cache: mutex X                        433        0.01          0.04
      gc cr grant congested                          28        0.08          0.18
      latch: ges resource hash list                   5        0.00          0.00
      gc current block 2-way                        513        0.11          0.61
      gc current block congested                      2        0.00          0.00
      latch: gc element                              16        0.00          0.01
      latch: cache buffers chains                     4        0.00          0.00
      latch: object queue header operation            3        0.00          0.00
    ********************************************************************************

    Explain Plan for the query
    SELECT STATEMENT, GOAL = ALL_ROWS               Cost=56     Cardinality=1     Bytes=219
    MERGE JOIN CARTESIAN               Cost=56     Cardinality=1     Bytes=219
      NESTED LOOPS               Cost=53     Cardinality=1     Bytes=219
       NESTED LOOPS               Cost=52     Cardinality=1     Bytes=215
        NESTED LOOPS               Cost=51     Cardinality=1     Bytes=190
         NESTED LOOPS               Cost=49     Cardinality=1     Bytes=162
          NESTED LOOPS               Cost=46     Cardinality=1     Bytes=138
           NESTED LOOPS               Cost=44     Cardinality=1     Bytes=81
            NESTED LOOPS               Cost=43     Cardinality=1     Bytes=73
             NESTED LOOPS               Cost=43     Cardinality=2     Bytes=132
              VIEW     Object owner=APPS     Object name=CST_INV_DISTRIBUTION_V     Cost=41     Cardinality=2     Bytes=118
               UNION-ALL                         
                NESTED LOOPS OUTER               Cost=20     Cardinality=1     Bytes=291
                 NESTED LOOPS               Cost=18     Cardinality=1     Bytes=255
                  NESTED LOOPS               Cost=18     Cardinality=1     Bytes=251
                   MERGE JOIN CARTESIAN               Cost=14     Cardinality=1     Bytes=192
                    NESTED LOOPS OUTER               Cost=12     Cardinality=1     Bytes=156
                     NESTED LOOPS               Cost=10     Cardinality=1     Bytes=120
                      NESTED LOOPS OUTER               Cost=9     Cardinality=1     Bytes=113
                       NESTED LOOPS               Cost=8     Cardinality=1     Bytes=106
                        NESTED LOOPS               Cost=6     Cardinality=1     Bytes=93
                         NESTED LOOPS               Cost=4     Cardinality=1     Bytes=83
                          NESTED LOOPS               Cost=4     Cardinality=1     Bytes=80
                           TABLE ACCESS BY INDEX ROWID     Object owner=INV     Object name=MTL_MATERIAL_TRANSACTIONS     Cost=4     Cardinality=1     Bytes=76
                            INDEX UNIQUE SCAN     Object owner=INV     Object name=MTL_MATERIAL_TRANSACTIONS_U1     Cost=3     Cardinality=1     
                           INDEX UNIQUE SCAN     Object owner=INV     Object name=MTL_TRANSACTION_TYPES_U1     Cost=0     Cardinality=191     Bytes=764
                          INDEX UNIQUE SCAN     Object owner=INV     Object name=MTL_TXN_SOURCE_TYPES_U1     Cost=0     Cardinality=18     Bytes=54
                         INDEX UNIQUE SCAN     Object owner=INV     Object name=MTL_SYSTEM_ITEMS_B_U1     Cost=2     Cardinality=73632445     Bytes=736324450
                        INDEX UNIQUE SCAN     Object owner=INV     Object name=MTL_SYSTEM_ITEMS_TL_U1     Cost=2     Cardinality=73652390     Bytes=957481070
                       TABLE ACCESS BY INDEX ROWID     Object owner=INV     Object name=MTL_PARAMETERS     Cost=1     Cardinality=470     Bytes=3290
                        INDEX UNIQUE SCAN     Object owner=INV     Object name=MTL_PARAMETERS_U1     Cost=0     Cardinality=1     
                      TABLE ACCESS BY INDEX ROWID     Object owner=INV     Object name=MTL_PARAMETERS     Cost=1     Cardinality=470     Bytes=3290
                       INDEX UNIQUE SCAN     Object owner=INV     Object name=MTL_PARAMETERS_U1     Cost=0     Cardinality=1     
                     INDEX RANGE SCAN     Object owner=APPLSYS     Object name=FND_LOOKUP_VALUES_U1     Cost=2     Cardinality=1     Bytes=36
                    BUFFER SORT               Cost=12     Cardinality=1     Bytes=36
                     INDEX RANGE SCAN     Object owner=APPLSYS     Object name=FND_LOOKUP_VALUES_U1     Cost=2     Cardinality=1     Bytes=36
                   TABLE ACCESS BY INDEX ROWID     Object owner=INV     Object name=MTL_TRANSACTION_ACCOUNTS     Cost=4     Cardinality=1     Bytes=59
                    INDEX RANGE SCAN     Object owner=INV     Object name=MTL_TRANSACTION_ACCOUNTS_N1     Cost=3     Cardinality=3     
                  INDEX UNIQUE SCAN     Object owner=INV     Object name=MTL_PARAMETERS_U1     Cost=0     Cardinality=1     Bytes=4
                 INDEX RANGE SCAN     Object owner=APPLSYS     Object name=FND_LOOKUP_VALUES_U1     Cost=2     Cardinality=1     Bytes=36
                NESTED LOOPS               Cost=21     Cardinality=1     Bytes=288
                 NESTED LOOPS               Cost=19     Cardinality=1     Bytes=275
                  NESTED LOOPS               Cost=17     Cardinality=1     Bytes=265
                   NESTED LOOPS               Cost=17     Cardinality=1     Bytes=261
                    NESTED LOOPS OUTER               Cost=16     Cardinality=1     Bytes=254
                     NESTED LOOPS               Cost=15     Cardinality=1     Bytes=247
                      NESTED LOOPS               Cost=15     Cardinality=1     Bytes=243
                       NESTED LOOPS OUTER               Cost=15     Cardinality=1     Bytes=240
                        NESTED LOOPS               Cost=13     Cardinality=1     Bytes=204
                         NESTED LOOPS               Cost=9     Cardinality=1     Bytes=131
                          NESTED LOOPS OUTER               Cost=7     Cardinality=1     Bytes=95
                           TABLE ACCESS BY INDEX ROWID     Object owner=INV     Object name=MTL_TRANSACTION_ACCOUNTS     Cost=5     Cardinality=1     Bytes=59
                            INDEX RANGE SCAN     Object owner=INV     Object name=MTL_TRANSACTION_ACCOUNTS_N1     Cost=4     Cardinality=3     
                           INDEX RANGE SCAN     Object owner=APPLSYS     Object name=FND_LOOKUP_VALUES_U1     Cost=2     Cardinality=1     Bytes=36
                          INDEX RANGE SCAN     Object owner=APPLSYS     Object name=FND_LOOKUP_VALUES_U1     Cost=2     Cardinality=1     Bytes=36
                         TABLE ACCESS BY INDEX ROWID     Object owner=INV     Object name=MTL_MATERIAL_TRANSACTIONS     Cost=4     Cardinality=1     Bytes=73
                          INDEX RANGE SCAN     Object owner=INV     Object name=MTL_MATERIAL_TRANSACTIONS_N23     Cost=3     Cardinality=1     
                        INDEX RANGE SCAN     Object owner=APPLSYS     Object name=FND_LOOKUP_VALUES_U1     Cost=2     Cardinality=1     Bytes=36
                       INDEX UNIQUE SCAN     Object owner=INV     Object name=MTL_TXN_SOURCE_TYPES_U1     Cost=0     Cardinality=1     Bytes=3
                      INDEX UNIQUE SCAN     Object owner=INV     Object name=MTL_TRANSACTION_TYPES_U1     Cost=0     Cardinality=1     Bytes=4
                     TABLE ACCESS BY INDEX ROWID     Object owner=INV     Object name=MTL_PARAMETERS     Cost=1     Cardinality=1     Bytes=7
                      INDEX UNIQUE SCAN     Object owner=INV     Object name=MTL_PARAMETERS_U1     Cost=0     Cardinality=1     
                    TABLE ACCESS BY INDEX ROWID     Object owner=INV     Object name=MTL_PARAMETERS     Cost=1     Cardinality=1     Bytes=7
                     INDEX UNIQUE SCAN     Object owner=INV     Object name=MTL_PARAMETERS_U1     Cost=0     Cardinality=1     
                   INDEX UNIQUE SCAN     Object owner=INV     Object name=MTL_PARAMETERS_U1     Cost=0     Cardinality=1     Bytes=4
                  INDEX UNIQUE SCAN     Object owner=INV     Object name=MTL_SYSTEM_ITEMS_B_U1     Cost=2     Cardinality=1     Bytes=10
                 INDEX UNIQUE SCAN     Object owner=INV     Object name=MTL_SYSTEM_ITEMS_TL_U1     Cost=2     Cardinality=1     Bytes=13
              TABLE ACCESS BY INDEX ROWID     Object owner=HR     Object name=HR_ALL_ORGANIZATION_UNITS     Cost=1     Cardinality=1     Bytes=7
               INDEX UNIQUE SCAN     Object owner=HR     Object name=HR_ORGANIZATION_UNITS_PK     Cost=0     Cardinality=1     
             INDEX UNIQUE SCAN     Object owner=HR     Object name=HR_ALL_ORGANIZATION_UNTS_TL_PK     Cost=0     Cardinality=1     Bytes=7
            TABLE ACCESS BY INDEX ROWID     Object owner=INV     Object name=MTL_PARAMETERS     Cost=1     Cardinality=1     Bytes=8
             INDEX UNIQUE SCAN     Object owner=INV     Object name=MTL_PARAMETERS_U1     Cost=0     Cardinality=1     
           TABLE ACCESS BY INDEX ROWID     Object owner=GL     Object name=GL_CODE_COMBINATIONS     Cost=2     Cardinality=1     Bytes=57
            INDEX UNIQUE SCAN     Object owner=GL     Object name=GL_CODE_COMBINATIONS_U1     Cost=1     Cardinality=1     
          TABLE ACCESS BY INDEX ROWID     Object owner=INV     Object name=MTL_ITEM_LOCATIONS     Cost=3     Cardinality=1     Bytes=24
           INDEX RANGE SCAN     Object owner=INV     Object name=MTL_ITEM_LOCATIONS_U1     Cost=2     Cardinality=1     
         TABLE ACCESS BY INDEX ROWID     Object owner=HR     Object name=HR_ORGANIZATION_INFORMATION     Cost=2     Cardinality=1     Bytes=28
          INDEX RANGE SCAN     Object owner=HR     Object name=HR_ORGANIZATION_INFORMATIO_FK2     Cost=1     Cardinality=2     
        TABLE ACCESS BY INDEX ROWID     Object owner=HR     Object name=HR_ORGANIZATION_INFORMATION     Cost=1     Cardinality=1     Bytes=25
         INDEX RANGE SCAN     Object owner=HR     Object name=HR_ORGANIZATION_INFORMATIO_FK2     Cost=1     Cardinality=1     
       INDEX FULL SCAN     Object owner=GL     Object name=GL_SETS_OF_BOOKS_U2     Cost=1     Cardinality=1     Bytes=4
      BUFFER SORT               Cost=55     Cardinality=1     
       TABLE ACCESS FULL     Object owner=APPLSYS     Object name=FND_PRODUCT_GROUPS     Cost=3     Cardinality=1     

  • A Oracle sql query is needed, please help me out

    Hi,
    I have a table similar to scott.emp table and i should get first three recently joined employees salaries according to their joined date from each deptno
    output should like this:
    deptno firstempsalary secondemplsal thirdemploysalary
    10 xxx xxx xxxx
    20 xx xx
    30 xx xxx xxxx
    40 xx
    50 xx xxxx xxx
    60 xx xx
    70 xx
    it means that 70 dept having only one employee and 20 dept having only two employees and 10 dept having more than three employees but we should get only three recently joined employees salaries from 10 dept.
    Hope this is clear .. please give me a query to get this info ..
    oracle is 10g version
    great thanks in advance.

    select deptno,
    max(case jd_rank when 1 then salary end) firstempsal,
    max(case jd_rank when 2 then salary end) secondempsal,
    max(case jd_rank when 3 then salary end) thirdempsal
    from
    (select salary, deptno, row_number() over(partition by deptno order by join_date desc) jd_rank from emp)
    group by deptno
    Problem here is what to do when employees have the same join date? This example will arbitrarily choose their order and if, for example, three employees share the same (most recent) join date then they will arbitrarily be classed as "first", "second" and "third". If four employees join at the same time, one of them will be ignored at random!
    Edited by: user10548434 on 03-Dec-2008 06:27

  • Regarding ECC 6.0- CRM and BW. URGENT....Please help!!

    Dear All,
    I have a small query- Are CRM and BW an integral part of ECC 6.0? I mean, if I install ECC 6.0, will CRM and BW also get installed OR Do I need to explicitly install CRM and BW after installing ECC 6.0?
    If CRM and BW are an integral part of ECC 6.0, Do I need to carry out some additional steps/install add-on components(while installing ECC 6.0), to activate CRM and BW OR  will it be activated by default once I am through with the normal installation process of ECC 6.0?
    Thanks in anticipation!!

    CRM-Customer Relationship Management
    General Settings in CRM
    Use
    This section describes the general settings necessary for BW Integration in CRM.
    If CRM is not involved in your scenario skip this section.
    This step has to be carried out in the CRM system:
    Integration with Other mySAP Components &#61664; Data Transfer to the SAP Business Information Warehouse &#61664; Business Content DataSources &#61664; Transfer Application Component Hierarchy
    RSA9-Tcode
    Confirm the security check: Do you want the content application Transfer Component Hierarchy? with YES.
    If a dialog box appears requesting the user to enter a development class, enter a development class in the customers namespace and choose Save or choose Local object.
    If no error message is sent the application component hierarchy has been transferred successfully.
    Cross Connectivity:
    It describes all settings that are necessary to connect the components of the SAP.system landscape with each other. The settings for each combination of two components to be connected are described in a separate structure node. The separate section headings make it possible to identify the activities required to connect certain components with each other. The section headings for components that are not part of the installation can be skipped
    Connecting SAP BI with SAP ERP, SAP CRM
    Procedure
    To carry out the activity, choose one of the following navigation options in the SAP BI system:
    Transaction Code     RSA1
    SAP BI Menu     Modeling &#61664; Data Warehousing Workbench: Modeling
    Connecting SAP BI with SAP ERP, SAP CRM
    Procedure
    To carry out the activity, choose one of the following navigation options in the SAP BI system:
    Transaction Code     RSA1
    SAP BI Menu     Modeling &#61664; Data Warehousing Workbench: Modeling
    1.     Choose Modeling.
    2.     Choose Source Systems.
    3.     Select SAP in the window on the right.
    4.     Choose the Context menu (right mouse click).
    5.     Choose Create.
    6.     Make the following entries:
    Field     Entry
    Target computer (server)                            Server of the SAP ERP, SAP CRM or SAP SRM system
    System ID     System ID of the SAP ERP, SAP CRM or SAP SRM system
    System number     System number of the SAP ERP, SAP CRM or SAP SRM system
    Background user in source system     RFCUSER
    Password for source system     welcome
    Background user in BI     RFCUSER (can not be changed in this activity)
    Password for BI user     welcome
    9.     On the dialog box Please log on as an administrator in the following screen choose Continue.
    10.     Log on to the Source System with your administrator user. Choose the correct client.
    11.     On the dialog box New Source System Connection choose Continue.
    12.     On the Replicate Metadata dialog box, choose Only Activate.
    The building block CRM Lead Analysis describes the all the required activities to analyze the Marketing Lead Analysis data from SAP CRM in SAP Business Information Warehouse.
    The analysis is carried out with the following queries of the InfoCube 0MKTG_C01 CRM - Lead Management (SAP BW Business Content).
    The Lead Management InfoCube contains all the characteristics and data used for the administration of leads. This InfoCube enables you to execute the following standard queries available in SAP BW:
    1.     Channel Analysis: This query is used to determine the best channels by which business partners are contacted in the context of a marketing campaign. Following each marketing campaign, the lead manager can compare the success of a given channel to those of others.
    2.     Efficiency Reporting: This query is used to analyze the efficiency with which leads are qualified. By navigating to the sales organizations and the responsible employees for the leads, it is possible to assess how efficiently lead teams are working and to identify areas for improvement.
    3.     Historical Evaluation: Use to help analyze and compare leads over different intervals (comparison of different quarters or years for example) to see if general characteristics in the processing of leads can be identified for these periods.
    4.     Lost Leads: Provides an overview of the number of lost leads in a particular period and the reasons (implemented as a navigation characteristic) for the loss of the leads. This query is used to analyze the main reasons why leads might be lost, with a view to developing new strategies for overcoming these weaknesses.
    5.     Channel Mgmt.: Top-n Lost Leads (Current Year): In a Channel Manager Portal, this query provides an analysis of the leads lost by a Channel Manager over the past 12 months. Channel Managers can also view the leads lost by their Channel Partners. In a Partner Portal, this query shows the top-n unsuccessful leads distributed by a Channel Manager to a Channel Partner. Partner Manager can see the lost leads of the Partner Employees over the year. Partner Employee can view his lost leads over the year.
    InfoSources
    0CRM_LEAD_H - Lead Header (Transactional Data)
    0CRM_LEAD_I - Lead Item (Transactional Data)
    0CRM_MIG -  Mail GUID
    Before starting activities in this building block, you need to perform or check the following steps:
    1.     From the BW Connectivity building block the following activities have to be completed:
    a.     Local Settings è SAP CRM: all activities have to be completed.
    b.     Local Settings è SAP BW: all activities have to be completed.
    c.     Cross Connectivity è Connecting SAP BW with SAP R/3, SAP CRM, SAP SRM: Connect your CRM System.
    2.     From the General Settings for BW Integration building block the following activities have to be completed:
    a.     In section General Settings in CRM all activities have to be completed.
    b.     In section General Settings in SAP BW all activities have to be completed.

  • Need SQL query using View - Please help

    Hi,
    I have similar requirement like below.
    I have two tables DEPT and EMP and some departments may not have employees. I have created below view, which displays all DEPT records, even though there are no emplyees.
    CREATE OR REPLACE VIEW dept_emp_vw AS
    SELECT deptno, empid, 0 AS selected
    FROM dept d, emp e
    WHERE d.deptno = e.deptnno (+);
    Ex.
    DEPTNO         EMPID        SELECTED
    10 101 0
    10 102 0
    20 103 0
    30 103 0
    40 104 0
    50 <null> 0
    Application will pass "empid" to the view (for ex. empid = 103) and I want result like below.
    Ex.
    DEPTNO         EMPID        SELECTED
    10 101 0
    10 102 0
    20 103 1
    30 103 1
    40 104 0
    50 <null> 0
    Can you please let me know the query using "dept_emp_vw" view. We have Oracle 11g Release 2.
    Thanks a lot for the help.

    Not possible using normal SQL - as SQL is not a procedure language and does not support variable declaration and use (e.g. passing empid as a variable and using it both as a predicate and as a condition in the SQL projection).
    That said - SQL can be "+parameterised+". An approach that is ugly and contrary to the basic design and use of SQL. But it can support the (very weird) view definition of yours.
    E.g.
    SQL> create or replace procedure SetVariable( name varchar2, value varchar2 ) is
      2  begin
      3          DBMS_SESSION.set_context( 'MyVariables', name, value );
      4  end;
      5  /
    Procedure created.
    SQL>
    SQL>
    SQL> create or replace context MyVariables using SetVariable;
    Context created.
    SQL>
    SQL> create or replace view my_funky_weird_view as
      2  select
      3          e.empno,
      4          e.ename,
      5          e.job,
      6          case e.empno
      7                  when to_number(sys_context( 'MyVariables', 'empid' )) then
      8                          0
      9                  else
    10                          1
    11          end     as "SELECTED"
    12  from       emp e
    13  /
    View created.
    SQL>
    SQL> exec SetVariable( 'empid', 7499 )
    PL/SQL procedure successfully completed.
    SQL>
    SQL> select * from session_context where namespace = 'MYVARIABLES';
    NAMESPACE            ATTRIBUTE            VALUE
    MYVARIABLES          EMPID                7499
    SQL>
    SQL> select * from my_funky_weird_view order by selected;
         EMPNO ENAME      JOB               SELECTED
          7499 ALLEN      SALESMAN                 0
          7521 WARD       SALESMAN                 1
          7566 JONES      MANAGER                  1
          7654 MARTIN     SALESMAN                 1
          7698 BLAKE      MANAGER                  1
          7934 MILLER     CLERK                    1
          7788 SCOTT      ANALYST                  1
          7839 KING       PRESIDENT                1
          7844 TURNER     SALESMAN                 1
          7876 ADAMS      CLERK                    1
          7900 JAMES      CLERK                    1
          7902 FORD       ANALYST                  1
          7369 SMITH      CLERK                    1
          7782 CLARK      MANAGER                  1
    14 rows selected.
    SQL>But I will N\OT recommend doing it this way. It is not natural SQL as PL/SQL is needed to "+inject+" name-value pairs into the context for the SQL view to use. It is ugly. It is not standard. It cannot scale. It is complex to use. Etc.
    Yes, there are instances when this approach is exactly what one needs - when for example dealing with a trusted context and using the contents for implementing a security layer. But in the above case - I would rather want to see the actual business requirement first, as I think you're barking up the wrong tree with the view solution you have imagined.

  • URGENT!!! PLEASE HELP - CAN'T SEND OR RECEIVE EMAI...

    All of a sudden this morning my email account (on web mail) will not send or receive any emails?  My friend has a bt mail account and theirs is working fine.  Any clues?  This is most urgent as this is my only email address and I am awaiting an urgent email and confirmation emails as currently booking flights.  Any help would be so much appreciated.

    Hi guys,
    Thanks all for posting. Are you having problems with the Yahoo or BT Mail service? Are you getting any error messages? Can you give me as much detail as possible and I’ll look into it.
    Cheers
    David
    BTCare Community Mod
    If we have asked you to email us with your details, please make sure you are logged in to the forum, otherwise you will not be able to see our ‘Contact Us’ link within our profiles.
    We are sorry but we are unable to deal with service/account queries via the private message(PM) function so please don't PM your account info, we need to deal with this via our email account :-)

  • Urgent and typical issue- Please help!!

    Dear All,
    I have a BOM material(say M) which is made up of 3 components(say A, B and C).
    I procure component A from 3 different countries(T1, T2 andT3), component B from 2 different countries(T4 and T5) and component C from 4 different countries(T6, T7, T8 and T9).I process them and prepare a finished good ‘M’(as mentioned above) and export it. I want to track the country of origin of each of the components of this BOM.How can I achieve this?
    To make my question more clear…..If I am exporting material M, I should be able to track all the 9 countries(T1…..T9) because M is made up of 3 components procured from 9 countries(in all).
    Since the problem is critical, I would appreciate your urgent help on this.Thanks!!

    Hi Venkat,
    Thankyou so much for your response.I came to know about you beforehand, from one of your students whom you are grooming on GTS.As the problem was really critical I tried to contact you, to seek your help, but couldn't reach you.Can you please mail me your contact number on      [email protected]
    I need to talk to you for a few minutes to discuss this.
    Thanks again!!

Maybe you are looking for

  • ARW files from a Sony A350...

    - Elements 6.0 on WinXP. - Been using a Canon and the .CR2 files were fine. - Tried using the .ARW files from the Sony A350. Neither Organizer nor Editor would recognize the file. - Downloaded Camera Raw Update 5.1 for Windows and extracted (with Win

  • How to improve the performance in AM level

    Hi, I am using Jdeveloper 11.1.1.2.0 and weblogic server 10.3.2. How to improve the performance in AM level. Actually i have approx 10 lacs Data but when search the record then it is taking more time. I have following the link.. http://www.gebs.ro/bl

  • Can I run fcpx

    Hi there, Can I run fcp x with this graphics card? Chipset Model:    GeForce 8600M GT   Type:    Display   Bus:    PCIe   PCIe Lane Width:    x16   VRAM (Total):    256 MB   Vendor:    NVIDIA (0x10de)   Device ID:    0x0407   Revision ID:    0x00a1  

  • Incorrect Grade Scales and Scale Rates

    Hi Gurus Could you please give me your input on the following issue: My client is a South African government department and are using Pay Scales, Scale Rate (Point values), and Grade Rates (Grade Steps and Points) for Pay progression etc. They went l

  • Itunes a cessé de fonctionner, que faire ?

    Depuis quelques jours Itunes m'affiche sans cesse le même message d'erreur lors de l'ouverture, y a t il une méthode pour qu'il fonctionne à nouveau correctement, j'ai essayé de désinstaller et réinstaller deux fois, sans résultat..