Query involving XI 7.0 (PI 7.0) on SAP SRM 5.0 (EBP - SUS Scenario)

hi,
I am currently working on SRM EBP-SUS scenario which makes use of XI 7.0.
while reading through the posts on this scenario, prior to XI 7.0,mapping content had to be imported into XI repository.
as per XI 7.0 is it required to import the mapping content into IR or it is already shipped into IR.
any help is appreciated.
thanks in advance.

Hi,
If you export the mapping content in previous version then that can be imported into IR, in MM ctrShift0 then you will get on window ther you can import the mapping .
Is this your requirment?
Regards
Chilla

Similar Messages

  • SQL Query involved to Generate the reports

    Hi,
    I have created Vendor report which internally refers two tables from the vendor and store table (Both the tables are not directly Joined each other)
    i want to see the SQL Query involved to generate the report.
    where can i see that?
    Regards,
    Prasanthi

    in nqquery.log file:
    10g -> $BI_ORACLE_HOME/server/Log
    11g -> $ORACLE_INSTANCE/diagnostics/logs/OracleBIServerComponent/coreapplication_obis1

  • Pickup the Latest Result Date (Query involves 3 tables)

    Hello folks,
    I have a relatively simple request. It involves 3 simple tables. I want to return the Student along with the Results based on the Latest Result Date and a Flag. Any help is appreciated.
    Thanks
    Assumptions
    STUDENT_ID is unique in STUDENT_TB
    EXAM_VISIT_ID is Unique in EXAM_RESULTS_TB.
    Scripts for table creation and INSERT statements
    create table student_tb (student_id varchar2(4));
    create table exam_tb (student_id varchar2(4), exam_visit_id number, exam_date date);
    create table exam_results (exam_visit_id number, result_date date, results number, result_flag varchar2(1));
    insert into student_tb values('1001');
    insert into student_tb values('1002');
    Insert into EXAM_TB (STUDENT_ID,EXAM_DATE,EXAM_VISIT_ID) values ('1001',to_date('01-JAN-12','DD-MON-RR'),1);
    Insert into EXAM_TB (STUDENT_ID,EXAM_DATE,EXAM_VISIT_ID) values ('1001',to_date('01-APR-12','DD-MON-RR'),2);
    Insert into EXAM_TB (STUDENT_ID,EXAM_DATE,EXAM_VISIT_ID) values ('1001',to_date('01-JUL-12','DD-MON-RR'),3);
    Insert into EXAM_TB (STUDENT_ID,EXAM_DATE,EXAM_VISIT_ID) values ('1001',to_date('01-SEP-12','DD-MON-RR'),4);
    Insert into EXAM_RESULTS_TB (EXAM_VISIT_ID,RESULT_DATE,FLAG,RESULTS) values (1,to_date('01-FEB-12','DD-MON-RR'),'N',10);
    Insert into EXAM_RESULTS_TB (EXAM_VISIT_ID,RESULT_DATE,FLAG,RESULTS) values (2,to_date('01-MAY-12','DD-MON-RR'),'Y',40);
    Insert into EXAM_RESULTS_TB (EXAM_VISIT_ID,RESULT_DATE,FLAG,RESULTS) values (3,to_date('01-AUG-12','DD-MON-RR'),'Y',32);
    Insert into EXAM_RESULTS_TB (EXAM_VISIT_ID,RESULT_DATE,FLAG,RESULTS) values (4,to_date('01-DEC-12','DD-MON-RR'),'N',20);I would like to pick up the Student along with the RESULT_DATE and RESULTS where the RESULT_DATE (EXAM_DATE is irrelevant for this exercise) is the most recent for that Student and the flag = 'Y'. EXAM_VISIT_ID is Unique. So, the record that needs to be returned from this Result set is
    1001 3 01-AUG-12 32

    Hi,
    That's an example of a Top-N Query , and here's one way to do it:
    WITH   got_r_num   AS
         SELECT  e.student_id, e.exam_visit_id
         ,     er.result_date, er.results
         ,     RANK () OVER ( PARTITION BY  e.student_id
                               ORDER BY          er.result_date  DESC
                        )           AS r_num
         FROM    exam_tb              e
         JOIN     exam_results_tb  er  ON   er.exam_visit_id  = e.exam_visit_id
         WHERE     er.flag     = 'Y'
    SELECT  student_id, exam_visit_id
    ,     result_date, results
    FROM     got_r_num
    WHERE     r_num     = 1
    ;Thanks for posting the CREATE TABLE and INSERT statements. Please make sure they work before posting them. There is some confusion about the table (EXAM_RESULTS or EXAM_RESULTS_TB) and column (FLAG or RESULT_FLAG) names.
    What results do you want if there is a tie for the most recent exam for a given student? (E.g., if we change the result_date on this row
    Insert into EXAM_RESULTS_TB (EXAM_VISIT_ID,RESULT_DATE,FLAG,RESULTS) values (2,to_date('01-MAY-12','DD-MON-RR'),'Y',40);to be August 1, 2012, just like the row with exam_visit_id=3)?
    Depending on your requirements, you may want to add tie-breaking columns to the end of the analytic ORDER BY clause, and/or use ROW_NUMBER instead of RANK.

  • Error in update query involving different databases

    Hi everybody,
    I get the error "ORA : 00933 SQL Command not properly ended"
    when I try to execute the following query, in oracle8i. Also the tables it involves are from different db. I tried to put @server_name after the table name but still it didn't work:
    UPDATE ASAP.CAP_NW_CONN_DUMP cncd
         SET MS_INIT = ep1.task_status, HANDSET_DEL = ep3.task_status,
         ACTIVATION = ep.task_status, MS_UPDT = ep2.task_status,
         MS_FNL = ep4.task_status
    ep1.task_status, ep3.task_status, ep.task_status, ep2.task_status, ep4.task_status
    FROM eposmig.t_intf_order_task_dtls@eposload ep, eposmig.t_intf_order_task_dtls ep1, eposmig.t_intf_order_task_dtls ep2,
         eposmig.t_intf_order_task_dtls ep3, eposmig.t_intf_order_task_dtls ep4,
         eposmig.pos_order_lines@eposload pol
    WHERE cncd.ident_text = pol.telephone_no
    AND ep.task_type LIKE 'ACT%'
    AND ep1.task_TYPE = 'MSOLV-INIT'
    AND ep2.task_TYPE = 'MSOLV-UPDATE'
    AND ep3.task_type = 'MSOLV-FINAL'
    AND ep4.task_type = 'HANDSET-DEL'
    AND ep.ORDER_NBR = pol.ORDER_NBR
    AND ep1.ORDER_NBR = pol.ORDER_NBR
    AND ep2.ORDER_NBR = pol.ORDER_NBR
    AND ep3.ORDER_NBR = pol.ORDER_NBR
    AND ep4.ORDER_NBR = pol.ORDER_NBR
    AND pol.order_line_nbr IN (SELECT MAX(order_line_nbr) FROM eposmig.pos_order_lines
                                            WHERE telephone_no IN (SELECT ident_text FROM asap.cap_nw_conn_dump)
                                            GROUP BY telephone_no)
    The table that is being updated, is in same db, but rest of two tables are from different databases i.e eposload

    >
    UPDATE ASAP.CAP_NW_CONN_DUMP cncd
    SET MS_INIT = ep1.task_status, HANDSET_DEL =
    EL = ep3.task_status,
    ACTIVATION = ep.task_status, MS_UPDT =
    DT = ep2.task_status,
         MS_FNL = ep4.task_status
    ep1.task_status, ep3.task_status, ep.task_status,
    ep2.task_status, ep4.task_status
    FROM eposmig.t_intf_order_task_dtls@eposload ep,
    eposmig.t_intf_order_task_dtls ep1,
    eposmig.t_intf_order_task_dtls ep2,
    eposmig.t_intf_order_task_dtls ep3,
    3, eposmig.t_intf_order_task_dtls ep4,
         eposmig.pos_order_lines@eposload pol
    WHERE cncd.ident_text = pol.telephone_no
    AND ep.task_type LIKE 'ACT%'
    AND ep1.task_TYPE = 'MSOLV-INIT'
    AND ep2.task_TYPE = 'MSOLV-UPDATE'
    AND ep3.task_type = 'MSOLV-FINAL'
    AND ep4.task_type = 'HANDSET-DEL'
    AND ep.ORDER_NBR = pol.ORDER_NBR
    AND ep1.ORDER_NBR = pol.ORDER_NBR
    AND ep2.ORDER_NBR = pol.ORDER_NBR
    AND ep3.ORDER_NBR = pol.ORDER_NBR
    AND ep4.ORDER_NBR = pol.ORDER_NBR
    AND pol.order_line_nbr IN (SELECT MAX(order_line_nbr)
    FROM eposmig.pos_order_lines
    WHERE telephone_no IN (SELECT
    e_no IN (SELECT ident_text FROM
    asap.cap_nw_conn_dump)
                                            GROUP BY telephone_no)
    The syntax of your UPDATE statement is incorrect.
    Have a look at the "wire-diagram" in the documentation -
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_10007.htm#SQLRF01708
    and compare it with your UPDATE statement.
    HTH
    isotope

  • No join in the query involving 2 tables

    Friends,
    I saw a strange plan for one query in TESTING DB today. Although 2 tables are involved i dont see any join , NL/HJ/SMJ !!
    Can you please tell why this might be happening?
    Note: i am not facing any performance issue but curious to know what type of optimization oracle is doing here.
    It would be great if you could direct me the relevant link in the documentation.
    Query text and plan :
    SELECT FIRST_NAME
      FROM CAMPA.TABLE_A
    WHERE NAME_ID =
              (SELECT NAME_ID
                 FROM CAMPA.TABLE_B
                WHERE ban=:b1);
    Plan hash value: 311916800
    | Id  | Operation                             | Name                  | Rows  | Bytes | Cost  | Pstart| Pstop |
    |   0 | SELECT STATEMENT                      |                       |     1 |    12 |     2 |       |       |
    |   1 |  PARTITION RANGE SINGLE               |                       |     1 |    12 |     1 |   KEY |   KEY |
    |   2 |   TABLE ACCESS BY LOCAL INDEX ROWID   | TABLE_A               |     1 |    12 |     1 |   KEY |   KEY |
    |*  3 |    INDEX UNIQUE SCAN                  | TABLE_A_PK            |     1 |       |     1 |   KEY |   KEY |
    |   4 |     PARTITION RANGE SINGLE            |                       |     2 |    30 |     1 |   KEY |   KEY |
    |   5 |      TABLE ACCESS BY LOCAL INDEX ROWID| TABLE_B               |     2 |    30 |     1 |   KEY |   KEY |
    |*  6 |       INDEX RANGE SCAN                | TABLE_B_2IX           |     2 |       |     1 |   KEY |   KEY |
    Predicate Information (identified by operation id):
       3 - access("NAME_ID"= (SELECT "NAME_ID" FROM "CAMPA"."TABLE_B" "TABLE_B"
                  WHERE "BAN"=TO_NUMBER(:B1)))
       6 - access("BAN"=TO_NUMBER(:B1))
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE    11.1.0.7.0      Production
    TNS for HPUX: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - Production

    With equality condition can i get NL/HJ join where the outer row source comes from the subquery?
    What condition/pre-requisite of NL/HJ join is not met in this case?Don't use an equality condition with a subquery - this implicitly makes available to the CBO an optimisation strategy that can only be used if the subquery is guaranteed to return a single row.
    So either use IN rather than = or use a JOIN not a SUBQUERY.
    It's a bit of a strange question.
    How do I remove this optimisation?
    Take away the features that make that optimisation a possibility.
    Edited by: Dom Brooks on May 13, 2013 2:20 PM

  • How to generate a query involving multiple tables(one left join others)

    Hi, all,
    I want to query a db like these:
    I need all the demographics information(from table demo) and their acr info(from table acr), and their clinical info(from table clinical), and their lab info(from table lab).
    The db is like this:
    demo->acr: one to many
    demo->clinical info: one to many
    demo->lab info: one to many
    I want to get one query result which are demo left join acr, and demo left join clinical, and demo left join lab. I hope the result is a record including demo info, acr info, clinical info, and lab info.
    How could I do this in SQL?
    Thanks a lot!
    Qian

    Thank you very, very much!
    Actually, I need a huge query to include all the tables in our db.
    We are running a clinical db which collects the patients demographics info, clinical info, lab info, and many other information.
    The Demographics table is a center hub which connects other tables. This is the main architecture.
    My boss needed a huge query to include all the information, so others could find what they need by filtering.
    As you have found, because one patients usually has multiple clinical/lab info sets, so the result will be multiplied! the number of result=n*m*k*...
    My first plan is to set time point criteria to narrow all the records with one study year. If somebody needs to compare them, then I have to show them all.
    So I have to know the SQL to generate a huge query including as many tables as possible.
    I show some details here:
    CREATE TABLE "IMMUNODATA"."DEMOGRAPHICS" (
    "SUBJECTID" INTEGER NOT NULL,
    "WORKID" INTEGER,
    "OMRFHISTORYNUMBER" INTEGER,
    "OTHERID" INTEGER,
    "BARCODE" INTEGER,
    "GENDER" VARCHAR2(1),
    "DOB" DATE,
    "RACEAI" INTEGER,
    "RACECAUCASIAN" INTEGER,
    "RACEAA" INTEGER,
    "RACEASIAN" INTEGER,
    "RACEPAC" INTEGER,
    "RACEHIS" INTEGER,
    "RACEOTHER" VARCHAR2(50),
    "SSN" VARCHAR2(11),
    PRIMARY KEY("SUBJECTID") VALIDATE
    CREATE TABLE "IMMUNODATA"."ACR" (
    "ID" INTEGER NOT NULL,
    "THEDATE" DATE ,
    "SUBJECTID" INTEGER NOT NULL,
    "ACR_PAGENOTCOMPLETED" VARCHAR2(1000) ,
    "ACR_MALARRASHTODAY" INTEGER ,
    "ACR_MALARRASHEVER" INTEGER ,
    "ACR_MALARRSHEARLIESTDATE" DATE ,
    PRIMARY KEY("ID") VALIDATE,
    FOREIGN KEY("SUBJECTID") REFERENCES "IMMUNODATA"."DEMOGRAPHICS" ("SUBJECTID") VALIDATE
    CREATE TABLE "IMMUNODATA"."CLIN" (
    "ID" INTEGER NOT NULL,
    "THEDATE" DATE ,
    "SUBJECTID" INTEGER NOT NULL,
    "CLIN_PAGENOTCOMPLETED" VARCHAR2(1000) ,
    "CLIN_FATIGUE" VARCHAR2(20) ,
    "CLIN_FATIGUEDATE" DATE ,
    "CLIN_FEVER" VARCHAR2(20) ,
    "CLIN_FEVERDATE" DATE ,
    "CLIN_WEIGHTLOSS" VARCHAR2(20) ,
    "CLIN_WEIGHTLOSSDATE" DATE ,
    "CLIN_CARDIOMEGALY" VARCHAR2(20) ,
    PRIMARY KEY("ID") VALIDATE,
    FOREIGN KEY("SUBJECTID") REFERENCES "IMMUNODATA"."DEMOGRAPHICS" ("SUBJECTID") VALIDATE
    Other tables are alike.
    Thank very much!
    Qian

  • Issue in CAML query involving lookup column

    am having the below scenario:
    splistmaster1 --> contains custname [single line of text] 
    splist2 --> contains custnamelukup [ lookup data type] , custid- -[single line of text]
    now i need to filter the records  from splist2, with  custname as the parameter from the splistmaster1 .
    //master list item of custname is passed as a parameter
    _mycustname = singleitemfrommaster["custname"].tostring();
    oQuery.Query =
                                          string.Format(
                                      "<OrderBy>" +
                                         "<FieldRef Name='ID' />"
    +
                                       "</OrderBy>" +
                                       "<Where>" +
                                        "<And>" +
                                          "<Eq>" +
                                             "<FieldRef
    Name='custid' />" +
                                             "<Value
    Type='Text'>{0}</Value>" +
                                          "</Eq>" +
                                          "<Eq>" +
                                             "<FieldRef
    Name='custnamelukup' />" +
                                             "<Value
    Type='Text'>{1}</Value>" +
                                          "</Eq>" +
                                         "</And>" +
                                       "</Where>",mycustid, _mycustname);
                                        SPListItemCollection splistItemA = null;
                                        splistItemA = splistA.GetItems(oQuery);
    due to some reason  the query is not returning the results.
    can anyone help me where i am wrong. because i want to filter  records with the combination of custname and custid from splist2 .
    Das

    SPSite oSite = SPContext.Current.Site;
    SPWeb web = oSite.RootWeb;
    SPQuery query = new SPQuery();
    query.Joins = "<Join Type='INNER' ListAlias='Region'>" +
    "<Eq>" +
    "<FieldRef Name='Region' RefType='Id'/>" +
    "<FieldRef List='Region' Name='ID'/>" +
    "</Eq>" +
    "</Join>";
    query.ProjectedFields =
    "<Field Name='RegionTitle' Type='Lookup' " +
    "List='Region' ShowField='Title'/>";
    // "<Field Name='DSELastName' Type='Lookup' " +
    // "List='DSE' ShowField='Title'/>";
    query.ViewFields = "<FieldRef Name='Title'/>" +
    "<FieldRef Name='RegionTitle'/>";
    //"<FieldRef Name='DSELastName'/>";
    SPList customerList = web.Lists["Country"];
    SPListItemCollection items = customerList.GetItems(query);
    List<Ownvalues> o = new List<Ownvalues>();
    foreach (SPListItem item in items)
    SPFieldLookupValue RegionTitle =
    new SPFieldLookupValue(item["RegionTitle"].ToString());
    // o.Add(item.Title, RegionTitle.LookupValue);
    Ownvalues val = new Ownvalues();
    val.Title = item.Title;
    val.RegionTitle = RegionTitle.LookupValue;
    o.Add(val);
    Check out if the code above helps
    Girish

  • Perf tuning issue with a query involving between clause

    Hi all,
    I am getting issues with performance when I try to execute this query. Given below the query and it is going for a full table scan. I think the problem is with the between clause. But I dont know how to resolve this issue
    SELECT psm.member_id
    FROM pre_stg_member psm
    WHERE psm.map_tran_agn BETWEEN :start_transaction_agn and :end_transaction_agn
    and psm.partition_key = :p_partition_key;
    Having composite index on map_tran_agn and partition_key.
    Please help me in this regard.
    Thanks,
    Swami

    Please consider the following when you post a question.
    1. New features keep coming in every oracle version so please provide Your Oracle DB Version to get the best possible answer.
    You can use the following query and do a copy past of the output.
    select * from v$version 2. This forum has a very good Search Feature. Please use that before posting your question. Because for most of the questions
    that are asked the answer is already there.
    3. We dont know your DB structure or How your Data is. So you need to let us know. The best way would be to give some sample data like this.
    I have the following table called sales
    with sales
    as
          select 1 sales_id, 1 prod_id, 1001 inv_num, 120 qty from dual
          union all
          select 2 sales_id, 1 prod_id, 1002 inv_num, 25 qty from dual
    select *
      from sales 4. Rather than telling what you want in words its more easier when you give your expected output.
    For example in the above sales table, I want to know the total quantity and number of invoice for each product.
    The output should look like this
    Prod_id   sum_qty   count_inv
    1         145       2 5. When ever you get an error message post the entire error message. With the Error Number, The message and the Line number.
    6. Next thing is a very important thing to remember. Please post only well formatted code. Unformatted code is very hard to read.
    Your code format gets lost when you post it in the Oracle Forum. So in order to preserve it you need to
    use the {noformat}{noformat} tags.
    The usage of the tag is like this.
    <place your code here>\
    7. If you are posting a *Performance Related Question*. Please read
       {thread:id=501834} and {thread:id=863295}.
       Following those guide will be very helpful.
    8. Please keep in mind that this is a public forum. Here No question is URGENT.
       So use of words like *URGENT* or *ASAP* (As Soon As Possible) are considered to be rude.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Problem with a SQL query involving dates

    I have a database with each task made by a developer in the company's systems, with 2 fields to determine the duration of the tasks: begin_date and end_date, both Dates. Now I have to make an SQL query returning the total of hours each one worked counting every task, so I'm using something like this (simplifying):
    select user_id, sum(end_date - begin_date)
    from task
    group by user_id
    but I get a weird fractional number. How do I do this query?

    What database are you using? Oracle?
    The weird fractional number is probably the difference between the dates in days. If you want it in hours, try multiplying it with 24.
    select user_id, sum(end_date - begin_date) * 24
    from task
    group by user_id

  • How to replace EQUAL TO by LIKE in a Query involving variables

    Dear All,
    I am working on a Query which is in reality 3 Queries in 1. It works perfectly.
    When I run the Query, it gives the following Query - Selection Criteria
    Query - Selection Criteria
    Import Log                        ...................
    Block Number                      ...................
    Document Date                     ...................
    Document Date                     ...................
    [OK]   [Cancel]
    To use this Query, we must choose only 1 criterion and leave other fields blank. To achieve this, I
    use OR inside WHERE
    1ST Query
    If you type S713 in the first field, it returns all records with Import Log = S713
    2 ND Query
    If you type G1575 in the 2ND field, it returns all records with Block Number = G1575
    3rd  Query
    If you type '01.07.11' and '05.07.11' in the 3RD and 4TH fieldS, it returns all records with
    Dates between 01.07.00 and 05.07.11
    The Query won't work if you fill in all fields.
    WHAT I WANT?
    I want to replace the EQUAL TO in the WHERE clause by LIKE to allow the Query to search for a pattern, instead
    of rendering an exact match.
    I know this can be done with  = '[%1]' by changing it to LIKE '%[%1]%'
    But how can you do the same with @shipnum and @reqnum?
    I can change the variable declarations to
    set @shipnum = /*   */ '%[%1]%'
    but it creates problems.
    How can we use LIKE in the WHERE clause, without modifying the declarations.
    Thanks
    Leon Lai
    Here's my Query
    TABLES:
    T0 = OPCH A/P Invoice - Header
    T1 = PCH1 A/P Invoice - Rows
    T5 = OJDT Journal Entry
    declare @shipnum nvarchar (30)
    set @shipnum =
    /*select T1.[ImportLog] from [dbo].[PCH1] T1 where T1.[ImportLog]*/ '[%1]'
    declare @reqnum nvarchar (30)
    set @reqnum =
    /*select T1.[BlockNum] from [dbo].[PCH1] T1 where T1.[BlockNum]*/ '[%2]'
    declare @taxdt1 datetime
    set @taxdt1=
    /*select T0.[TaxDate] from [dbo].[OPCH] T0 where T0.[TaxDate]*/ '[%3]'
    declare @taxdt2 datetime
    set @taxdt2=
    /*select T0.[TaxDate] from [dbo].[OPCH] T0 where T0.[TaxDate]*/ '[%4]'
    SELECT
    T0.[TaxDate] AS 'Doc Dt',
    T1.[ImportLog] AS 'Ship #',
    T1.[BlockNum] AS 'Reqn #',
    T0.[CardName] AS 'Supplier Name',
    T0.[DocTotal] AS 'Rs'
    FROM [dbo].[OPCH] T0
    INNER JOIN [dbo].[PCH1] T1 ON T0.[DocEntry] = T1.[DocEntry]
    INNER JOIN [dbo].[OJDT] T5 ON T0.[TransID] = T5.[TransID]
    WHERE
    (T1.[ImportLog]  = @shipnum  AND
    @reqnum = '  ' AND
    @taxdt1  = '  ' AND
    @taxdt2  = '  ' )
    OR
    (T1.[BlockNum] = @reqnum  AND
    @shipnum = '  ' AND
    @taxdt1  = '  ' AND
    @taxdt2  = '  ' )
    OR
    (T0.[TaxDate] >= @taxdt1 AND
    T0.[TaxDate] <= @taxdt2 AND
    @shipnum = ' ' AND
    @reqnum = ' ' )

    Dear Gordon,
    Thanks for your reply.
    Unfortunately it does not work when I use
    T1.[ImportLog]  LIKE '%@shipnum%'
    I think I could guess the reason:
    Since @shipnum means '% { %1 } %'             
    /* I use { } to represent Square Brackets */
    Then
    LIKE '%@shipnum%'  would mean
    LIKE '% '%{%1}%'    '
    and this would be incorrect syntax.
    If I remove the ' it still does not work.
    By numerous trial and error, I just arrived at  this mixture of @variable and '{%x}' which works!
    I have no idea why, and it appears rather messy.But it works seamlessly.
    I tried using uniquely {%x} without the @variables. It does not work.
    So, if you could analyse it and put it in neater form (I mean without a mixture of @ and { },
    I would be grateful.
    There are so many tricks I used to make my Queries work, without understanding
    at all why they work.
    Best Regards,
    Leon Lai
    TABLES:
    T0 = OPCH A/P Invoice - Header
    T1 = PCH1 A/P Invoice - Rows
    T5 = OJDT Journal Entry
    declare @shipnum nvarchar (30)
    set @shipnum =
    /*select T1.[ImportLog] from [dbo].[PCH1] T1 where T1.[ImportLog]*/ '%[%1]%'
    declare @reqnum nvarchar (30)
    set @reqnum =
    /*select T1.[BlockNum] from [dbo].[PCH1] T1 where T1.[BlockNum]*/ '%[%2]%'
    declare @taxdt1 datetime
    set @taxdt1=
    /*select T0.[TaxDate] from [dbo].[OPCH] T0 where T0.[TaxDate]*/ '[%3]'
    declare @taxdt2 datetime
    set @taxdt2=
    /*select T0.[TaxDate] from [dbo].[OPCH] T0 where T0.[TaxDate]*/ '[%4]'
    SELECT
    T0.[TaxDate] AS 'Doc Dt',
    T1.[ImportLog] AS 'Ship #',
    T1.[BlockNum] AS 'Reqn #',
    T0.[CardName] AS 'Supplier Name',
    T0.[DocTotal] AS 'Rs'
    FROM [dbo].[OPCH] T0
    INNER JOIN [dbo].[PCH1] T1 ON T0.[DocEntry] = T1.[DocEntry]
    INNER JOIN [dbo].[OJDT] T5 ON T0.[TransID] = T5.[TransID]
    WHERE
    (T1.[ImportLog]  like @shipnum  AND
    '[%2]'  = '  '  AND
    @taxdt1  = '  ' AND
    @taxdt2  = '  ' )
    OR
    (T1.[BlockNum] like @reqnum  AND
    '[%1]' = '  ' AND
    @taxdt1  = '  ' AND
    @taxdt2  = '  ' )
    OR
    (T0.[TaxDate] >= @taxdt1 AND
    T0.[TaxDate] <= @taxdt2 AND
    '[%1]' = ' ' AND
    '[%2]'= ' ' )

  • Issue with query involving remote tables

    Hi I have a query inside a procedure that has 4 union all statements ,2 of which are based on tables at a remote database.
    The query is something like
    Select col1, col2, col3…..col n from Table_a, table_b, table c where join condition and certain hard-coded conditions based on run time parameters
    Union all
    Select col1, col2, col3…..col n from Table_a, table_b , table c where some join condition and certain hard-coded conditions based on run time parameters
    Union all
    Select col1, col2, col3…..col n from Table_a@remote_db, table_b@remote_db, table c@remote_db where join condition and certain hard-coded conditions based on run time parameters
    Union all
    Select col1, col2, col3…..col n from Table_a @remote_db, table_b @remote_db, table c@ remote_db where some join condition and certain hard-coded conditions based on run time parameters
    The join conditions on the tables are quite good and when executed individually bring data in good time.The queries on the remote database also run fine when I execute them in the remote database.
    However when I run this query, it doesn’t get data at all and after hours of running I have to cancel or kill it.I don’t get anything in the long-ops and in the wait class it just shows “SQL*Net message from dblink” or “SQL*Net more data to dblink”.
    I thought that there could be some latency issues AND the data retreival over the dblink could be slow, so I tried the /*+driving_site(rmote table alias)*/ hint , after which it comes up in the long ops as its reading from Table a/ table b from my current database but the wait time is something like millions of seconds and it runs forever.
    The issue is Table A and Table B both in the remote and the current database are huge tables with at least 40-50 million records in them.
    Can anyone suggest an easy way out in this scenario, other than the hard way of re-designing the entire program(which I am afraid I might have to in the end).
    Thanks

    @metzquar I Put the hint in the unions where I am accessing the remote tables
    @blushadow .. i was thinking about that but as these remote tables are in a sort of archived database, I dont think I will be allowed to create a mview.But thats a good suggestion.
    @Earth.. I tried that , but the table population itself gets very time consuming
    Thanks

  • How to query involving Multi-Value Attributes objects

    Hello.
         I have one question regarding coherence. We are looking for best and the fastest way to query multi-value attribute of objects. In Coherence User guide there is example, that shows, how can this be made with java.lang.String object:
         Set searchTerms = new HashSet();
         searchTerms.add("java");
         searchTerms.add("clustering");
         searchTerms.add("books");
         // The cache contains instances of a class "Document" which has a method
         // "getWords" which returns a Collection<String> containing the set of
         // words that appear in the document.
         Filter filter = new ContainsAllFilter("getWords", searchTerms);
         Set entrySet = cache.entrySet(filter);
         // iterate through the search results
         But I would like to know, how can this be made with some other object type. For example I could have object MyCoherenceObject with attribute HashSet<Identifier> idHashSet that would represent Person object that has composite key comprised of name and lastname. Identifier object would contain two attributes of type String: name & value.
         So basically I could have two identifiers in list:
         public MyCoherenceObject {
         public HashSet idHashSet = new HashSet();
         public MyCoherenceObject() {
         Identifier id1 = new Identifier("name", "John");
         Identifier id2 = new Identifier("surname", Smith");
         idHashSet.add(id1);
         idHashSet.add(id2);
         public HashSet getIdentifiers() {
         return idHashSet;
         This object would later be inserted in coherence cache. When query over coherence cache would be performed I would like all objects where multi-value parameter with name="name" equal "John" and parameter with name="lastname" equal "Smith". My code would look something like this:
         Set searchTerms = new HashSet();
         searchTerms.add("John");
         searchTerms.add("Smith");
         // The cache contains instances of a class "Document" which has a method
         // "getWords" which returns a Collection<String> containing the set of
         // words that appear in the document.
         Filter filter = new ContainsAllFilter("getIdentifiers", searchTerms);
         Set entrySet = cache.entrySet(filter);
         // iterate through the search results
         How can this be done. Basically I don't know how to search in multi-value attribute if one value represents arbitrary object and how to tell coherence which getter fuction must be used for comparison. In my case getValue() must be used and not getName().
         Second problem:
         Coherence must not return Person object with name="Smith" and lastname="John". Here upper filter would be satisified, but problem is that I am looking for person with lastname "Smith" and name "John".
         Domain description:
         I will have different objects of same type in coherence cache with different multi-value attribute list length. For example some objects will have only one identifier object in list (e.g. Phone "phoneNumber") some two (e.g. Person "name", "lastname") and other objects will have maybe three identifier objects (e.g. City "country", "area", "state").
         If there is faster way to do this in Coherence (I saw examples with getters that contain attributes for example), please give me some directions.
         Thank you very much for your help.

    When filtering based on the getIdentifiers, you should add Identifier instances into the searchTerms collection, and it will satisfy all your expectations. If you add simple Strings into that searchTerms collection, then none of your queries will return anything, because the String will never equal() the Identifier instances.
         You can also add an index on the getIdentifiers() method. However, the Identifier class should properly implement the equals() and hashCode() methods, and in order to be able to use an ordered index (you don't need that for the current requirements you listed), it should also implement Comparable.
         BR,
         Robert

  • Error occurred when executing query involving cross join or outer join

    Hi,
    I tried to execute the following query:
    select count(*)
    from
         po,
         invoice,
         table(xmlsequence(extract(invoice.content, '/CommercialInvoice/Body/LineItemDetails/LineItem'))) invoice_line_item
    where
         extractValue(po.content, '/PurchaseOrder/Header/DocumentID/RID') =
         extractValue(value(invoice_line_item), '/LineItem/Product/PurchaseOrderIdentifier/documentCreatorIdentifier')(+)
    It produced the following error:
         Error: ORA-00936: missing expression
    Then I change the query to:
    select count(*)
    from
         po left outer join
              invoice cross join
              table(xmlsequence(extract(invoice.content, '/CommercialInvoice/Body/LineItemDetails/LineItem'))) invoice_line_item
         on
              extractValue(po.content, '/PurchaseOrder/Header/DocumentID/RID')
              = extractValue(value(invoice_line_item), '/LineItem/Product/PurchaseOrderIdentifier/documentCreatorIdentifier')
    It produced the following error:
         Error: ORA-00904: "INVOICE"."SYS_NC0012900130$": invalid identifier
    If I simply the query to:
    select 1
    from
         invoice cross join
         table(xmlsequence(extract(invoice.content, '/CommercialInvoice/Body/LineItemDetails/LineItem'))) invoice_line_item
    It also produced the following error:
         Error: ORA-00904: "INVOICE"."SYS_NC0012900130$": invalid identifier
    What is the cause of the problem? How to resolve it?
    The version I am using is 10.1.0.2.0 on Windows. Any help would be much appreciated.

    Hi,
        Recently we went for BW upgradatiaon (BI7.0) , the error you are facing could be due to the following issue,
        If infoobjects are used in infoset as infoprovider ( in BW3.5) after upgrade this infoobjects will not be selected automatically as infoproviders. So it will not be available for Infoset.
    Please check whether any infoobjects are used as infoprovider, if so manually change them as infoprovider ( In BI7) and activate.
    Since, few reports are working on the infoset , this could be those reports are not using the fields from the infoobjects. so it is working it seems.
    Please check and let me know.
    Thanks,
    V.Senthil

  • Help with SQL Query Involving Three Database Tables

    Hi,
    My SQL is very rusty since I have not touched it in over one year.
    I was given an SQL question in a job interview and I am curious to know the right answer.
    This was a pre-prepared written test and the interviewer did not know the answer.
    There are three database tables: STUDENTS, COURSES and STUDENT_COURSES
    Table STUDENTS has STUDENT_ID and STUDENT_NAME columns.
    Table COURSES has COURSE_ID and COURSE_DESCRIPTION columns.
    Table STUDENT_COURSES has columns STUDENT_ID and COURSE_ID.
    Provide a query that returns all the students that are enrolled in all the courses.
    Thanks,
    Avi.

    It is probably good to say that this task may be solved such way, if database normalized and there are references
    Basically here just is a variant of your solution
    DROP TABLE student_course;
    DROP TABLE student;
    DROP TABLE course;
    CREATE TABLE student
    (student_id NUMBER(9) PRIMARY KEY,
    student_name VARCHAR2(30));
    CREATE TABLE course
    (course_id NUMBER(9) PRIMARY KEY,
    dscr VARCHAR2(100));
    CREATE TABLE student_course
    (student_id NUMBER(9),
    course_id NUMBER(9));
    ALTER TABLE student_course
    ADD CONSTRAINT pk_st_crs PRIMARY KEY
    (student_id, course_id);
    ALTER TABLE student_course
    ADD CONSTRAINT fk_student
      FOREIGN KEY (student_id)
      REFERENCES student(student_id);
    ALTER TABLE student_course
    ADD CONSTRAINT fk_course
      FOREIGN KEY (course_id)
      REFERENCES course(course_id);
    INSERT INTO student
         VALUES (1, 'NAME1');
    INSERT INTO student
         VALUES (2, 'NAME2');
    INSERT INTO student
         VALUES (3, 'NAME3');
    INSERT INTO course
         VALUES (101, 'Desc 1');
    INSERT INTO course
         VALUES (102, 'Desc 2');
    INSERT INTO course
         VALUES (103, 'Desc 3');
    INSERT INTO student_course
         VALUES (1, 101);
    INSERT INTO student_course
         VALUES (1, 102);
    INSERT INTO student_course
         VALUES (2, 101);
    INSERT INTO student_course
         VALUES (2, 103);
    INSERT INTO student_course
         VALUES (3, 101);
    INSERT INTO student_course
         VALUES (3, 102);
    INSERT INTO student_course
         VALUES (3, 103);
    COMMIT ;
    WITH st_crs_cnt AS
         (SELECT   student_id,
                   COUNT (*) tot
              FROM student_course
          GROUP BY student_id)
    SELECT sc.student_id,
           sc.tot
      FROM st_crs_cnt sc
      WHERE sc.tot = (SELECT COUNT (*) FROM course);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • SQL query involving multiple tables

    I have a scenario in SQL where For each post there are associated tags. A user is one who makes post and he belongs to a particular location. The location corresponds to a particular country.
    I create tables as
    CREATE TABLE post_table
    post_id VARCHAR(20),
    user_id VARCHAR(20),
    PRIMARY KEY(post_id)
    CREATE TABLE tags_table
       post_id VARCHAR(20),
       tags VARCHAR(20),
       PRIMARY KEY(tags, post_id),
       FOREIGN KEY(post_id) REFERENCES post_table(post_id) ON DELETE CASCADE
    CREATE TABLE location
    location_id VARCHAR(20),
    country VARCHAR(20),
    PRIMARY KEY (location_id)
    CREATE TABLE user_info
    user_id VARCHAR(20),
    location_id VARCHAR(30),
    PRIMARY KEY (user_id),
    FOREIGN KEY(location_id) REFERENCES location(location_id) ON DELETE CASCADE
    );Now, I insert values in these tables as
    INSERT INTO post_table VALUES( 'p1', 'u1' );
    INSERT INTO post_table VALUES( 'p2', 'u1' );
    INSERT INTO post_table VALUES( 'p3', 'u2' );
    INSERT INTO post_table VALUES( 'p4', 'u3' );
    INSERT INTO post_table VALUES( 'p5', 'u2' );
    INSERT INTO tags_table VALUES( 'p1', 'US Open' );
    INSERT INTO tags_table VALUES( 'p1', 'Real good' );
    INSERT INTO tags_table VALUES( 'p1', 'Madrid' );
    INSERT INTO tags_table VALUES( 'p2', 'Madrid' );
    INSERT INTO tags_table VALUES( 'p3', 'Rossoneri' );
    INSERT INTO tags_table VALUES( 'p4', 'Milan' );
    INSERT INTO tags_table VALUES( 'p4', 'Los Angeles' );
    INSERT INTO tags_table VALUES( 'p5', 'Rossoneri' );
    INSERT INTO location VALUES( 'loc1', 'Spain');
    INSERT INTO location VALUES( 'loc2', 'England');
    INSERT INTO user_info VALUES( 'u1', 'loc1' );
    INSERT INTO user_info VALUES( 'u2', 'loc2' );
    INSERT INTO user_info VALUES( 'u3', 'loc1' );Now I have to fire a query For each country, display the most seen tag(s)
    So for this data the result should be like
    Country              MostTags
    Spain                Madrid
    England              RossoneriPlease help me write this query guys.

    Hi,
    Something like this
    select      country
         , tags from
                 select      l.country
                   , t.tags
                   , dense_rank() over (     partition by l.country
                                  order by count(*) desc) drn
              from      location l
                   , user_info u
                   , post_table p
                   , tags_table t
              where      l.location_id = u.location_id
                   and p.user_id=u.user_id
                   and p.post_id=t.post_id
              group by l.country
                   , t.tags
    where drn <=1   -- rank depends on like 1,2 or 3 popular tags for each countryRegards
    Anurag

Maybe you are looking for

  • What can I do in this recovery scenario?

    Hello, I'm testing some recovery scenario and I have problem with the one: I do full backup of the database with archivelog and controlfiles. Then I deleted all the datafiles, controlfiles and redologs. Now I wanna restore my database. I did shutdown

  • Can't install Safari, Leopard thinks im on 10.5.1 but im on 10.5.4

    Hello! I just removed the Safari 4 dev preview and Safari disappeared so i tried to install it again but i can't It says i don't have 10.5.2 but i got 10.5.4 What can i do without reinstalling Leopard?? Any help would be appreciated!

  • Define namespaces at element level

    hi, Is it possible to define namespaces at element level. Consider the Below xml file, for which i have to generate a single XSD( not seperate XSD for every namespace) <sap:Envelope xmlns:sap="urn:sap-com:document:sap" version="1.0">   <sap:Header xm

  • When I try to set up a new email account, the option to automatically setup account is not there, why?

    I am having such fun and games trying to set up a pop account on my iMac. I have set it up on my iPad, iPhone, iMac at work. But when I try at home nothing works. It keeps wanting to set it up as an iMac account. Has anyone got any ideas?

  • Office for Mac question - Excel crashing - EXC_BAD_ACCESS

    I am getting this error message when I try to change a tab name in an Excel spreadsheet for Mac.  Help please?? Microsoft Error Reporting log version: 2.0 Error Signature: Exception: EXC_BAD_ACCESS Date/Time: 2013-06-14 16:56:44 +0000 Application Nam