SQL query to get the items for which transactions have not been saved

Hi people,

Have a small doubt I want to compile a SQL query in the inventory where I get these items for what transactions do not have been recorded during a period of at least one specified number of days.

The days might be 30 days or 2 months depends on. If I want to get those items for which no transactions were reported for lets say 30 days. Could someone give me an idea of how to go about this thing? I use r12. I came up with the following query, but it gives a lot of records. The commented parts of this query is only commented on


SELECT DISTINCT msi.segment1,

MSI. Description,

MSI.primary_uom_code,

MSI.inventory_item_id

MSI mtl_system_items_b / *,.

mtl_material_transactions mmt * /.

WHERE / * msi.inventory_item_id = mmt.inventory_item_id

AND msi.organization_id = mmt.organization_id

AND NVL ((SELECT SUM (transaction_quantity)

OF mtl_onhand_quantities

WHERE inventory_item_id = msi.inventory_item_id),

0) = 0

AND TRUNC (mmt.transaction_date) < = SYSDATE - & D

AND * / NOT EXISTS (SELECT *)

OF mtl_material_transactions mmt

WHERE msi.inventory_item_id = mmt.inventory_item_id

AND msi.organization_id = mmt.organization_id

AND TRUNC (mmt.transaction_date) < SYSDATE - & D);

Hi fatimakhellil

Try the following code and mark it as correct if your problem be resolved.

SELECT DISTINCT msi.segment1,

MSI. Description,

MSI.primary_uom_code,

MSI.inventory_item_id,

MSI.organization_id,

Ms.secondary_inventory_name,

(select max (transaction_date) in the mtl_material_transactions where msi.inventory_item_id = inventory_item_id

AND msi.organization_id = organization_id) last_transaction_date

OF mtl_system_items_b msi.

Ms. mtl_secondary_inventories

WHERE ms.organization_id (+) = msi.organization_id

AND msi.source_subinventory = ms.secondary_inventory_name (+)

AND NOT EXISTS (SELECT *)

OF mtl_material_transactions mmt

WHERE msi.inventory_item_id = mmt.inventory_item_id

AND msi.organization_id = mmt.organization_id

AND mmt.subinventory_code = ms.secondary_inventory_name

AND mmt.organization_id = ms.organization_id

AND TRUNC (mmt.transaction_date) BETWEEN TRUNC (SYSDATE - & d) AND TRUNC (SYSDATE))

Tags: Oracle Applications

