Need sql query to find out same item is used in open po and closed po

Hi Experts,
I have an requirement is that, i need to find out the item is used in open po and closed po.
  example: A is the item is used in closed PO and Open PO.
  i need to write down the scripts how many same items is used in open po and closed po.
if any sql script is there please share.
Please let us know if any concerns.
Thanks
bmn

Hi
Please try below query
select
distinct c.segment1
from
po_lines_all a,
po_line_locations_all b,
mtl_system_items_b c
where
a.po_line_id= b.po_line_id
and a.item_id=c.inventory_item_id
and b.closed_code='OPEN'
and a.item_id in ( select 
item_id
from
po_lines_all d,
po_line_locations_all e,
mtl_system_items_b f
where
d.po_line_id= e.po_line_id
and d.item_id=f.inventory_item_id
and e.closed_code in ('CLOSED','FINALLY CLOSED','CLOSED FOR INVOICE','CLOSED FOR RECEIVING'));

Similar Messages

  • Need sql query to find out Joins attached with folders in Discoverer

    Hi,
    Can anyone let me know the sql query which can be used to identify the joins which are attached to the folders.
    Actually we have to identify all the joins conditions from folders those are migrated from one instance to others.
    Thanks
    abhishek

    I recommend that you implement the admin EUL supplied by oracle, you can get there a lot of repository information (metalink note: 556932.1).
    Try to use this (maybe you will need some pkg's):
    SELECT
    DECODE(KEYS.FK_MANDATORY,
    1,
    'Always exist in master folder',
    'Might not exist in master folder') "Detail Item values",
    EUL10G_US.EUL5_GET_JOIN(EXP.EXP_ID, 'N') "Join Master --> Detail",
    KEYS.KEY_DESCRIPTION JOIN_DESCRIPTION,
    KEYS.KEY_DEVELOPER_KEY JOIN_IDENTIFIER,
    KEYS.KEY_NAME JOIN_NAME,
    DECODE(SUBSTR(KEYS.KEY_NAME, 1, 19),
    'AUTO_GENERATED_NAME',
    'Yes',
    'No') "AutoGen",
    DECODE(DECODE(SUBSTR(KEYS.KEY_NAME, 1, 19),
    'AUTO_GENERATED_NAME',
    'Yes',
    'No') ,
    'Yes',
    EUL10G_US.EUL5_GET_JOIN(EXP.EXP_ID),
    KEYS.KEY_NAME) "Actual Join Name",
    KEYS.KEY_UPDATED_DATE JOIN_LAST_UPDATE,
    DECODE(KEYS.FK_ONE_TO_ONE, 1, 'One to one join', NULL) "One to One join",
    DECODE(KEYS.FK_MSTR_NO_DETAIL,
    1,
    'Outer join on detail' || CHR(10),
    NULL) "Outer Join on Detail",
    DECODE(KEYS.FK_DTL_NO_MASTER,
    1,
    'Outer join on master' || CHR(10),
    NULL) "Outer Join on Master",
    DECODE(KEYS.FK_MSTR_NO_DETAIL,
    1,
    'Outer join on detail' || CHR(10),
    NULL) || DECODE(KEYS.FK_DTL_NO_MASTER,
    1,
    'Outer join on master' || CHR(10),
    NULL) ||
    DECODE(KEYS.FK_ONE_TO_ONE, 1, 'One to one join', NULL) "Optional Join Configurations",
    OBJ.OBJ_NAME "MASTER_FOLDER",
    OBJ_DETAIL.OBJ_NAME "DETAIL_FOLDER"
    FROM EUL10G_US.EUL5_OBJS OBJ,
    EUL10G_US.EUL5_EXPRESSIONS EXP,
    EUL10G_US.EUL5_KEY_CONS KEYS,
    EUL10G_US.EUL5_OBJS OBJ_DETAIL
    WHERE ((KEYS.KEY_ID = EXP.JP_KEY_ID) AND
    (OBJ.OBJ_ID = KEYS.FK_OBJ_ID_REMOTE) AND
    (OBJ_DETAIL.OBJ_ID = keys.KEY_OBJ_ID));

  • Need sql query to find out Joins attached with folders

    Hi,
    Can anyone let me know the sql query which can be used to identify the joins which are attached to the folders.
    We dont want to see those from front end(disc admin).
    Thanks
    abhishek

    abhishek - This is the Application Express forum. I have no idea what you are asking but it may need to be directed to a different forum.
    Scott

  • SQL Query to Find out User has what all resources provisioned !

    Hi Guys ,
    Does any one have a SQL query to find out what resources are provisioned to a particular user ?
    Thanks
    Suren

    Hi,
    Hope this will help you.
    SELECT distinct usr_login as "IdM User ID",
    usr_employeeID as "Employee ID",
    usr.USR_FIRST_NAME as "First Name",
    usr.USR_LAST_NAME as "Last Name",
    usr_status
    as "User Status",
    USR_EMP_TYPE as "Employee Type",
    obj.obj_name as "Application Resource",
    ost_status as "Application Resource Status",
    FROM ost,oiu,obj,usr,obi
    WHERE oiu.ost_key = ost.ost_key AND obj.obj_key = obi.obj_key AND oiu.usr_key = usr.usr_key
    AND ost_status in ('Provisioned','Revoked','Disabled', 'Provisioning')
    AND oiu.obi_key=obi.obi_key
    AND usr_EmployeeID like '11111'
    This query will provide all the resources to which the user is linked with and the resource status is in 'Provisioned','Revoked','Disabled', 'Provisioning' status for a particular employeed ID, I am not completely sure whether I have given the Employee ID column from USR table as correct or not. Verify once and query the DB

  • SQL query to find out last login for each database

    Hi everybody,
    I have a view with following columns:
    DatabaseSid, lastLogin, firstLogin.
    I want to now the newest last_login date for every database.
    SID First Login Last Login
    e.g. Database1, 11.11.2011, 01.12.2011
    Database1, 01.04.2012, 01.05.2012
    Database3, 03.03.2004, 03.06.2005
    Database 3 07.09.2012, 12.10.2012
    How can I do a query to find out for eacht DB (DB1, DB2 and so on) the Last_Login Date?
    Thank you in advance
    Steve

    Steve wrote:
    Hi everybody,
    I have a view with following columns:
    DatabaseSid, lastLogin, firstLogin.
    I want to now the newest last_login date for every database.
    SID First Login Last Login
    e.g. Database1, 11.11.2011, 01.12.2011
    Database1, 01.04.2012, 01.05.2012
    Database3, 03.03.2004, 03.06.2005
    Database 3 07.09.2012, 12.10.2012
    How can I do a query to find out for eacht DB (DB1, DB2 and so on) the Last_Login Date?
    Thank you in advance
    SteveI'm curious as to how you collect this information from multiple databases into one database, and of what value the data is once you have it.

  • Need sql query to find ten records in sequential manner

    Plz help me
    I need to have ten records on my page. at the bottom of the page, i want to dispaly the number of pages that have records , just as a google page shows at the bottom. if the moves user moves to the next page , the next ten records must be displayed. suppose the user selects and clicks 5th page then the records on that page are displayed.How can i write the sql query corresponding to this specificationi don't want all records to be fetched at the same time and put on the server, rather whenever the page is opened , the corresponding records are fetched and displayed

    Hi
    Maybe you should use a CachedRowSet.
    Look this:
    http://developer.java.sun.com/developer/technicalArticles/javaserverpages/cachedrowset/
    This page has a example that will help you.

  • Sql query to find out the space issues in not able to allocate next extent

    hi,
    i have oracel 11g on linux.
    my datafiles are autoextend off. i am looking for query to make sure the segments does not stop growing by reaching the maximum segment allocated or no free contigous space available in allocating new extent,.
    i need to know periodically the owner,object_name and object type (table or index) which are suffocating for space.
    any ad-hoc sql query exists?
    thanks in advance.

    Connect as sysdba and try..
    To list all objects >100M in size.
    SQL> select owner, segment_type, segment_name, sum(bytes)/(1024*1021) from dba_segments
    group by owner, segment_type, segment_name
    having sum(bytes)/(1024*1021) > 100
    For tablespaces ..
    select tablespace_name, sum(bytes) tablespace_size
    from dba_data_files
    group by tablespace_name
    union all
    select tablespace_name, sum(bytes) tablespace_size
    from dba_temp_files
    group by tablespace_name
    order by tablespace_name

  • Query to find out which workflow(s) use a particular message ? wf_messages

    Hi guys
    Hoping someone can help.
    I've a list of particular notfication messages, which are stored in the WF_MESSAGES_TL and WF_MESSAGES table, and I need to find out which workflows use them.
    Can anyone tell me what table I can query to find this out ?
    There's no referential integrity which I can use to find this out, and google has turned up nothing so far.
    Any ideas ?
    Thanks a lot
    Scott

    You can use this and tweak it around:
    select p.process_item_type, p.process_name, p.activity_name, a.message
    from wf_process_activities p, wf_activities a
    where p.process_item_type=a.item_type and
    p.activity_name=a.name and
    a.end_date is null;-- means the active/current activity
    Regards,
    Alejandro

  • Please let me know a good query to find out the memory being used in DB

    Hi All,
    We are using Automotic memory management by using parameter memory_target option. I want to find out the total memory being used and which is free.
    ie;(SGA+PGA). Please let me know.
    Thanks & Regards,
    Vikas Krishna

    Since we are using memry_target we will not get an accurate value there I guess.
    SQL> show parameter memory
    NAME TYPE VALUE
    hi_shared_memory_address integer 0
    memory_max_target big integer 12G
    memory_target big integer 12G
    shared_memory_address integer 0
    SQL> select round(used.bytes /1024/1024 ,2) used_mb
    2 , round(free.bytes /1024/1024 ,2) free_mb
    3 , round(tot.bytes /1024/1024 ,2) total_mb
    4 from (select sum(bytes) bytes
    5 from v$sgastat
    6 where name != 'free memory') used
    7 , (select sum(bytes) bytes
    8 from v$sgastat
    9 where name = 'free memory') free
    10 , (select sum(bytes) bytes
    11 from v$sgastat) tot;
    USED_MB FREE_MB TOTAL_MB
    1660.92 378.71 2039.62
    Thanks & Regards,
    Vikas Krishna

  • Sql query to find out last update of 6 hours

    i have table emp . for Exp.
    create table emp
    (empno number(5),
    ename varchar2(20),
    last_update date );
    Now i want the all data which is update in last 6 hours

    Assuming an INDEX, WHERE Last_Update > SysDate - 6/24; is better and clearer.
    It is better because it allows INDEX use. That is because it does not manipulate the COLUMN value.
    It is clearer because it clearly states what we want, the records where Last_Update is after a value of six hours before. In the other query, we are checking for records where Last_Updated minus six hours is after current time. Personally, I find that harder to follow.
    SQL> CREATE TABLE Emp(EmpNo NUMBER(5), EName VARCHAR(20), Last_Update DATE);
    Table created.
    SQL> CREATE INDEX Emp_Last_Update ON Emp(Last_Update);
    Index created.
    SQL> INSERT INTO Emp(Empno, EName, Last_Update) SELECT 626, 'user626892', SysDate - Level FROM Dual CONNECT BY Level <= 10000;
    10000 rows created.
    SQL> exec DBMS_STATS.Gather_Schema_Stats(NULL);
    PL/SQL procedure successfully completed.
    SQL> EXPLAIN PLAN FOR SELECT * FROM Emp WHERE SysDate - Last_Update <= 6/24;
    Explained.
    SQL> SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);
    PLAN_TABLE_OUTPUT
    Plan hash value: 3956160932
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |      |   500 | 11500 |    15  (14)| 00:00:01 |
    |*  1 |  TABLE ACCESS FULL| EMP  |   500 | 11500 |    15  (14)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - filter(SYSDATE@!-"LAST_UPDATE"<=.25)
    13 rows selected.
    SQL> EXPLAIN PLAN FOR SELECT * FROM Emp WHERE Last_Update > SysDate - 6/24;
    Explained.
    SQL> SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);
    PLAN_TABLE_OUTPUT
    Plan hash value: 38459689
    | Id  | Operation                   | Name            | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |                 |     1 |    23 |     3   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| EMP             |     1 |    23 |     3   (0)| 00:00:01 |
    |*  2 |   INDEX RANGE SCAN          | EMP_LAST_UPDATE |     1 |       |     2   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("LAST_UPDATE">SYSDATE@!-.25)
    14 rows selected.

  • Sql Query To Find Out list of users not having a particular resource provisioned

    Hi,
    I know the query for all the resources tagged to user with their account status.
    Can anybody help me with a query to fetch just the user details for the following scenario:
    1)Active users having  having no instance of a particular resource.
    Condition: Exclude Active users having one provisioned instance of the resource and fetch user details having no provisioned account for that resource .
    it is just for report purposes.So format is not of concern.Just need the list of users not having a single provisioned account for a particular resource.

    Hi,
    Please try the below query :
    select distinct usr.usr_login from USR,OIU where USR.USR_KEY not in (select OIU.USR_KEY from OIU)
    and OIU.APP_INSTANCE_KEY= (select APP_INSTANCE_KEY from APP_INSTANCE where APP_INSTANCE_NAME='ADResource');
    Change the app instance name acording to you need.
    -Saurabh

  • SQL Query to find out similar names in two tables

    Hi,
    I want to write a query which will return the records by matching the two table with the similar name.
    that is I have two tables table1 and table2, and in table1 the column1 is having data like
    ABC INC
    The international Company
    and in the table2 has the column1 which has the data like
    ABC Corp
    The Financials Corporation
    So as per the requirement now my select query should return 1 row as ABC INC and ABC Corp are similer.
    and both the tables have around 50,000 reords so I cannot just take the first word by using substring and tryto match both, this will work only for names like ABC INC and ABC Corp but it will not return the names like
    "Instruments International Company" and "International Instruments Company"
    Please can any one help me?
    Regards,
    Chanda

    I don't have access to text here so I can't check.Almost. Better to use OR than AND:
    SQL> CREATE TABLE t (ID INTEGER, text VARCHAR2(2000))
      2  /
    Table created.
    SQL> INSERT INTO t
      2       VALUES (1, 'The international Company')
      3  /
    1 row created.
    SQL> INSERT INTO t
      2       VALUES (2, 'ABC INC')
      3  /
    1 row created.
    SQL> CREATE INDEX t_txt_idx ON t
      2  (text)
      3  INDEXTYPE IS ctxsys.CONTEXT
      4  /
    Index created.
    SQL> SELECT *
      2    FROM t
      3   WHERE contains (text,
      4                   REPLACE ('International Instruments Company', ' ', ' & ')
      5                  ) > 0
      6  /
    no rows selected
    SQL> SELECT *
      2    FROM t
      3   WHERE contains (text,
      4                   REPLACE ('International Instruments Company', ' ', ' | ')
      5                  ) > 0
      6  /
    ID TEXT
      1 The international Company
    BUT than also :(
    SQL> SELECT *
      2    FROM t
      3   WHERE contains (text,
      4                   REPLACE ('Company Instruments', ' ', ' | ')
      5                  ) > 0
      6  /
    ID TEXT
      1 The international Company

  • Sql query to find out when was the skillgroup created

    Doees anyone know the field which points to the date time when a skillgorup created?I have refered to the schema document-but most dbtime usually points to The current date and time stamp when the records are written to the DBDATETIME’,’ Date and time the agent logged into the skill group,etc.

    Looking at the first time a call was offered against the skill group, or looking at the time stamp of the first ICM script to reference the SG sound like the best options... but still leave a lot of room for error. They basically give you a "created no later than" date. If your ICM is set to automatically keep only a certain number of script versions, you lose history of skill group creation date after a few new script version saves. Call data has a retention period depending on your setup as well.
    One more date you can look at is the earliest schedule on the Call Type. This will have the longest-held dates, but of course this won't give you anything for call types which you only reference within scripts, and will miss data for any schedules you've previously removed from Call Types. (I typically only schedule Call Types that are assigned to DNs, and use Go To Script nodes for script-to-script movement instead of Requalify Call for ease of viewing call flows)
    Why do you need to see when Call Types were created?
    -Jameson

  • Query to find out the list of user who have delete access

    Hi,
    I need a query to find out the list of users who have delete access on perticular folder/universe/ reports  in infoview.
    Please advice.
    Regards,
    Neo.

    orton607 wrote:
    thanks for replying guys. But the thing is i am using dynamic sql execute immediate in my package, so i want those tables also and the schema name.
    thanks,
    ortonThis is not possible. The best you could do is to have a good guess.
    Or how would you parse some dynamic statement as this:
       v_suffix := 'loyees';
       v_sql := 'Select count(*) from (select ''nonsense'' col1 from emp'||v_suffix||') where col1 = ''Y'''';
       execute_immediate(v_sql);
    ...What is the table name? How do you want to parse that?
    Better rewrite all dynamic SQL statements into non dynamic ones. Or do the source control logic for those dynamic parts in an extra module. For example implement your own dependency table and force every developer to add there all dynamic parts.

  • Query to find out the Activities done against a table

    Hi,
    One table has been truncated and data reloaded into the table by the user. But at latter stage user deny that activity. I believe all these activities stored in any oracle 10g database table.
    Need a query to find out the activities done on a specific date say 6th Sep.
    This is too urgent. Thanks in advance

    Hi,
    Welcome to the forum!
    If you don't have enable table auditing maybe you can see last_ddl_time column of user_objects view:
    Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
    Connected as hr
    SQL> select * from test2;
          COL1       COL2       COL3
             1          1          3
             1          2          3
             1          3          3
    SQL> select to_char(uo.created, 'DD/MM/YYYY HH24:MI:SS'), to_char(uo.last_ddl_time, 'DD/MM/YYYY HH24:MI:SS') from user_objects uo where uo.object_name = 'TEST2';
    TO_CHAR(UO.CREATED,'DD/MM/YYYY TO_CHAR(UO.LAST_DDL_TIME,'DD/M
    12/09/2009 12:20:26            12/09/2009 12:20:27
    SQL> truncate table test2;
    Table truncated
    SQL> select to_char(uo.created, 'DD/MM/YYYY HH24:MI:SS'), to_char(uo.last_ddl_time, 'DD/MM/YYYY HH24:MI:SS') from user_objects uo where uo.object_name = 'TEST2';
    TO_CHAR(UO.CREATED,'DD/MM/YYYY TO_CHAR(UO.LAST_DDL_TIME,'DD/M
    12/09/2009 12:20:26            12/09/2009 14:01:21
    SQL> Regards,

Maybe you are looking for