Exclusive results from query

CUSTOMER_ID            NAME
100                   ANDREW
200                   JAMES
300                   SMITH
400                   STEPHEN
500                   OSCAR
600                   JEAN
700                   PADILLA
800                   ROMANO
ADDR_ID                  ADDR1          CITY          STATE         ZIP_CODE       CUSTOMER_ID
110               ANDY ST             ABCD          PA          17102          100
111               AY ST          BCD          NJ          08837          100
112               NDY ST          ABCDE          NM          87102          100
210               BW1 ST          ABCD1          NJ          08837          200
211               BW2 ST          ABCD2          OH          81837          200
212               BW3 ST          ABCD3          SC          91837          200
213               BW4 ST          ABCD4          NC          21837          200
214               BW5 ST          ABCD5          NJ          08837          300
215               BW6 ST          ABCD6          OH          81837          300
216               BW7 ST          ABCD7          SC          91837          300
217               BW8 ST          ABCD8          PA          21837          300
218               BW9  ST             ABCD9          NJ          08817          400
219               BW10 ST             ABCD10             NY          81837          400
220               BW11 ST             ABCD11             LA          91837          400
221               BW12 ST             ABCD12             CA          21837          400
222               BW13 ST             ABCD13             NJ          08817          500
223               BW14 ST             ABCD14             NY          81837          500
224               BW15 ST             ABCD15             LA          91837          500
225               BW16 ST             ABCD16             CA          21837          500Hello All,
I've the tables above and I want retrieve customers who have lived exclusively outside of a given state (SAY Pennsylvania), which means my query should return Customers with IDs 200, 400 and 500
I've written the following query:
SELECT TA.CUSTOMER_ID, TA.STATE FROM T_CUSTOMER TC, T_ADDR TA
WHERE TC.CUSTOMER_ID = TA.CUSTOMER_ID AND
TA.CUSTOMER_ID NOT IN (SELECT TA.CUSTOMER_ID FROM T_ADDR TA WHERE UPPER(STATE)='PA') AND
TA.CUSTOMER_ID IN (SELECT TA.CUSTOMER_ID FROM T_ADDR TA WHERE UPPER(STATE)!='PA');This query retrieves the results , but I want to know :
1) Is this query by itself good enough , in terms of performance, because I'm going to hit tables that have millions of records (assume that all the proper indexes are in place)
2) Is there a better way of writing this query?
To make it easier to look at the data, here is where all the customers have lived:
100     NJ,     NM,     PA
200     NC,     NJ,     OH,     SC
300     NJ,     OH,     PA,     SC
400     CA,     LA,     NJ,     NY
500     CA,     LA,     NJ,     NYSo, since customer_ids 100 & 300 have lived in PA , I don't want those in the results.
Thanks in advance
Shravan