Similar Questions

  • the settings have not been saved for the iphone because it was not found

    the settings have not been saved for my iPhone 5 because it was not found

    Nappys wrote:

    the settings have not been saved for my iPhone 5 because it was not found

    OK thank you very much for sharing your question vague.

  • This failure has occurred: {0}. your changes have not been saved. Click OK to return to the list page.

    Nothing has changed on the device as so far, I am aware, but lately when I click on group under Default Device Admin map, I get this error and I can't make changes:

    This failure has occurred: {0}. your changes have not been saved. Click OK to return to the list page.

    Version of the ACS:

    Cisco ACS VERSION INFORMATION

    -----------------------------

    Version: 5.8.0.32

    The identifier for the internal version: B.442

    This error does not appear to be related to

    CSCud78248    Failure of system ACS 5.4 administrative access control

    as I have no identity configured for the RADIUS server. I use this unit for RADIUS authentication. Any help is very appreciated!

    What browser and version are you using?

    If it of firefox and automatically has ugraded to the latest version of FF 46; There is a patch being released today and which will focus on similar issues seen when using the FF 46 version

    Will be 5.8 patch3. a rollup that includes all the fixes in previous patches (1 and 2) posted release ACS 5.8

  • IOM sql Query to get the status of the failed task

    Hello world

    We have an obligation as we need to get the status of a particular task (say Create User in OID - Completed\Rejected status resource) for the particular user. We are able to get the status of the provisioed of resources to the user but not the status of the special mission which is trigerred for the user.can someone put some light on it. We must have the SQL query to do this.

    Thanks in advance.

    Kind regards
    MKN

    Hello
    Use this query to get the status of the task, also check the cooments

    SELECT USR. USR_LOGIN, OSI. SCH_KEY, ANN. SCH_STATUS, STA. STA_BUCKET OF
    OSI, CHS, STA, MIL, TOS, PKG, OUEDRAOGO, USR, OBJ, OST
    WHERE OSI.MIL_KEY = MIL.MIL_KEY
    AND ANN. SCH_KEY = OSI. SCH_KEY
    AND STA. STA_STATUS = SCH. SCH_STATUS
    AND TOS. PKG_KEY = PKG. PKG_KEY
    AND MIL. TOS_KEY = TOS. TOS_KEY
    AND OUÉDRAOGO. USR_KEY = USR. USR_KEY
    AND OUÉDRAOGO. OST_KEY = OST. OST_KEY
    AND OST. OBJ_KEY = OBJ. OBJ_KEY
    AND OSI. ORC_KEY = OUEDRAOGO. ORC_KEY
    AND OBJ. OBJ_NAME = "User AD".
    AND OST. OST_STATUS = "Provisioning" - filter accordinglly
    AND STA. STA_BUCKET = 'pending' - filter accordinglly
    AND PKG. PKG_NAME = "AD User" - filter accordinglly
    AND MIL.MIL_NAME = 'System' - filter accordinglly Validation
    ;
    Thank you
    Kuldeep

  • SQL query to get the NULL records after the last matching flag

    I have a xx1 table with id and flag columns. So I want the data in this table, after the last flag matched. I want that data to id 7 in the rooms. Even if the id 2,3,5 are null flag 'Y' was at 6. ID so I need a query to get the data of the xx1 table after the last correspondence flag (from 7 to 9 id).

    SQL > create table xx1

    2 (identification number,

    3 flag varchar2 (10));

    Table created.

    SQL > insert into xx1 values (1, 'Y');

    1 line of creation.

    SQL > insert into values xx1 (2, null);

    1 line of creation.

    SQL > insert into values xx1 (3, null);

    1 line of creation.

    SQL > insert into xx1 values (4, 'Y');

    1 line of creation.

    SQL > insert into values xx1 (5, null);

    1 line of creation.

    SQL > insert into xx1 values (6, 'Y');

    1 line of creation.

    SQL > insert into values xx1 (7, null);

    1 line of creation.

    SQL > insert into values xx1 (8, null);

    1 line of creation.

    SQL > insert into values xx1 (9, null);

    1 line of creation.

    SQL > select * from xx1.

    FLAG OF THE ID

    ---------- ----------

    1. IS

    2

    3

    4. IS

    5

    6. IS

    7

    8

    9

    9 selected lines.

    SQL >

    Hello

    user11164339 wrote:

    Hi Frank - when I run the query, I don't see the results data.

    I get

    FLAG OF THE ID

    ----- ----------

    7

    8

    9

    What you do differently?

  • SQL query to get the numbers from 0 to 99

    How can we write a sql query to get values from 0 to 99... This should not come from any table
    SELECT LEVEL - 1
      FROM  DUAL
      CONNECT BY LEVEL <= 100
    /
    

    SY.

  • I get e-mails bounce, which I have not sent. These emails contain a message and a link. Could I have a virus?

    I get emails returned, which I have not sent. These emails contain a message and a link. Could I have a virus?

    I use OS Yosemite 10.10.5. Thanking you in advance for your time.

    Not on this basis. It's probably that a person's mail and which actually look like it came from your address. This can be done without having access to your e-mail account.

    If they were sent to the people you know, a person can have in your information, and you should change your passwords.

    (144189)

  • How do I know which elements have not been used

    Hello

    I'm a noob, but get the hand of it. Here's my question: I started with about 20 video files (2 h of images). All the files, I created about 60 "subitems" carefully conducted in a bin. Then I doubled all the 60 clips one by one. However, I accidentally deleted one of these clips in the middle (and cannot cancel because it was some time ago) and I don't know which clip is has.

    What I want to do is to select the tray with the subitems to 60 and identify the one that (perhaps more than one actually) have NOT been inserted in my sequence. Is it possible to do? Similar to Excel when you select a formula and it indicates what cells was in charge, could I select my sequence and it tells me that the clips are 'in charge '? Any other suggestions?

    Thank you

    There is a "Use of video" column in the project window.  This should show you that it isn't currently in your sequence as well.

  • can I retrieve a text message that has been deleted and have not been saved by I the cloud?

    my phone is a phone 9.1.2.

    My husband also has an i phone and it plugged my iphone into his laptop computer to recharge. an update has started and delete a message that i really recover. where not saved messages and I can't get it back. I contacted my transported mobile and they are unable to help him.

    ecros03 wrote:

    my phone is a phone 9.1.2.

    My husband also has an i phone and it plugged my iphone into his laptop computer to recharge. an update has started and delete a message that i really recover. where not saved messages and I can't get it back. I contacted my transported mobile and they are unable to help him.

    No there is no way to recover data, if it has not been saved.

  • Need for SQL query to get the result.

    Region

    MonthTrx typeSummary of the resolution
    AMERICAS-13 mayAdjustmentsFix
    EMEA-13 mayAdjustmentsIncorrect
    AMERICAS-13 mayCredit memoIncorrect
    EMEA-13 mayInvoiceFix
    AMERICAS-13 mayCredit memoFix
    OFD-13 mayAdjustmentsFix
    AMERICAS-13 mayInvoiceIncorrect
    DVL-13 mayAdjustmentsFix
    DVL-13 mayAdjustmentsFix
    OFD-13 mayAdjustmentsFix

    Above my Table and here is the result required. Similarly for other regions as well. Can someone help me with the SQL query?

    RegionSummary of the resolutionSettingCredit memoInvoiceTotal general
    AMERICASFix112
    Incorrect0112

    Like this?

    SQL > select * from transaction_audit;

    MTH TRX_TYPE REGION BOARD
    -------- ------ ----------- ---------
    AMERICAS-13 may SETTINGS CORRECT
    EMEA-13 may INCORRECT ADJUSTMENT
    AMERICAS-13 may CREDIT MEMO INCORRECT
    EMEA-13 may INVOICE CORRECT
    AMERICAS-13 may CREDIT MEMO CORRECT
    OFD-13 may SETTINGS CORRECT
    AMERICAS-13 may INVOICE INCORRECTE
    LAD-13 may SETTINGS CORRECT
    LAD-13 may SETTINGS CORRECT
    OFD-13 may SETTINGS CORRECT

    10 selected lines.

    SQL > select region
    2, resolution_summary
    3, count (decode (trx_type, "ADJUSTMENTS", trx_type)) adjustments
    4, County (decode (trx_type, 'HAVING', trx_type)) credit_memo
    5, County (decode (trx_type, "BILL", trx_type)) Bill
    transaction_audit 6
    Group 7
    8 by region
    9, resolution_summary
    10 Decree
    11 by region
    12, resolution_summary
    13.

    REGION TAKE ADJUSTMENTS CREDIT_MEMO INVOICE
    -------- --------- ----------- ----------- ----------
    CORRECT THE AMERICAS 1 1 0
    0 1 1 INCORRECT AMERICAS
    EMEA CORRECT 0 0 1
    INCORRECT EMEA 1 0 0
    DAL ADDRESS 2 0 0
    OFD CORRECT 2 0 0

    6 selected lines.

    SQL >

  • SQL query to get the first four characters of an address

    Hi gurus,


    Can you please help me with the below quries on how to achieve this. Could be really helpful if you could provide a sample sql on your side.


    Req:

    I have a requriement where I should display the first four characters other than a space to address, for example: becomes R, DISH etc. F. in passing in a ROOM address a DISH 1 FLORIAN AVENUE would therefore "RAF1", while a CORNER, 23 STREET address would be "23CO".


    Words such as c/o, co, rear should be ignored, if any.

    Thanks in advance.


    Kind regards

    Peoples

    Hi John,.

    Here is an implementation of a pl/sql function that suggested a franc. It uses two lists, one with the words which are replaced with the first character and a second with words to ignore.

    create or replace function first_four (p_input in varchar2) return varchar2 is

    type t_words is table of the varchar2 (100);

    p_replace t_words: = t_words ('ROOM', 'FIELD', 'FLAT', 'FLT', 'BLOCK', 'UNIT', 'STUDIOS', 'CARAVAN', 'APARTMENT');

    p_ignore t_words: = t_words ("C/o ', 'CO', 'BACK TO'");

    v_input varchar2 (100);

    Start

    -Put the entry in a local-variable he

    v_input: = upper (p_input);

    -delete the words contained in the ignore list

    because me in 1.p_ignore.count

    loop

    v_input: = replace (v_input, p_ignore (i));

    end loop;

    -Replace the words by first character in the replacement list

    for r in 1.p_replace.count

    loop

    v_input: = replace (v_input, p_replace (r), substr (p_replace (r), 1, 1));

    end loop;

    -remove the spaces and return only the first 4 characters

    Return substr (replace (v_input, ' '), 1, 4);

    end;

    /

    It returns the expected results for the four examples you gave:

    SQL > with t as)

    2 select address 'FLAT 3 a 12 LILLYHAM ROAD' of all the double union

    3 select ' GREE LANE GLOSONTH 45' across Union double

    4 Select "FLAT 3 221 b Baker Street," of all the double union

    5. Select "C/o CARAVAN 32 STREET BLOK 6 RICHMOOND' of the double)

    6. Select ff first_four (address) of t;

    FF

    --------------------------------------------------------------------------------

    F3A1

    45GR

    F322

    C32B

  • SQL query to get the number of days monthwise

    Hello
    I'm new to sql, can someone please tell me query to find the number of days between the two dates months wise.
    say
    FIRSTDATE last date
    21/03/2011-25/06/2011

    March April May June
    9 22 23 18

    Hello

    Welcome to the forum!

    Here's one way:

    WITH     all_dates     AS
    (
         SELECT     start_date + LEVEL - 1     AS a_date
         FROM     (
                   SELECT     TO_DATE ('21/03/2011', 'DD/MM/YYYY')     AS start_date
                   ,     TO_DATE ('25/06/2011', 'DD/MM/YYYY')     AS end_date
                   FROM     dual
              )
         CONNECT BY     LEVEL     <= end_date + 1 - start_date
    )
    SELECT       TO_CHAR ( TRUNC (a_date, 'MONTH')
                , 'fmMonth YYYY'
                )               AS month
    ,       COUNT (*)               AS num_days
    FROM       all_dates
    WHERE       a_date - TRUNC (a_date, 'IW')     < 5
    GROUP BY  TRUNC (a_date, 'MONTH')
    ORDER BY  TRUNC (a_date, 'MONTH')
    ;
    

    What is a 'working day '? I guess you mean every day except Saturday or Sunday, but the query aboveare sometimes figures less than you have asked:

    MONTH             NUM_DAYS
    --------------- ----------
    March 2011               9
    April 2011              21
    May 2011                22
    June 2011               18
    

    Are a few days working on Saturday or Sunday? How do you get the 22 working days in April 2011 and 23 in may?

    SQL is good at obtaining results with a variable number of rows, but you have to say exactly the desired number of columns when you write the query.
    If you really need the output of the way you said, with any number of columns, then watch in swing or a grouping of the chain . See the FAQ forum
    https://forums.Oracle.com/forums/Ann.jspa?annID=1535
    "4. How can I convert rows to columns.

  • SQL query to get the range of Date values

    Hello

    The database is Oracle11i.

    I'm looking for a way to generate a list of the dates of a fixed date in the past (could be hardcoded) at the time of the day (sysdate).

    In other words, if the fixed date is June 19, 2011, and assuming today ' today is June 24, 2011 the SQL must be able to generate the

    Next: -.

    June 19, 2011
    June 20, 2011
    June 21, 2011
    June 22, 2011
    June 23, 2011
    June 24, 2011

    And the constraint is that I can not make any change to the database in question. I can only shoot a (SELECT) SQL query. NO.

    use time dimension type of approach (time dimension is not available here) and no procedure, etc. from PL/SQL. Is it possible?

    Thank you

    Jaimeen Shah wrote:
    Hello

    The database is Oracle11i.

    I'm looking for a way to generate a list of the dates of a fixed date in the past (could be hardcoded) at the time of the day (sysdate).

    In other words, if the fixed date is June 19, 2011, and assuming today ' today is June 24, 2011 the SQL must be able to generate the

    Next: -.

    June 19, 2011
    June 20, 2011
    June 21, 2011
    June 22, 2011
    June 23, 2011
    June 24, 2011

    And the constraint is that I can not make any change to the database in question. I can only shoot a (SELECT) SQL query. NO.

    use time dimension type of approach (time dimension is not available here) and no procedure, etc. from PL/SQL. Is it possible?

    Thank you

    SQL> def date_start = '13/11/2010'
    SQL> def date_end   = '22/11/2010'
    SQL> with
      2    data as (
      3      select to_date('&date_start', 'DD/MM/YYYY') date1,
      4             to_date('&date_end',   'DD/MM/YYYY') date2
      5      from dual
      6    )
      7  select to_char(date1+level-1, 'DD/MM/YYYY') the_date
      8  from data
      9  connect by level <= date2-date1+1
     10  /
    THE_DATE
    ----------
    13/11/2010
    14/11/2010
    15/11/2010
    16/11/2010
    17/11/2010
    18/11/2010
    19/11/2010
    20/11/2010
    21/11/2010
    22/11/2010
    
  • SQL query to get the given result

    Hi friends

    My data in the table are given below

    user transaction_date transaction_type
    1 1st August 2011
    August 2, 2011 1 c
    1 3 August 2011
    1 b 3 August 2011
    1 August 4, 2011 a
    1 b 4 August 2011
    2 3 August 2011
    2 b 3 August 2011
    August 4, 2011 2 c
    2 b 4 August 2011
    2 August 5, 2011 a
    2 b August 5, 2011
    2 August 7, 2011 a
    2 b 7 August 2011

    I want the count for each user as, how many times he made a transaction type transaction immediately after 'b' type?

    As the output of above data should be

    number of users
    1 2
    2 3

    Thanks in advance :)

    Maybe (NOT TESTED).

    select "user",
           count(criteria) "count"
      from (select "user",
                   transaction_date,
                   transaction_type,
                   case when transaction_type = 'b'
                         and lag(transaction_type,1) over (partition by "user",transaction_date
                                                               order by transaction_date,transaction_type) = 'a'
                        then 1
                   end criteria
              from the_table
           )
     group by "user"
     order by "user"
    

    Concerning

    Etbin

  • I also, I get the error "the service user profile Service has no connection, failed to load the user profile" but I have not been able to correct the problem by following the listed solutions.

    I got the error "the service user profile Service has no connection, failed to load the user profile" when you try to use my desktip.  It is on the login page.  My account icon loads and the guest account. I have enter my password as an administrator and get the error message listed above. I followed all the solutions I could find and it is not corrected.

    I have a slight hitch, after several failed here, I checked the domestic Group on my laptop and I have high listed as connected to the Group Home Office; with all the files.  How can I fix the desk top to coinside with his status of being online.  Yet once, my counter top will not recognize the password, but the desk top shows online in the home group.

    Home Group is Windows 7.

    Here is the Vista Forums.

    What operating system do you use?

    Vista info below:

    ·                        Restore point:

    Try typing F8 at startup and in the list of Boot selections, select Mode safe using ARROW top to go there > and then press ENTER.

    Try a restore of the system once, to choose a Restore Point prior to your problem...

    Click Start > programs > Accessories > system tools > system restore > choose another time > next > etc.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    If the above does not work:

    ·                        http://www.Vistax64.com/tutorials/130095-user-profile-service-failed-logon-user-profile-cannot-loaded.html

    See if the information in the above tutorial will help you.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    http://windowshelp.Microsoft.com/Windows/en-AU/help/769495bf-035C-4764-A538-c9b05c22001e1033.mspx

    Difficulty of a corrupted user profile

    After creating the profile, you can copy the files from the existing profile. You must have at least three user accounts on the computer to perform these operations, including the new account that you created.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    http://support.Microsoft.com/kb/947242

    A temporary profile is loaded after you connect to a Windows Vista-based system

    See you soon.

    Mick Murphy - Microsoft partner

