Tabular: Row filter on USERNAME() still returns all rows if current user is NOT matched in table??

I have a table (basically the same setup in the various dynamic security in tabular blogs) where the table contains WindowsUserName stored as domain\username.
I have a Row Filter on the table: SecurityTable has a filter of =SecurityTable[WindowsUserName]=USERNAME()
When a user connects to the tabular model AND their name is matched in one of the rows they return JUST the rows with their match.  Which makes sense.
However, if a user connects and their Windows user name is NOT in a row in that table....they return ALL rows???
That makes no sense to me.
It behaves almost as if it is doing a check and if it DOESN'T find a match it just returns all values.
What am I missing?
--------------EDIT-----------
Found the issue: that use was (unknown to me) a domain admin, so... admin rights trump all :)

Resolved:
User had admin rights, didn't realize this at the time.

Similar Messages

  • Query to return ALL rows even those with zero counts

    Hi,
    The following query will return only those rows that have a non zero count value:
    select c.id, a.name, count(*) as XYZ from CON c, CUST a
    where c.help !='1' and (c.id = a.id) group by c.id, a.name order by c.id;
    The results are:
    1 ME 3
    3 YOU 4
    What i want is to return all rows in CUST and the count, XYZ, that correspond to each row in CUST that matches the whare condition above, even if the count is zero.
    ie
    1 ME 3
    2 WE 0
    3 YOU 4
    Can this be done?

    You may want to get the counts then do the outer join. If you simply count with an outer join you will get 1 for 'WE' because there is a row in the cust table with 'WE'. This may work for you;
    with
      cust as (
       select 1 id, 'ME' name from dual union all
       select 2 id, 'YOU' name from dual union all
       select 3 id, 'WE' name from dual),
      con as (
       select 1 id, '2' help from dual union all
       select 1 id, '2' help from dual union all
       select 1 id, '2' help from dual union all
       select 2 id, '2' help from dual union all
       select 2 id, '2' help from dual union all
       select 2 id, '2' help from dual union all
       select 2 id, '2' help from dual)
    -- end of test data 
    select a.id, a.name, nvl(c.cnt,0) xyz
    from cust a, 
       (select id, help, count(*) cnt
       from con
       where help !='1'
       group by id, help) c
    where a.id = c.id(+)

  • Returns all values if the user leaves the valuve empty ?

    is there a way to return all values if a user leaves lets say, the 'Project_no' valve empty..
    Below is the bit of SQL that I'm trying to get to work..
    and upper(coj.CUSTOMER_PO_NO) like upper(('%&Project_No%'))

    JamesW wrote:
    is there a way to return all values if a user leaves lets say, the 'Project_no' valve empty..
    Below is the bit of SQL that I'm trying to get to work..
    and upper(coj.CUSTOMER_PO_NO) like upper(('%&Project_No%'))And what's not working about it?
    SQL> ed
    Wrote file afiedt.buf
      1* select * from emp where job like '%&job%'
    SQL> /
    Enter value for job: CLERK
    old   1: select * from emp where job like '%&job%'
    new   1: select * from emp where job like '%CLERK%'
         EMPNO ENAME      JOB              MGR HIREDATE                    SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17-DEC-1980 00:00:00        800                    20
          7876 ADAMS      CLERK           7788 23-MAY-1987 00:00:00       1100                    20
          7900 JAMES      CLERK           7698 03-DEC-1981 00:00:00        950                    30
          7934 MILLER     CLERK           7782 23-JAN-1982 00:00:00       1300                    10
    SQL> /
    Enter value for job:
    old   1: select * from emp where job like '%&job%'
    new   1: select * from emp where job like '%%'
         EMPNO ENAME      JOB              MGR HIREDATE                    SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17-DEC-1980 00:00:00        800                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-1981 00:00:00       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-1981 00:00:00       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-1981 00:00:00       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-1981 00:00:00       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-1981 00:00:00       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-1981 00:00:00       2450                    10
          7788 SCOTT      ANALYST         7566 19-APR-1987 00:00:00       3000                    20
          7839 KING       PRESIDENT            17-NOV-1981 00:00:00       5000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-1981 00:00:00       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-1987 00:00:00       1100                    20
          7900 JAMES      CLERK           7698 03-DEC-1981 00:00:00        950                    30
          7902 FORD       ANALYST         7566 03-DEC-1981 00:00:00       3000                    20
          7934 MILLER     CLERK           7782 23-JAN-1982 00:00:00       1300                    10
    14 rows selected.

  • PowerPivot 2013 | Drill to Details returns all rows

    When double-clicking on a measure, or a value within a powerpivot pivot table, the drill to details sheet returns all the rows in the dataset. 
    Is this normal behavior? Is there a workaround for this?
    Thank you!

    The drillthrough should respect all filter context in the pivot table, thus it should only be returning those values that make up the subset determined by the table filters, slicers, and whichever field labels make up the row and column filters.
    Any filtering logic you have written into the measures themselves will not be maintained for the drillthrough.

  • Business Objects is not returning all rows from Query

    We set the rowcount to 1000000 and the business objects query only returns 16,960 rows.  We then uncheck the limit for the rowcount and the first run of the query returns 65,535.  The subsequent run of the query returns all the rows which is greater than 65,535.  We are on release 6.1A of business objects and selecting from Microsoft SQLServer 2005 in 2000 compatablility mode. We noticed that the rowcount being sent to SQLServer is replacing the set number with the 65,535 the first time the query is sent and subsiquent queries have the correct rowcount set.  What would be causing the rowcount to be reset and how can it be fixed?

    We set the rowcount to 1000000 and the business objects query only returns 16,960 rows.  We then uncheck the limit for the rowcount and the first run of the query returns 65,535.  The subsequent run of the query returns all the rows which is greater than 65,535.  We are on release 6.1A of business objects and selecting from Microsoft SQLServer 2005 in 2000 compatablility mode. We noticed that the rowcount being sent to SQLServer is replacing the set number with the 65,535 the first time the query is sent and subsiquent queries have the correct rowcount set.  What would be causing the rowcount to be reset and how can it be fixed?

  • Regular Report Not Returning All Rows

    Greetings,
    On APEX version 4.1.1.00.23 Using latest versions of Chrome and IE. I found some threads that discussed this aspect some, but not to the extent that is helpful to my situation.
    I know it is crazy to have APEX return 40K+ rows on a report, but I have a need to do so. I need to return that many rows from a table so that an APEX page can be opened via Excel and then have an Excel macro run over the report results and import all 40K+ rows into a worksheet. As I said, that's crazy, but the decision isn't mine. :-) We have the macro working and it passes parameters to the APEX page and imports data from the APEX page.
    Also, the report has 14 columns on it, not that many.
    Given the requirement above I have a regular report page that only has the report and 2 page items on it. The page items contain values that are passed via Excel and are then used in the WHERE condition of the report. Using the same WHERE condition, when I run the SQL for the report outside of APEX it returns 46,840 rows. I have the both the Number of Rows and Maximum Row Count settings set to 50000. And, I have the Pagination Scheme set to Row Ranges X to Y of Z (with pagination).
    When I run the page and enter the selection criteria the report only returns 15,500 rows. Yes, that's a lot rows. And, it takes about 5 minutes to populate. But, it doesn't return ALL of the rows. Also, the pagination suggests that all rows were returned because it reads - row(s) 1 to 15500 of 15500. I have changed the pagination and max rows settings a lot to see of it's just a matter of having the correct report setting. I've yet to find a setting that will cause the whole 46840 result set to be returned.
    It may end up that the report selection needs to change in order to return fewer rows. But, regardless of that why isn't APEX returning the complete result set now? And, is there a way to force it to return the complete result set regardless of the size?
    Any suggestions are appreciated.
    Thanks, Tony

    cloaked wrote:
    Thanks for the response. Yup, you're correct. Downloading to a CSV might be better. I've set reports up that way many, many times. I have even developed pages that import from a CSV into APEX using PL/SQL, years before it was an APEX feature. I initially set the report up to allow it to be downloaded, but the user doesn't want it to work that way.
    The worksheet will be used by a lot of people in our accounting department and they want the process to be as simple as possible. Right now Excel opens up the APEX page, logs into the application, passes parameters to it for the month and company, hits the Select button, waits on the report to build, then automatically imports it, and finally closes the page. It is quite slick. Yes, it takes 5 minutes to run, but the user is OK with that given what the automation provides.
    So, in order for the automated import to work properly all 45K rows need to display on one page, without pagination. I currently have pagination on the page simply to determine if APEX is returning all of the rows.A process of this nature might work better using an export: XML or export: CSV report template, which won't go anywhere near pagination. When a page containing a report using these templates is requested APEX sends the report results in XML or CSV format rather than rendering the page. This should be faster, avoid complications with pagination, and be easier to parse in Excel.
    Previous thread along similar lines: +{thread:id=2285213}+

  • Loop Not Returning All Rows

    I finally need to turn to the forum after trying for a few days to resolve my problem I decide to turn to the Oracle people for help.
    The following code below does two things:
    1. If I have the get_menu_label in side of it's own loop it never returns
    2. If I take the get_menu_label out side of it's own loop it returns but does not return all the data.
    DECLARE
    -- GETTING THE DATABASE NAME
    CURSOR get_db_name
    IS
    SELECT DATABASE
    FROM uaf_mfgp_menus_and_groups_vm
    GROUP BY DATABASE
    ORDER BY DATABASE ASC;
    -- GETTING THE OBJECT_ID FOR EACH DATABASE
    CURSOR get_object_id_db (l_db_name VARCHAR2)
    IS
    SELECT object_id
    FROM UAF_FORM_OBJECTS
    WHERE object_label_2 = l_db_name;
    -- GETTING THE GROUP NAME
    CURSOR get_gp_name
    IS
    SELECT group_name
    FROM uaf_mfgp_menus_and_groups_vm
    GROUP BY group_name
    ORDER BY group_name ASC;
    -- GETTING THE OBJECT_ID FOR GROUP WITH GP NAME AND DATABASE
    CURSOR get_object_id_gp (l_gp_name VARCHAR2, db_id NUMBER)
    IS
    SELECT object_id
    FROM UAF_FORM_OBJECTS
    WHERE object_label_2 = l_gp_name AND parent_object_id = db_id;
    -- GETTING MENU LABEL
    CURSOR get_menu_label (l_db_name VARCHAR2, l_gp_name VARCHAR2)
    IS
    SELECT menu_label
    FROM uaf_mfgp_menus_and_groups_vm
    WHERE DATABASE = l_db_name AND group_name = l_gp_name;
    got_object_id_db NUMBER (20);
    got_object_id_gp NUMBER (20);
    got_db VARCHAR2 (100);
    got_menu_label VARCHAR2 (200);
    BEGIN
    FOR c1 IN get_db_name
    LOOP
    FOR c2 IN get_gp_name
    LOOP
    OPEN get_object_id_db (c1.DATABASE);
    FETCH get_object_id_db
    INTO got_object_id_db;
    OPEN get_object_id_gp (c2.group_name, got_object_id_db);
    FETCH get_object_id_gp
    INTO got_object_id_gp;
              CLOSE get_object_id_db;
    CLOSE get_object_id_gp;
    OPEN get_menu_label (c1.DATABASE, c2.group_name);
    LOOP
    FETCH get_menu_label
    INTO got_menu_label;
    END LOOP;
    CLOSE get_menu_label;
    DBMS_OUTPUT.put_line ( 'GP_OBJECT_ID= '
    || got_object_id_gp
    || ' '
    || 'MENU_LABEL= '
    || got_menu_label
    END LOOP;
    END LOOP;
    END;
    /

    Javier, this the wrong way to use PL/SQL. Oracle SQL can do all this for you using JOINs.
    This code, even if it did work, would be terrible slow - unable to scale with data volumes.
    This code breaks a few fundamental Oracle rules:
    - row-by-row processing using PL/SQL
    - huge number of context swicthes per PL/SQL loop iteration
    - not maximizing SQL and minimizing PL/SQL
    I suggest you trash this code and write a SQL JOIN instead.

  • Stored Procedure fails to return all rows of data.

    Our HR database uses a procedure to build a list of employee IDs (ie. 1,3,14,...1210,1215) then calls a procedure to with a variable to extract details per employee. Unfortunately the list is 947 ids, however only 887 rows are returned.
    As a test I split the list in two and called the procedure. If I add the data rows together I get 947, hence I know the employees are valid. Can anyone suggest why a long list of Ids should fail? Is there a limit a stored procedure can return?
    The procedure (simplified down a bit) is:
    ALTER PROCEDURE [dbo].[sp_Employee_CreateTable]
     @EmpIds varchar(4000)
    AS
    SELECT    E.empid as EmpId ,E.Surname
        FROM    Employee E
        WHERE  (E.[EmpID] IN (select * from GetAllUsersUnderManager(@EmpIds))) AND EJ.id=dbo.GetCurrentEmployeeJobRecord(EJ.empid)--EJ.dateto IS NULL
    I can run the procedure as:
    "exec sp_Employee_CreateTable @EmpIds=N'1,3,14.....999'" which returns (say) 700 rows  and  "exec sp_Employee_CreateTable @EmpIds=N'1001,.....1215'" which returns 247 rows. (ie. 700+247 = 947 which is correct.
    But exec sp_Employee_CreateTable @EmpIds=N'1,3,14......1215' only returns 887 rows.
    I have looked at the length of the data passed to the procedure (1,3,...1215) which equals 4126 chars, therefore I bumped the varchar space from 4,000 to 6,000 which is still within limits, however the number of rows returned was still 887.
    Any help would be gratefully received.

    Hi Scott. I run the script you suggested (thank you), the var EmpIds was set to a string with over 930 ids. The returned data set started with 0 but only had 888 rows. As mentioned above I refer the 930+ list as full list, and the 888 as the short list.
    The difference (around 47) were the last values in the full list.
    Although EmpIds was set to 6K it definately seems like it gets to around 4K chars then ignores any other values.
    Re "since you pass....". Absolutely. I have modified the Employee_CreateTable with the var update to 6K/
    ALTER PROCEDURE [dbo].[sp_Employee_CreateTable]
     @EmpIds varchar(6000),
     @IncludeLeavers Bit
    AS
        SELECT    E.empid as EmpId ,E.Surname, E.Firstname as Forename,E.PayrollID, E.intextno as Extension, EJ.position as Position, [dbo].[GetEmployeeDepartment](E.empid) as Department, [dbo].[GetEmployeeLocation](E.empid) as Location,
    E.title as Title, EJ.ReportsTo,
                CoEmail,E.[left]
        FROM    Employee E INNER JOIN EmployeeJobs EJ
        ON        E.empid = EJ.empid
        WHERE  (E.[EmpID] IN (select * from GetAllUsersUnderManager(@EmpIds))) AND EJ.id=dbo.GetCurrentEmployeeJobRecord(EJ.empid)--EJ.dateto IS NULL
                AND (E.[left]=0 or E.[left]=@IncludeLeavers)
        ORDER BY E.Surname, E.Firstname, E.empid

  • URGENT : Return all rows when parameters null

    Hi !
    I have a simple question for you guys.
    I have some problems creating an SQL.
    Effectively, I want to be able to return all the rows of a table when my parameters are null.
    Here is an example of what I'm saying.
    SELECT COPY_TRANSACTION.DATE_TRANSACTION,
           COPY_TRANSACTION.CODE_NT,
           COPY_TRANSACTION.NOM_GROUPE,
           COPY_TRANSACTION.NOM_PROVENANCE,
           COPY_TRANSACTION.NOM_SUJET,
           COPY_TRANSACTION.NOM_ACTION,
           COPY_TRANSACTION.NOM_SOURCE,
           COPY_TRANSACTION.NOM_SYSTEME,
           COPY_TRANSACTION.VOLUME
    FROM GESTACHE_OWNER.COPY_TRANSACTION COPY_TRANSACTION
    WHERE (COPY_TRANSACTION.DATE_TRANSACTION Between ? And ?)
          AND (COPY_TRANSACTION.PEIN_CREATION=?)
          AND (COPY_TRANSACTION.CODE_NT In (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
          AND  )I want that when ? is null, every data of my table will be selected.
    Anyone can help me ??

    Not pretty but you could try:
    SELECT CT.DATE_TRANSACTION,
           CT.CODE_NT,
           CT.NOM_GROUPE,
           CT.NOM_PROVENANCE,
           CT.NOM_SUJET,
           CT.NOM_ACTION,
           CT.NOM_SOURCE,
           CT.NOM_SYSTEME,
           CT.VOLUME
      FROM GESTACHE_OWNER.COPY_TRANSACTION CT
    WHERE (   (    ?1 is null
                and ?2 is null
                and ?n is null)
            or (    CT.DATE_TRANSACTION Between ?1 And ?2
                AND CT.PEIN_CREATION=?3
                AND CT.CODE_NT In (?4,?5,?6,?7,?8,...?n)
                AND  )How is this being called - a procedure, script, form? Depending on the use it might be beter to have 2 queries - one for NULL parameters, and one for the non-NULL parameters

  • Pagination do not have choice of returning all rows

    I have apex 3.0. When report is built, I normally give pagination scheme "Row Rnages 1-15 16-30 in select list (with pagination)", Number of Rows 15, Maxium Row count 2000. Problems are
    1. Can not have "all rows" as select list choice ? (OEM grid has that choice)
    2. Cna not change from 15 per page to other number
    Can some export help ?

    Even changing number of rows will not change it. But really the question is to mix pagination and no pagination into ONE select list. I have been asked several times from users and I am puzzled about this myself.
    Any expert there ?

  • Contains return all the records when the query string matches the columns

    I used the multi_column_datastore preference and created an index on three columns (item_name, description,owner_part_number). Now if I do a search:
    select * from items where contains(description, 'description') > 0;It returns all the rows in items table, but not all the rows have "description" as a word. I guess Oracle text assumes the query intends to get all the rows as the query string matches one of the column names. My question is whether Oracle Text has any preference settings to alter this behavior?
    execute ctx_ddl.create_preference('item_multi_preference', 'MULTI_COLUMN_DATASTORE');
    execute ctx_ddl.set_attribute('item_multi_preference', 'columns', 'item_name, description,owner_part_number');
    create index item_text_index on items(description) indextype is ctxsys.context filter by owner parameters('LEXER ENG_LEXER WORDLIST ENG_WORDLIST STOPLIST CTXSYS.EMPTY_STOPLIST datastore item_multi_preference MEMORY 1024M');Thanks.
    Jun Gao

    It looks like a basic_section_group fixes the problem as well, as demonstrated below and I believe a basic_section_group may be more efficient than auto_section_group.
    SCOTT@orcl_11gR2> -- recreation of problem:
    SCOTT@orcl_11gR2> drop table items
      2  /
    Table dropped.
    SCOTT@orcl_11gR2> create table items (
      2       "ITEM_NAME"             varchar2(100 byte),
      3        "ITEM_NUMBER"              varchar2(100 byte),
      4        "DESCRIPTION"              varchar2(4000 byte),
      5        "OWNER" number
      6  )
      7  /
    Table created.
    SCOTT@orcl_11gR2> begin
      2    FOR Lcntr IN 1..100
      3    loop
      4         insert into items (item_name, item_number, description, owner)
      5         values (dbms_random.string('A', 10),
      6              dbms_random.string('A', 10),
      7              dbms_random.string('L', 8) || ' '
      8              || dbms_random.string('A', 4)
      9              || dbms_random.string('A', 5)  || ' '
    10              || dbms_random.string('A', 10),
    11              dbms_random.value(1,10) );
    12    end loop;
    13  end;
    14  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> begin
      2    FOR Lcntr IN 1..100
      3    loop
      4         insert into items (item_name, item_number, description, owner)
      5         values (dbms_random.string('A', 10),
      6              dbms_random.string('A', 10),
      7              dbms_random.string('L', 8) || ' '
      8              || dbms_random.string('A', 4) || '111'
      9              || dbms_random.string('A', 5)  || ' '
    10              || dbms_random.string('A', 10), 1234 );
    11    end loop;
    12  end;
    13  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> exec ctx_ddl.drop_preference('ENG_WORDLIST');
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> begin
      2    ctx_ddl.create_preference('ENG_WORDLIST', 'BASIC_WORDLIST');
      3    ctx_ddl.set_attribute('ENG_WORDLIST','PREFIX_INDEX','TRUE');
      4    ctx_ddl.set_attribute('ENG_WORDLIST','PREFIX_MIN_LENGTH',1);
      5    ctx_ddl.set_attribute('ENG_WORDLIST','PREFIX_MAX_LENGTH',10);
      6    ctx_ddl.set_attribute('ENG_WORDLIST','SUBSTRING_INDEX','TRUE');
      7    ctx_ddl.set_attribute('ENG_WORDLIST','WILDCARD_MAXTERMS', 0);
      8  end;
      9  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> execute ctx_ddl.drop_preference('ENG_LEXER');
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> begin
      2    CTX_DDL.CREATE_PREFERENCE ('ENG_LEXER', 'BASIC_LEXER');
      3    CTX_DDL.SET_ATTRIBUTE ('ENG_LEXER', 'PRINTJOINS', '@-_');
      4  end;
      5  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> execute ctx_ddl.drop_preference('items_multi_preference');
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> begin
      2    ctx_ddl.create_preference('items_multi_preference', 'MULTI_COLUMN_DATASTORE');
      3    ctx_ddl.set_attribute('items_multi_preference', 'columns', 'item_name, description,item_number');
      4  end;
      5  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> create index items_text_index
      2  on items(description)
      3  indextype is ctxsys.context
      4  parameters
      5    ('LEXER         ENG_LEXER
      6        WORDLIST   ENG_WORDLIST
      7        STOPLIST   CTXSYS.EMPTY_STOPLIST
      8        datastore  items_multi_preference
      9        MEMORY     1024M')
    10  /
    Index created.
    SCOTT@orcl_11gR2> create index owner_idx on items (owner)
      2  /
    Index created.
    SCOTT@orcl_11gR2> exec dbms_stats.gather_table_stats (user, 'ITEMS')
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> select count(*)
      2  from   items
      3  where  contains (description, 'description') > 0
      4  /
      COUNT(*)
           200
    1 row selected.
    SCOTT@orcl_11gR2> -- correction of problem:
    SCOTT@orcl_11gR2> exec ctx_ddl.drop_section_group ('items_sec')
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> begin
      2    ctx_ddl.create_section_group ('items_sec', 'basic_section_group');
      3    ctx_ddl.add_field_section ('items_sec', 'item_name', 'item_name', true);
      4    ctx_ddl.add_field_section ('items_sec', 'description', 'description', true);
      5  end;
      6  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> drop index items_text_index
      2  /
    Index dropped.
    SCOTT@orcl_11gR2> create index items_text_index
      2  on items(description)
      3  indextype is ctxsys.context
      4  parameters
      5    ('LEXER         ENG_LEXER
      6        WORDLIST   ENG_WORDLIST
      7        STOPLIST   CTXSYS.EMPTY_STOPLIST
      8        datastore  items_multi_preference
      9        MEMORY     1024M
    10        section group items_sec')
    11  /
    Index created.
    SCOTT@orcl_11gR2> select count(*)
      2  from   items
      3  where  contains (description, 'description') > 0
      4  /
      COUNT(*)
             0
    1 row selected.

  • Column is summing up all the rows and displaying same value in all rows.

    Hi,
    Kindly see the below query. I have a problem in this query to fetch the abs_qty when the parameter P:item ie)msib.segment1 is not given as the input parameter. Its just summing up the entire quantity for all the items.When I pass P:item ie)msib.segment1 as input parameter, It fetches the exact value for abs_qty. Kindly help me to resolve this.
    Note only : Manufacturing plant ,Start date and End Date are Mandatory(required) parameters. Others like Item,Base Model and Planner code are optional.
    SELECT mmt.transaction_date date_produced, msib.segment1 item,
    cic.cost_type_id, msib.description item_description,
    mc.segment6 base_model, mc.segment7 trade_brand,
    mmt.subinventory_code subinventory,
    mil.segment1 || '.' || mil.segment2 || '.' || mil.segment3 LOCATOR,
    ood.organization_code
    || '-'
    || ood.organization_name manufacturing_plant,
    mmt.transaction_quantity quantity_produced,
    mtt.transaction_type_name transaction_type, msib.inventory_item_id,
    msib.organization_id, cic.material_cost COST,
    cic.material_overhead_cost freight, csc.standard_cost,
    *(select (NVL((SELECT SUM (mmt.transaction_quantity) total_NET_qty*
    FROM mtl_material_transactions mmt,
    mtl_system_items_b msib,
    mtl_transaction_types mtt,
    org_organization_definitions ood,
    mtl_txn_source_types mts
    WHERE mmt.organization_id = msib.organization_id
    AND msib.inventory_item_id = mmt.inventory_item_id
    AND mmt.transaction_type_id = mtt.transaction_type_id
    AND mmt.organization_id = ood.organization_id
    AND mtt.transaction_type_name = 'WIP Completion'
    AND mts.transaction_source_type_name = 'Job or Schedule'
    AND msib.segment1 = NVL (:p_item, msib.segment1)
    AND ood.organization_code = :p_manufacturing_plant
    AND TRUNC (mmt.transaction_date) BETWEEN :p_start_date
    AND :p_end_date ),0)
    *(NVL((SELECT SUM (mmt.transaction_quantity) total_NET_qty*
    FROM mtl_material_transactions mmt,
    mtl_system_items_b msib,
    mtl_transaction_types mtt,
    org_organization_definitions ood,
    mtl_txn_source_types mts
    WHERE mmt.organization_id = msib.organization_id
    AND msib.inventory_item_id = mmt.inventory_item_id
    AND mmt.transaction_type_id = mtt.transaction_type_id
    AND mmt.organization_id = ood.organization_id
    AND mtt.transaction_type_name = 'WIP Issue'
    AND mts.transaction_source_type_name = 'Job or Schedule'
    AND msib.segment1 = NVL (:p_item, msib.segment1)
    AND ood.organization_code = :p_manufacturing_plant
    AND TRUNC (mmt.transaction_date) BETWEEN :p_start_date
    AND :p_end_date
    *),0))) abs_qty from dual) AS ABS_qtyy,*(select (NVL((SELECT SUM (mmt.transaction_quantity) total_NET_qty
    FROM mtl_material_transactions mmt,
    mtl_system_items_b msib,
    mtl_transaction_types mtt,
    org_organization_definitions ood,
    mtl_txn_source_types mts
    WHERE mmt.organization_id = msib.organization_id
    AND msib.inventory_item_id = mmt.inventory_item_id
    AND mmt.transaction_type_id = mtt.transaction_type_id
    AND mmt.organization_id = ood.organization_id
    AND mtt.transaction_type_name = 'WIP Completion'
    AND mts.transaction_source_type_name = 'Job or Schedule'
    AND msib.segment1 = NVL (:p_item, msib.segment1)
    AND ood.organization_code = :p_manufacturing_plant
    AND TRUNC (mmt.transaction_date) BETWEEN :p_start_date
    AND :p_end_date ),0)
    (NVL((SELECT SUM (mmt.transaction_quantity) total_NET_qty
    FROM mtl_material_transactions mmt,
    mtl_system_items_b msib,
    mtl_transaction_types mtt,
    org_organization_definitions ood,
    mtl_txn_source_types mts
    WHERE mmt.organization_id = msib.organization_id
    AND msib.inventory_item_id = mmt.inventory_item_id
    AND mmt.transaction_type_id = mtt.transaction_type_id
    AND mmt.organization_id = ood.organization_id
    AND mtt.transaction_type_name = 'WIP Issue'
    AND mts.transaction_source_type_name = 'Job or Schedule'
    AND msib.segment1 = NVL (:p_item, msib.segment1)
    AND ood.organization_code = :p_manufacturing_plant
    AND TRUNC (mmt.transaction_date) BETWEEN :p_start_date
    AND :p_end_date
    ),0))) abs_qty from dual)*csc.standard_cost AS abs_val
    FROM mtl_material_transactions mmt,
    mtl_system_items_b msib,
    mtl_item_locations mil,
    mtl_transaction_types mtt,
    org_organization_definitions ood,
    mtl_txn_source_types mts,
    mtl_categories mc,
    mtl_item_categories mic,
    mtl_category_sets mcs,
    cst_item_costs cic,
    cst_standard_costs csc,
    cst_cost_types ct,
    mfg_lookups mlo
    WHERE mmt.organization_id = msib.organization_id
    AND msib.inventory_item_id = mmt.inventory_item_id
    AND mmt.locator_id = mil.inventory_location_id
    AND mil.organization_id = msib.organization_id
    AND mil.subinventory_code = mmt.subinventory_code
    AND mmt.transaction_type_id = mtt.transaction_type_id
    AND msib.organization_id = ood.organization_id
    AND mic.category_set_id = mcs.category_set_id
    AND mc.category_id = mic.category_id
    AND mc.structure_id = mcs.structure_id
    AND mic.inventory_item_id = msib.inventory_item_id
    AND mic.organization_id = msib.organization_id
    AND mcs.category_set_id = 52487965
    AND msib.inventory_item_id = cic.inventory_item_id
    AND msib.organization_id = cic.organization_id
    AND ct.cost_type_id = cic.cost_type_id
    AND cic.organization_id = ood.organization_id
    AND mil.inventory_location_id = mmt.locator_id
    AND mmt.transaction_source_type_id = mtt.transaction_source_type_id
    AND mmt.transaction_action_id = mtt.transaction_action_id
    AND mmt.transaction_source_type_id = mts.transaction_source_type_id
    AND mmt.transaction_action_id = mlo.lookup_code
    AND mmt.inventory_item_id = csc.inventory_item_id
    AND mmt.organization_id = csc.organization_id
    AND csc.last_update_date >=
    (SELECT MAX (csc1.last_update_date)
    FROM cst_standard_costs csc1
    WHERE csc1.inventory_item_id = mmt.inventory_item_id
    AND csc1.organization_id = mmt.organization_id)
    AND msib.segment1 = NVL (:p_item, msib.segment1)
    AND NVL (mc.segment6, 'X') = NVL (:p_base_model, NVL (mc.segment6, 'X'))
    AND NVL (msib.planner_code, 'Y') =
    NVL (:p_planner_code, NVL (msib.planner_code, 'Y'))
    AND UPPER (mlo.meaning) = 'ASSEMBLY COMPLETION'
    AND mtt.transaction_type_name = 'WIP Completion'
    AND ct.cost_type = 'Frozen'
    AND mts.transaction_source_type_name = 'Job or Schedule'
    AND ood.organization_code = :p_manufacturing_plant
    AND TRUNC (mmt.transaction_date) BETWEEN :p_start_date AND :p_end_date

    If <tt>abs_qty</tt> and consequently <tt>abs_val</tt> should not be the same for all rows returned, you'll have to rewrite your query so that the <tt>abs_qty</tt> won't be computed in isolation (separately) with no interaction with data from the main from table list.
    Your query is treated the same as the one below (note the changed table aliases by appending numbers to the originals of yours)
    SELECT mmt.transaction_date date_produced,
           msib.segment1 item,
           cic.cost_type_id,
           msib.description item_description,
           mc.segment6 base_model,
           mc.segment7 trade_brand,
           mmt.subinventory_code subinventory,
           mil.segment1 || '.' || mil.segment2 || '.' || mil.segment3 LOCATOR,
           ood.organization_code || '-' || ood.organization_name manufacturing_plant,
           mmt.transaction_quantity quantity_produced,
           mtt.transaction_type_name transaction_type,
           msib.inventory_item_id,
           msib.organization_id,
           cic.material_cost COST,
           cic.material_overhead_cost freight,
           csc.standard_cost,
           (select (NVL(
                        (SELECT SUM (mmt1.transaction_quantity) total_NET_qty
                           FROM mtl_material_transactions mmt1,
                                mtl_system_items_b msib1,
                                mtl_transaction_types mtt1,
                                org_organization_definitions ood1,
                                mtl_txn_source_types mts1
                          WHERE mmt1.organization_id = msib1.organization_id
                            AND msib1.inventory_item_id = mmt1.inventory_item_id
                            AND mmt1.transaction_type_id = mtt1.transaction_type_id
                            AND mmt1.organization_id = ood1.organization_id
                            AND mtt1.transaction_type_name = 'WIP Completion'
                            AND mts1.transaction_source_type_name = 'Job or Schedule'
                            AND msib1.segment1 = NVL (:p_item, msib1.segment1)
                            AND ood1.organization_code = :p_manufacturing_plant
                            AND TRUNC (mmt1.transaction_date) BETWEEN :p_start_date AND :p_end_date
                        ),0
                       ) - NVL(
                               (SELECT SUM (mmt2.transaction_quantity) total_NET_qty
                                  FROM mtl_material_transactions mmt2,
                                       mtl_system_items_b msib2,
                                       mtl_transaction_types mtt2,
                                       org_organization_definitions ood2,
                                       mtl_txn_source_types mts2
                                 WHERE mmt2.organization_id = msib2.organization_id
                                   AND msib2.inventory_item_id = mmt2.inventory_item_id
                                   AND mmt2.transaction_type_id = mtt2.transaction_type_id
                                   AND mmt2.organization_id = ood.2organization_id
                                   AND mtt2.transaction_type_name = 'WIP Issue'
                                   AND mts2.transaction_source_type_name = 'Job or Schedule'
                                   AND msib2.segment1 = NVL (:p_item, msib2.segment1)
                                   AND ood2.organization_code = :p_manufacturing_plant
                                   AND TRUNC (mmt.2transaction_date) BETWEEN :p_start_date AND :p_end_date
                               ),0
                   ) abs_qty
              from dual
           ) AS ABS_qtyy,
           (select (NVL(
                        (SELECT SUM (mmt3.transaction_quantity) total_NET_qty
                           FROM mtl_material_transactions mmt3,
                                mtl_system_items_b msib3,
                                mtl_transaction_types mtt3,
                                org_organization_definitions ood3,
                                mtl_txn_source_types mts3
                          WHERE mmt3.organization_id = msib3.organization_id
                            AND msib3.inventory_item_id = mmt3.inventory_item_id
                            AND mmt3.transaction_type_id = mtt3.transaction_type_id
                            AND mmt3.organization_id = ood3.organization_id
                            AND mtt3.transaction_type_name = 'WIP Completion'
                            AND mts3.transaction_source_type_name = 'Job or Schedule'
                            AND msib3.segment1 = NVL (:p_item, msib3.segment1)
                            AND ood3.organization_code = :p_manufacturing_plant
                            AND TRUNC (mmt3.transaction_date) BETWEEN :p_start_date AND :p_end_date
                        ),0
                       ) - NVL(
                               (SELECT SUM (mmt4.transaction_quantity) total_NET_qty
                                  FROM mtl_material_transactions mmt4,
                                       mtl_system_items_b msib4,
                                       mtl_transaction_types mtt4,
                                       org_organization_definitions ood4,
                                       mtl_txn_source_types mts4
                                 WHERE mmt4.organization_id = msib4.organization_id
                                   AND msib4.inventory_item_id = mmt4.inventory_item_id
                                   AND mmt4.transaction_type_id = mtt4.transaction_type_id
                                   AND mmt4.organization_id = ood4.organization_id
                                   AND mtt4.transaction_type_name = 'WIP Issue'
                                   AND mts4.transaction_source_type_name = 'Job or Schedule'
                                   AND msib4.segment1 = NVL (:p_item, msib4.segment1)
                                   AND ood4.organization_code = :p_manufacturing_plant
                                   AND TRUNC (mmt4.transaction_date) BETWEEN :p_start_date AND :p_end_date
                               ),0
                   ) abs_qty
              from dual
           ) * csc.standard_cost AS abs_val
      FROM mtl_material_transactions mmt,
           mtl_system_items_b msib,
           mtl_item_locations mil,
           mtl_transaction_types mtt,
           org_organization_definitions ood,
           mtl_txn_source_types mts,
           mtl_categories mc,
           mtl_item_categories mic,
           mtl_category_sets mcs,
           cst_item_costs cic,
           cst_standard_costs csc,
           cst_cost_types ct,
           mfg_lookups mlo
    WHERE mmt.organization_id = msib.organization_id
       AND msib.inventory_item_id = mmt.inventory_item_id
       AND mmt.locator_id = mil.inventory_location_id
       AND mil.organization_id = msib.organization_id
       AND mil.subinventory_code = mmt.subinventory_code
       AND mmt.transaction_type_id = mtt.transaction_type_id
       AND msib.organization_id = ood.organization_id
       AND mic.category_set_id = mcs.category_set_id
       AND mc.category_id = mic.category_id
       AND mc.structure_id = mcs.structure_id
       AND mic.inventory_item_id = msib.inventory_item_id
       AND mic.organization_id = msib.organization_id
       AND mcs.category_set_id = 52487965
       AND msib.inventory_item_id = cic.inventory_item_id
       AND msib.organization_id = cic.organization_id
       AND ct.cost_type_id = cic.cost_type_id
       AND cic.organization_id = ood.organization_id
       AND mil.inventory_location_id = mmt.locator_id
       AND mmt.transaction_source_type_id = mtt.transaction_source_type_id
       AND mmt.transaction_action_id = mtt.transaction_action_id
       AND mmt.transaction_source_type_id = mts.transaction_source_type_id
       AND mmt.transaction_action_id = mlo.lookup_code
       AND mmt.inventory_item_id = csc.inventory_item_id
       AND mmt.organization_id = csc.organization_id
       AND csc.last_update_date >= (SELECT MAX (csc1.last_update_date)
                                      FROM cst_standard_costs csc1
                                     WHERE csc1.inventory_item_id = mmt.inventory_item_id
                                       AND csc1.organization_id = mmt.organization_id
       AND msib.segment1 = NVL (:p_item, msib.segment1)
       AND NVL (mc.segment6, 'X') = NVL (:p_base_model, NVL (mc.segment6, 'X'))
       AND NVL (msib.planner_code, 'Y') = NVL (:p_planner_code, NVL (msib.planner_code, 'Y'))
       AND UPPER (mlo.meaning) = 'ASSEMBLY COMPLETION'
       AND mtt.transaction_type_name = 'WIP Completion'
       AND ct.cost_type = 'Frozen'
       AND mts.transaction_source_type_name = 'Job or Schedule'
       AND ood.organization_code = :p_manufacturing_plant
       AND TRUNC (mmt.transaction_date) BETWEEN :p_start_date AND :p_end_dateRegards
    Etbin

  • 'select count(*) from x' returns 5460 rows and 'Select * from x' returns 0 rows

    As you can see in the next lines something is wrong in my Oracle (8.0.6 on Win NT 4.0 sp 6a) :
    Oracle8 Enterprise Edition Release 8.0.6.0.0 - Production
    With the Partitioning option
    PL/SQL Release 8.0.6.0.0 - Production
    SQLWKS> SELECT * FROM V_TERRA_TE;
    PERIOD_DATE PERIOD_TIME TERRARCV TERRASND TERCV TESND
    0 rows selected.
    SQLWKS> SELECT COUNT(*) FROM V_TERRA_TE;
    COUNT(*)
    5460
    1 row selected.
    V_TERRA_TE is a complex join of 5 Tables :
    CREATE OR REPLACE VIEW "ACTUATE".V_TERRA_TE AS Select to_date(to_char(p1.period_date,'YYYYMMDD'),'YYYYMMDD') "PERIOD_DATE",
    to_date(to_char(p1.period_time,'HH24:MI'),'HH24:MI') "PERIOD_TIME",
    to_number(p1.caudalrcv + ((p3.caudalrcv + p4.caudalrcv)*(confterrate.conexadslterra/confterrate.conexadsltotal))) "TERRARCV",
    to_number(p1.caudalsnd + ((p3.caudalsnd + p4.caudalsnd)*(confterrate.conexadslterra/confterrate.conexadsltotal))) "TERRASND",
    to_number((p2.caudalrcv * confterrate.pctinfonegocio) + ((p3.caudalrcv + p4.caudalrcv)*(confterrate.conexadslte/confterrate.conexadsltotal)))"TERCV",
    to_number((p2.caudalsnd * confterrate.pctinfonegocio) + ((p3.caudalsnd + p4.caudalsnd)*(confterrate.conexadslte/confterrate.conexadsltotal)))"TESND"
    from p1,p2,p3,p4,confterrate
    where (p1.period_date=p2.period_date)and
    (p1.period_date=p3.period_date)and
    (p1.period_date=p4.period_date)and
    (p1.period_time=p3.period_time)and
    (p1.period_time=p4.period_time)and
    (p1.period_time=p2.period_time)and
    to_char(p1.period_date,'MMYYYY')=to_char(confterrate.period_datetime,'MMYYYY');
    I think that some not reported error happens in the select * with some temporary space or similar but only the message '0 rows selected' is displayed (instead the real error)
    Could somebody help me ?
    Thanks in advance
    Francisco

    Forcing the Join/sort to be made on Disk (not on memory) the problem not happens. This demostrate that ORACLE has a VERY IMPORTANT BUG : It returns 0 rows wich is false.
    To force it to work on disk i use this parameters :
    alter session set sort_area_size=0
    alter session set hash_join_enabled=false
    Note : probably is not the best combination or use of parameters, but using it the query works as espected.

  • How can I filter a Sharepoint 2007 libarry list based on current user login?

    Hi all.
    I would like to know how I can filter a SharePoint library list based on current user login.
    Suppose I have created the followings:
    1) A SharePoint form library containing bunch of uploaded InfoPath form data.
    2) The InfoPath form template contains a promoted text field called "TargetUser" to store user domain login (ex: DOMAIN\JOE) and every InfoPath form file in the library has a valid domain name stored in the "TargetUser" field.
    I have created a custom view for the form library and would like to filter this view so only items whose "TargetUser" field matches current user's login ID are displayed.
    I went to Edit View page to customize the view and tried to use the [Me] function but I got a "Filter value is not a valid text string" message instead when clicking OK. Apparently [Me] returns a Person/Group data type and the filter cannot compare its value
    to that of "TargetUser".
    I tried using text functions (ex: TEXT([Me],"") hoping to extract default string value from [Me]. The filter accepts the parameter without any error but the resulting fitlered list does not display any items at all.
    I have googled this subject for hours but I have not found any solution.
    It would be greatly appreciated if anyone can help me to create a functional filtered list.
    FYI, my SharePoint 2007 installation is just WSS 3.0 + Form Server. I do not have MOSS 2007 (so no MOSS 2007 web parts or web services).
    Thank you.
    Jason

    Here's what I usually do in order to accomplish this.  Ultimately you'll need to have 2 different fields.  There's the one you already have, with DOMAIN\username stored in it.  Then you'll need an additional field as a "person" column type. 
    Call it "TargetPerson" or something.
    Create a sharepoint designer workflow that runs each time an item is created or changed.  One action:
    Set FIELD to VALUE.
    The first FIELD is "TargetPerson", the VALUE is your "TargetUser" field. 
    Once this is done, then the person value is stored in the person field.  This is the field that you can filter by "TargetPerson" is equal to [Me]
    Laura Rogers, MCSE, MCTS
    SharePoint911: SharePoint Consulting
    Blog: http://www.sharepoint911.com/blogs/laura
    Twitter: WonderLaura

  • GetRatingAverageOnUrl function of socialdataservice.asmx return an error if current user haven't rated that item

    I have an issue while reading rating data from a SharePoint list using
    socialdataservice.asmx. In particular I am trying to get average rating from a remote site using GetRatingAverageOnUrl() method. The issue is, while trying to use this method it return average rating for a particular list item only if current
    user have previously rated that particular item  else it shows an “object reference not set to instance of an object” error.
    While digging in deeper I found that this is actually the case with almost all the rating related functions of
    socialdataservice web service (viz. CountRatingsOnUrl, GetRatingsOnUrl, GetRatingAverageOnUrl etc.)
    Girish Kumar p Meena
    SharePoint Developer || Blog

    Having similar issues. Ever find out what is going on with GetRatingAverageOnUrl?

Maybe you are looking for

  • Goods Receipt PO Quantity Deviation with PO

    Hi all Is it possible to prevent user to post Goods Receipt PO with greater qty than PO Qty for the item with an option to choose YES or NO? Kedalene

  • How do I install windows desk top

    I am unable to receive my emails on my Yahoo account, and it keeps asking me to right click on windows desk top where do I find windows desk top ?

  • Thawte SSL cert

    We're interested in getting an SSL certificate with Thawte for our Snow Leopard Server. The default self signed certificate generated during setup seems to only have the Common Name and Country fields so when you generate a CSR, you aren't able to se

  • Javax.ejb Error

    Hi all, I am m using this code in my portal application:import javax.ejb.CreateException; trying to  connect to a DataSource, but my NWDS keeps showing the red mark near the code: Javax.ejb cannot be resolved. I added j2ee.jar to my config and to cla

  • Why already purchsed songs / albums are not  grayed out but are available to purchase again?

    Songs and albums that I have already purchased appear available to buy again. Even If I try to buy them (again) I get not notification that I have already purchased it before. I have reset all relative warnings in itunes account. Shouldn't they be gr