@Solomon - Many Thanks for suggesting an alternative way. I think this is what I was looking for.
@rp0248
Why does it matter? See answer to first question above. Because, if you see the way I've written the query compared to what Solomon had come up with, my query needs to run two almost similar inner queries
SELECT TA.CUSTOMER_ID FROM T_ADDR TA WHERE UPPER(STATE)='PA' and
SELECT TA.CUSTOMER_ID FROM T_ADDR TA WHERE UPPER(STATE)!='PA' twice and then compare the result sets ,
where as solomon's query would fetch one result set and will just do the counting.
So, in my opinion(and I'm not even average in SQL development skills), I would think my query would possibly take longer given all other conditions like the one you mentioned (stats, indexes etc.,) are met.
I guess I've used wrong word 'performance' in my question. I'm looking for alternative ways of writing my query that would possibly have less no. of reads /computes /comparisons.
Please read the FAQ at the top of the thread list for 'How to post a tuning request' and for the info needed.I definitely will. Thanks

Similar Messages

  • Saving result from query into CSV file

    Hi folks,
    in our application we're generating pages source using general packages (like htp, owa_util, ...). and in this part I'm a really beginner.
    I want to modify source one of our page, I want to add functionality to enable save result from query (cursor) into CSV file, to enable user choose place where generated file will be created and also change file name.
    I searched this forum and I found procedure, that could be useful:
    procedure p_getcsv is
    cursor cur is
           select 'a1' col1, 'b1' col2, 'c1' col3 from dual
       union  select 'a2' col1, 'b2' col2, 'c2' col3 from dual
       union  select 'a3' col1, 'b3' col2, 'c3' col3 from dual;
       begin
            -- Set the MIME type
            owa_util.mime_header( 'application/octet', FALSE );
            -- Set the name of the file
            htp.p('Content-Disposition: attachment; filename="test.csv"');
            -- Close the HTTP Header
            owa_util.http_header_close;
            -- Loop through all rows in EMP
            for x in cur
            loop
                -- Print out a portion of a row,
                -- separated by commas and ended by a CR
                 htp.prn(x.col1||','|| x.col2||','||x.col3|| chr(13));
            end loop;        
       end;What peace of code should I add to procedure that is generating web page to enable calling this procedure and whole saving process?
    Can anybody help me with this?
    Many thanks,
    Tomas
    Message was edited by:
    Tomeo

    Hi Marc,
    thanks for reply, problem is that I'm not using APEX application, I'm just generating web page code straight using oracle general packages.
    But I found this solution (maybe some tunning will be good):
    In page where I want to display Download i have
      begin
             htp.anchor2 (
                           curl  =>  ... .p_getcsv'||'?term=2005&crn=123,
                           ctext => 'Download Class List'
             HTP.br;
          end;
    ...si I'm calling p_getcsv procedure:
      procedure p_getcsv( term  IN stvterm.stvterm_code%TYPE DEFAULT NULL,
                           crn   IN sirasgn.sirasgn_crn%TYPE DEFAULT NULL) is
       v_length      NUMBER;
       v_file_name   VARCHAR2 (2000);
       temp_blob  blob;
       line RAW(32767);
       begin
             DBMS_LOB.CREATETEMPORARY(temp_blob, TRUE);
             FOR i IN 1..6  LOOP
                line := UTL_RAW.CAST_TO_RAW(i||','||term||','||crn||',AAA,BBB,CCC'||chr(10));
                DBMS_LOB.WRITEAPPEND(temp_blob, LENGTH(UTL_RAW.CAST_TO_VARCHAR2(line)), line);
             END LOOP;
              v_file_name := 'ClassList.csv';
              v_length  := DBMS_LOB.getlength (temp_blob);
              -- set up HTTP header
                 -- use an NVL around the mime type and
                 -- if it is a null set it to application/octect
                 -- application/octect may launch a download window from windows
               OWA_UTIL.mime_header (NVL ('csv', 'application/octet'), FALSE);
               -- set the size so the browser knows how much to download
               HTP.p ('Content-length: ' || v_length);
               -- the filename will be used by the browser if the users does a save as
               HTP.p (   'Content-Disposition:  attachment; filename="'
                  || REPLACE (REPLACE (SUBSTR (v_file_name,
                                               INSTR (v_file_name, '/') + 1
                                       CHR (10),
                                       NULL
                              CHR (13),
                              NULL
                  || '"'
                 -- close the headers
                 OWA_UTIL.http_header_close;
                -- download the BLOB
                 WPG_DOCLOAD.download_file (temp_blob);
                 -- release temporary blob
                 dbms_lob.freetemporary(temp_blob);  
       end;Regards,
    Tomas

  • ADM Error processing results from query: Error: Index 0 out of range

    11.1.2.1
    When running quite a large book, we are getting the following error:
    ADM Error processing results from query: Error: Index 0 out of range
    The individual reports in the books are running fine.
    PS.  The report books that are giving this error run fine on 9.3.1
    Could this be a time-out issue and how do we resolve it?

    what is background datasource Essbase or HFM
    do you have lot of data in pov please try below
    >Do you have pov prompt
    >increase jvm heap size for report server in reporting server
    >Fr log files has some more detail

  • How to get result from query for ssrs?

    DECLARE @meter_number int
    SET @meter_number=25112
    IF @meter_number IN (SELECT meter_number FROM ods.pmc.meter_registers)
    BEGIN
    SELECT 'LA' as [data_center]
    , t.request_time_gmt
    , aca.transaction_id
    , aca.meter_number
    , CONVERT(date, aca.ship_date_gmt) as ship_date
    , aca.user_name
    , p.confirmation_number
    , p.origin_zip
    , p.destination_zip
    , p.destination_zip_addon
    , p.base_postage_cost
    , p.mail_class_id
    , p.weight_ounces
    , p.delivery_confirmation
    , cil.ascending_register
    -- , ih.transaction_date_gmt
    , ih.from_name, ih.from_company, ih.from_address_line_1, ih.from_address_line_2, ih.from_city, ih.from_state, ih.from_zip
    , ih.to_name, ih.to_company, ih.to_address_line_1, ih.to_address_line_2, ih.to_city, ih.to_state, ih.to_zip
    FROM ods.sws.create_indicium_log aca --#USPS_Amazon_Cust_Activity aca
    JOIN ods.sws.prints p (NOLOCK)
    ON aca.transaction_id = p.transaction_id
    JOIN ods.sws.transactions t (NOLOCK)
    ON aca.transaction_id = t.transaction_id
    JOIN ods.sws.create_indicium_log cil (NOLOCK)
    ON aca.log_id = cil.log_id
    LEFT JOIN ods.pmc.indicium_history ih
    ON p.confirmation_number = ih.confirmation_number
    END
    ELSE IF @meter_number in (SELECT meter_number FROM ods.pmc_dr01.meter_registers)
    BEGIN
    SELECT 'PHX' as [data_center]
    , t.request_time_gmt
    , aca.transaction_id
    , aca.meter_number
    , CONVERT(date, aca.ship_date_gmt) as ship_date
    , aca.user_name
    , p.confirmation_number
    , p.origin_zip
    , p.destination_zip
    , p.destination_zip_addon
    , p.base_postage_cost
    , p.mail_class_id
    , p.weight_ounces
    , p.delivery_confirmation
    , cil.ascending_register
    , ih.from_name, ih.from_company, ih.from_address_line_1, ih.from_address_line_2, ih.from_city, ih.from_state, ih.from_zip
    , ih.to_name, ih.to_company, ih.to_address_line_1, ih.to_address_line_2, ih.to_city, ih.to_state, ih.to_zip
    FROM ods.sws.create_indicium_log aca--#USPS_Amazon_Cust_Activity aca
    JOIN ods.sws_dr01.prints p (NOLOCK)
    ON aca.transaction_id = p.transaction_id
    JOIN ods.sws_dr01.transactions t (NOLOCK)
    ON aca.transaction_id = t.transaction_id
    JOIN ods.sws_dr01.create_indicium_log cil (NOLOCK)
    ON aca.log_id = cil.log_id
    LEFT JOIN ods.pmc_dr01.indicium_history ih
    ON p.confirmation_number = ih.confirmation_number
    END
    I executed this query it says command completed successfully how can it return results?

    Hi,
    Create a procedure as shown below in the database and while creating the Dataset in SSRS , Select Stored procedure as a source and call this newly created procedure using command EXEC Usp_Meter_Number 25112.
    The columns will automatically generated and u can use the columns.
    CREATE PROCEDURE Usp_Meter_Number
    @meter_number int
    AS
    BEGIN
    IF @meter_number IN (SELECT meter_number FROM ods.pmc.meter_registers)
    BEGIN
    SELECT 'LA' as [data_center]
    , t.request_time_gmt
    , aca.transaction_id
    , aca.meter_number
    , CONVERT(date, aca.ship_date_gmt) as ship_date
    , aca.user_name
    , p.confirmation_number
    , p.origin_zip
    , p.destination_zip
    , p.destination_zip_addon
    , p.base_postage_cost
    , p.mail_class_id
    , p.weight_ounces
    , p.delivery_confirmation
    , cil.ascending_register
    -- , ih.transaction_date_gmt
    , ih.from_name, ih.from_company, ih.from_address_line_1, ih.from_address_line_2, ih.from_city, ih.from_state, ih.from_zip
    , ih.to_name, ih.to_company, ih.to_address_line_1, ih.to_address_line_2, ih.to_city, ih.to_state, ih.to_zip
    FROM ods.sws.create_indicium_log aca --#USPS_Amazon_Cust_Activity aca
    JOIN ods.sws.prints p (NOLOCK)
    ON aca.transaction_id = p.transaction_id
    JOIN ods.sws.transactions t (NOLOCK)
    ON aca.transaction_id = t.transaction_id
    JOIN ods.sws.create_indicium_log cil (NOLOCK)
    ON aca.log_id = cil.log_id
    LEFT JOIN ods.pmc.indicium_history ih
    ON p.confirmation_number = ih.confirmation_number
    END
    ELSE IF @meter_number in (SELECT meter_number FROM ods.pmc_dr01.meter_registers)
    BEGIN
    SELECT 'PHX' as [data_center]
    , t.request_time_gmt
    , aca.transaction_id
    , aca.meter_number
    , CONVERT(date, aca.ship_date_gmt) as ship_date
    , aca.user_name
    , p.confirmation_number
    , p.origin_zip
    , p.destination_zip
    , p.destination_zip_addon
    , p.base_postage_cost
    , p.mail_class_id
    , p.weight_ounces
    , p.delivery_confirmation
    , cil.ascending_register
    , ih.from_name, ih.from_company, ih.from_address_line_1, ih.from_address_line_2, ih.from_city, ih.from_state, ih.from_zip
    , ih.to_name, ih.to_company, ih.to_address_line_1, ih.to_address_line_2, ih.to_city, ih.to_state, ih.to_zip
    FROM ods.sws.create_indicium_log aca--#USPS_Amazon_Cust_Activity aca
    JOIN ods.sws_dr01.prints p (NOLOCK)
    ON aca.transaction_id = p.transaction_id
    JOIN ods.sws_dr01.transactions t (NOLOCK)
    ON aca.transaction_id = t.transaction_id
    JOIN ods.sws_dr01.create_indicium_log cil (NOLOCK)
    ON aca.log_id = cil.log_id
    LEFT JOIN ods.pmc_dr01.indicium_history ih
    ON p.confirmation_number = ih.confirmation_number
    END
    END
    Please have look on the comment

  • Transfer results from query to another cube

    How to populate the results of my query into another InfoCube. Any ideas on how I should go about this?
    [email protected]
    regards
    andrea

    Hi Andreas,
          you can do the following. you can download the dat from the query directly to tables using RSCRM_BAPI. Then you cam write an extractor in BW itself which fetches data from those tables. You can use BW source sys for extracting dta from these tables and load the data to cube and can report on that. You can alos put the entire process in Process chain too.
    Hope this helps you......

  • How to update multiple tables using results from query

    I'm a bit rusty on this stuff and am hoping for some help.
    Table 1 is:
    location_id, location_name
    Table 2 is
    location_id, employee_id and misc. other columns
    Then there are multiple tables with associated data, keys being location_id and employee_id.
    There are no established relationships.
    Trying to come up with a process to change location_id for all employees assigned to a particular location.
    It seems to me that the basics are
    select employee_id from Table2 where location_id='xxxxxx'
    Then take each employee_id returned and change their location_id in each of the other tables
    I'm not clear on how to load the returned employee id's as variables and then loop through them.
    Thanks

    Thanks for the welcome. I'll read up on the rules now.
    Below is the DDL for a couple of the tables.
    Version = 11g
    I would query the users table for all users with a certain site_id and then use them to update the site_id in the users table (and other tables)
    -- DDL for Table USERS
    CREATE TABLE "USERS"
    (     "USERID" VARCHAR2(8 BYTE),
         "PASSWORD" VARCHAR2(50 BYTE),
         "FIRST_NAME" VARCHAR2(50 BYTE),
         "LAST_NAME" VARCHAR2(50 BYTE),
         "SITE_ID" VARCHAR2(5 BYTE),
         "ROLE_ID" VARCHAR2(1 BYTE)
    ) SEGMENT CREATION IMMEDIATE
    PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
    TABLESPACE "SITES_DATA_TS"
    CACHE ;
    -- DDL for Table EMPLOYEE_PROFILE
    CREATE TABLE "EMPLOYEE_PROFILE"
    (     "EMPLOYEEID" VARCHAR2(9 BYTE),
         "PROGRAM" NUMBER,
         "REQUIREMENT" NUMBER,
         "JOBNUM" VARCHAR2(50 BYTE),
         "STATUS" VARCHAR2(50 BYTE),
         "PROGRAM_TYPE" VARCHAR2(50 BYTE),
         "SITE_ID" VARCHAR2(5 BYTE),
         "NUM_QUAL_TEST_ATTEMPTS" NUMBER(7,0)
    ) SEGMENT CREATION IMMEDIATE
    PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
    TABLESPACE "SITES_DATA_TS"
    CACHE ;

  • Results from query are not shown (FRM-40350)

    When I do a query on a form I get the message FRM-40350 Query caused no records to be retrieved. But when I use count query there are records fetched..
    I would like to know what can be causing this.
    I am using Designer 2.1.2 with Headstart 2.1.2.

    Dear Prakash,
    you have saved our day!!
    That was exactly to step needed to bring the key figures into the query.
    Why is this not documented anywhere?
    Thank you very much,
    Mathias

  • Pagination Limit the number of result from query. If exceed throw error

    Hi expert,
    I have a question that need your guidance.
    Declare
        type myarray is table of emp.empid%type;
        mytab myarray;
        vcounter number;
        vlimit number;
    Begin
        select limitnumber into vlimit from ABC where table_name = 'XYZ';
        select count(*) into vcounter from emp where empid = 1 /*let say this return 5500 records and take 10 seconds*/
        if vcounter > 5000 then
           raise_application_error(-20010,'you will process more than allowed number of record');
        else
            select empid bulk collect into mytab where empid = 1; /*let say this will take another 10 seconds for 5000 records*/
        end if
    End;
    /as you see there, if I want to insert 5000 records it will take me 10 sec to count first and then another 10 sec to insert.
    I am trying to avoid the count to save time, but how to limit if the array insertion to 5000 otherwise throw the error.
    please note that we limit the limitnumber in table ABC and that can be changed.
    thanks
    Henk
    Edited by: user9180414 on Oct 19, 2011 12:57 PM

    If you want to select just first 5000 rows use LIMIT:
    select empid bulk collect into mytab limit 5000 where empid = 1;If you also want to make sure there is no more than 5000 rows use:
    select empid bulk collect into mytab limit 5001 where empid = 1;
    if mytab(5001). exists then
    raise_application_error(-20010,'you will process more than allowed number of record');
    end if;SY.

  • Weird result from query

    Hi
    I am trying to do the following, it returns NOTHING !
    create table comm_count as
    select user_id from comm_voice where not exists ( select user_id from tn_login,bms_test_phone
    where tn_login.login_name = bms_test_phone.phonenum);
    so I tried to do separately
    select user_id from comm_voice; ---- return 733 rows
    select user_id from tn_login,bms_test_phone where tn_login.login_name = bms_test_phone.phonenum ------ return 1361 rows
    I assume this 2 queries will have NO INTERSECTION
    so I would expect the table comm_count will get 733 rows data, so why it now returns NOTHING ?

    Apart from the obvious issue of the missing correlation, it also might be a problem of missing alias names.
    Try this
    create table comm_count as
    select c.user_id
    from comm_voice c
    where not exists ( select null
                             from tn_login l
                             join bms_test_phone p on l.login_name = p.phonenum
                             where l.user_id = c.user_id);

  • How to get save result from EXECUTE from a dynamic SQL query in another table?

    Hi everyone, 
    I have this query:
    declare @query varchar(max) = ''
    declare @par varchar(10)
    SELECT @par = col1 FROM Set
    declare @region varchar(50)
    SELECT @region = Region FROM Customer
    declare @key int
    SELECT @key = CustomerKey FROM Customer
    SET @query = 'SELECT CustomerKey FROM Customer where ' + @par + ' = '+ @key+ ' '
    EXECUTE (@query)
    With this query I want get col1 from SET and compare it to the column Region from Customer. I would like to get the matching CustomerKey for it.
    After execution it says commands are executed successfully. But I want to save the result from @query in another table. I looked it up and most people say to use sp_executesql. I tried a few constructions as sampled and I would always get this error: 
    Msg 214, Level 16, State 2, Procedure sp_executesql, Line 12
    Procedure expects parameter '@statement' of type 'ntext/nchar/nvarchar'.
    So the output should be a list of CustomerKeys in another table.
    How can I save the results from EXECUTE into a variable? Then I assume I can INSERT INTO - SELECT in another table. 
    Thanks

    CREATE TABLE Customer
    (CustomerKey INT , Name NVARCHAR(100));
    GO
    INSERT dbo.Customer
    VALUES ( 1, N'Sam' )
    GO
    DECLARE @query nvarchar(max) = ''
    declare @par varchar(10) = 'Name',
    @key varchar(10) = 'Sam'
    CREATE TABLE #temp ( CustomerKey INT );
    SET @query =
    insert #temp
    SELECT CustomerKey
    FROM Customer
    where ' + @par + ' = '''+ @key+ ''' '
    PRINT @query
    EXEC sp_executesql @query
    SELECT *
    FROM #temp
    DROP TABLE #temp;
    DROP TABLE dbo.Customer
    Cheers,
    Saeid Hasani
    Database Consultant
    Please feel free to contact me at [email protected] as well as on Twitter and Facebook.
    [My Writings on TechNet Wiki] [T-SQL Blog] [Curah!]
    [Twitter] [Facebook] [Email]

  • How to compare result from sql query with data writen in html input tag?

    how to compare result
    from sql query with data
    writen in html input tag?
    I need to compare
    user and password in html form
    with all user and password in database
    how to do this?
    or put the resulr from sql query
    in array
    please help me?

    Hi dejani
    first get the user name and password enter by the user
    using
    String sUsername=request.getParameter("name of the textfield");
    String sPassword=request.getParameter("name of the textfield");
    after executeQuery() statement
    int exist=0;
    while(rs.next())
    String sUserId= rs.getString("username");
    String sPass_wd= rs.getString("password");
    if(sUserId.equals(sUsername) && sPass_wd.equals(sPassword))
    exist=1;
    if(exist==1)
    out.println("user exist");
    else
    out.println("not exist");

  • How to use Results from Another Query for SAP BW universes

    Hi Everyone,
    I have two SAP BI universes.In my First universe I have Sales Doc no (dimension) and Orderqty (Measure) and in my second universe I have Sales Doc no(Dimension) and BillQty (Measure).
    Here in my first dataprovider I have 1200 rows of data and in second dataprovider I have 75,000 rows. The report should fetch only the BillQty details that matches to corresponding  Sales doc no in first data provider.
    I want to place all these fileds into a single report like as shown.
    (Datarpovider1)                (Datarpovider1)                    (Datarpovider2)
    *Sales Doc No*               Orderqty                           BillQty
    Here I am able to generate single report using merge dimension but it is leading to performance issues. I want to restrict the values at query level by passing the First dataprovider Sales doc no to second Data provider Sales doc number using Results from Anothery Query feature so that It can fetch only the matching records.
    I tried it but it was giving the follwing error:
    A filter contains a wrong value. You cannot run this query. (Error: WIS 00007)
    How Can I get rid of this error. Can we use Results from Anothery Query option for OLAP universe. Are there any limitation on it.
    All this I am doing in Webi Rich Client.
    Appreciate your help
    Thanks &in Advance
    Kiran Saka

    Hi Kiran,
    I think the filter has a wrong operand. For example, a filter with an empty constant, or a filter that deals with numeric values is defined with an alphanumeric value.Check out for this.
    Regards,
    Neeraj

  • Can we use Result from another query in Webi using Bex uery universe?

    Hi,
    Can we use Result from another query filter option in Webi to create a report using a Bex Query universe?
    I need to create a report using two universes, one is Bex Query Universe and the other is Orcle universe. I have two queries, one is using Oracle universe; the other using Bex Query universe. I need to pass the Oracle data from the Oracle query to the Bex Query query to get the matched data from SAP Bex query.
    I used Result from another query in the query filter panel for the query using Bex query universe. But I got an error saying that 'A filter contains a wrong value. you cannot run this query. (Error: WIS 00007). The data used in the filter on both sides are the same. they are char.
    I have tested by using two queries from the same Bex query universe to see if the Result from another query filter option works. And I got the same error.
    Has anyone run into the same issue and if this is possible and what should be the solution?
    Thanks in advance!
    Edited by: BO_Haiyan on Oct 6, 2010 3:47 PM

    In that situation:
    Create two queries : Oracle and BW query.
    @ Report:
    As you have to see result set from both the Dataproviders, correct? To achieve thise one must have common dimension objects to merge them at report and use Objects those are coming from both queries to use them in single Table/Report.
    Unless you don't use Merge Dimensions, you don't get a chane to use both queries objects in single Table/Report. (It will give tooltip saying: You can't drop here -- Incompatable Objects)
    In case, if you don't have common dimensions, change object definitions to Detail objects, for those required.
    Hope it helps you.
    Thank You!!

  • Limit the number of results from a querying a table

    I have a table, NAMES, that holds appx 50 names.
    I want to be able to list a certain amount of names and once that limit is reached( 6 or 7 or so), output a row / link / statement that says, you've reached your limit.
    For example the output would look similar to :
    Jim
    John
    James
    Mike
    Henry
    Mark
    'Limit Reached'
    'Limit Reached' would eventually need to be a link, but I am already familiar with creating links from query results, persay.
    I've experimented with listagg, case statements and decode but am not sure how to do this. I'm thinking decode is the way to go but am not sure how to keep track of a counter as the sql is running. This needs to be written in sql only, not pl/sql, if possible. My query so far is
    Select first, last
    From Names
    where rownum <= 6
    Not sure how to accomplish this. Any help would be greatly appreciated. Thanks in advance

    Hi,
    NewApexCoder wrote:
    @FrankKulasg
    I have tested these using union. However, I also have columns I need to include that aren't text fields (such as an ID column, which is a number / integer type). I can't use NULL. Is there anything to substitue for this?
    Other people can use NULL.  Why can't you?
    If you could use NULL. then you could do something like this:
    SELECT  ename
    ,       job
    ,       sal     -- a NUMBER column
    FROM    scott.emp
    WHERE   ROWNUM  <= 6
        UNION ALL
    SELECT  'Limit reached'
    ,       NULL    -- in place of a VARCHAR2
    ,       NULL    -- in place of a NUMBER
    FROM    dual
    Output:
    ENAME         JOB              SAL
    SMITH         CLERK            800
    ALLEN         SALESMAN        1600
    WARD          SALESMAN        1250
    JONES         MANAGER         2975
    MARTIN        SALESMAN        1250
    BLAKE         MANAGER         2850
    Limit reached
    7 rows selected.

  • Query on results from another query

    Post Author: Duncan1980
    CA Forum: Crystal Reports
    Is it possible to query on the results from another query.  I have a query that produces a list of document numbers.  I want to use the output from that query as the filter criteria in a another query in the same Universe. 
    The output from the first query can be as much as 2000, so it would be very time consuming to cut and paste these into a filter.
    Both reports are built, but can not figure out how to link the first report output to the filtering criteria on the second report.  I
    I am using business objects XI release 2 web intelligence 11.5.3.417 enterprise.

    Hi Vivek,
    It was not directly solved but I applied alternate logic to over come the issue.
    Here's what I did to overcome:
    I used a sub query in place of the whole result from another query.
    For Ex:
    Dim1 inlist result from another query1
    I made it as
    Dim1 inlist (Dim0)
    where Conditions.
    Here Dim0 is the object which we use for Result from another query and Conditions will be the necessary filter conditions to arrive proper Dim0.  Make sure proper context is formed for the sub query.
    Even though it resolved my problem, It introduces an new issue. It causes increase in query run time when huge set of data is returned from sub query.
    Please let me know if i haven't explained clearly.
    Hi Aris_BO,
    Sorry for not responding earlier.  The logic would probably make more queries null & not null. Thats why I was not advised to use it.
    Thanks
    LN

Maybe you are looking for

  • Open Qty and Delivered Qty  remains same even after Return

    Hello After making return, the open qty remains the same and its not reflecting the return qty. for e.g. I have made a Sale Order of 100 qty I delivered 20 In sales order my Delivered Qty is 20 and Open qty is 80 Now I made a Return of above 20 Qty B

  • Problems With Samsung SCD107 Camcorder

    Hi, I have the Samsung SCD107 Camcorder and whenever I turn it on and enter camera mode all I see on the LCD screen and viewfinder is black. I have been told that the CCD sensor is broken. I was wondering if this is able to be repaired and how much i

  • IPad 2 and IOS8

    My iPad 2 is basically unusable after the iOS 8 update. The 8.0.2 did not help. It is super laggy and non responsive. I've "Reset All Settings" under General -> Reset but to no avail. Any suggestions on how to remedy this situation? Thanks.

  • Program to send multiple emails?

    Hi all, I have been using Mailings but it has issues when sending, does anyone know of a Mass Email program?

  • Installment lates 2 60's and 5 30'2 24 months reported what improvement?

    This account was reported inaccurate and the company is fixing it to show perfect history. Any idea how many points that will give me?