Maybe you are looking for

  • My sent box is sold despite the purge of most messages.

    I get the following error message when I select the reply to messages, (which must be deposited in my "sent" folder): the sent folder is full and cannot hold messages more. To make room for more messages, delete any old or unwanted mail and compact t

  • function key is stuck on

    the button on my acer computer fn when it changes some letter keys number keys and now the fn (function) key is locked on so I can't use my keyboard to type im write with the onsreen keyboard my os is vsta top House, I already tried rebootingthe pc,

  • Signer of code RIMAPPSA2 unnecessarily required by the signing tool

    When I try to connect with the signature tool, it mentions RIMAPPSA2 as a required signatory. This thread http://supportforums.BlackBerry.com/Rim/Board/message?message.UID=20321 looks like RIMAPPSA2 is required for non-public API signing. The code th

  • Error Msg When trying to play video

    Hello, here I am trying to view a video online and every time that I try to open it I get this error msg... Cannot open this helper for mms://stream.assembly.ab.ca/archive/2013-05-09-1. I have win 7 with media player 12, AVG security. At work I can p

  • I bought 2 creative cloud but I can't use it on 4 computers

    I bought 2 accounts creative cloud in order to to use on 2 desktops (various cities) and on my lap top.But whenever I try to log on the third computer it does not accept the password and pushes me to disconnect from my one of my workstations.Asn afte