skip to main | skip to sidebar

SQL Tutorial with Examples

Pages

  • Home
 
  • RSS
  • Facebook
  • Twitter
Tuesday, October 23, 2012

Serial Number Related Query

Posted by Raju Gupta at 11:41 AM – 0 comments
 
This query will let us know the corresponding Sales Order number associated with a given serial number installed in Installed Base.

-- get sales order associated with serial number
SELECT msn.serial_number,
  ool.line_id,
          ooh.order_number,
         ool.inventory_item_id
FROM     mtl_serial_numbers      msn,
          oe_order_lines_all      ool,
          oe_order_headers_all    ooh,
          mtl_system_items        msi,
          wip_discrete_jobs       wdj,
          wip_entities            we
WHERE    msn.serial_number = '&Serial_Number'
AND       ool.header_id = ooh.header_id
AND       wdj.source_line_id = ool.line_id
AND       we.wip_entity_id = wdj.wip_entity_id
AND       wdj.wip_entity_id = msn.original_wip_entity_id
AND       msi.inventory_item_id = msn.inventory_item_id
AND       msi.organization_id = ool.ship_from_org_id
AND       msn.current_status = 4
UNION
SELECT   wdd.serial_number,
          ool.line_id,
          ooh.order_number,
          ool.inventory_item_id
FROM     wsh_delivery_details    wdd,
          oe_order_lines_all      ool,
          oe_order_headers_all    ooh
WHERE    wdd.serial_number = '&Serial_Number'
AND       ool.header_id = ooh.header_id
AND       wdd.source_line_id = ool.line_id
AND       wdd.serial_number IS NOT NULL


Email This BlogThis! Share to X Share to Facebook

Leave a Reply

Newer Post Older Post
Subscribe to: Post Comments (Atom)
  • Popular
  • Recent
  • Archives

Popular Posts

  • Comparing data (rows)in two tables in PL/SQL
    Pl/sql code have Cursors that will fetch table and columns that you want to compare and it will Iterate through all tables in the local d...
  • Multi User session Kill in Oracle
    To kill the inactive users login in Oracle from any schema in a database.If any unwanted transactions were kept withput roll back it will...
  • Oracle PL/SQL Query for Pagination
    Oracle PL/SQL function makes the input query statement such a way that the query out put returns for a start row index to end row index. ...
  • Oracle Sql Queries to view dependencies and partitioning.
    This is the list of queries to find out the dependencies between databse objects and to find out the partitioning details of a table. 1...
  • TABLE FINDER
    Table_Finder is a procedure to find all the tables that are queried in a particular package or procedure. It takes Package name or procedur...
  • SQL tips
    Re-usable SQL Queries useful in day-to-day scenario. COMMON QUERIES *************** SELECT instance_name FROM v$instance; ...
  • Deletion Records of Duplicate
    Describes how to use SQL query of remove duplicate records from tables DELETE FROM T_CONTACTS A WHERE A.ROWID > (SELECT MIN (ROWID) ...
  • Serial Number Related Query
    This query will let us know the corresponding Sales Order number associated with a given serial number installed in Installed Base. -...
  • Advance SQL
    The query that uses partition OVER PARTITION BY analytic function The below example shows the cumulative salary within a departement ...
  • Query to search Special character in word
    The query looks for any special characters in column field (specially useful for password field) and reports it.   SELECT DISTINCT emp...
Powered by Blogger.

Archives

  • ▼  2012 (11)
    • ▼  October (11)
      • Comparing data (rows)in two tables in PL/SQL
      • Serial Number Related Query
      • SQL tips
      • Advance SQL
      • Query to search Special character in word
      • Multi User session Kill in Oracle
      • TABLE FINDER
      • Oracle PL/SQL Query for Pagination
      • Oracle and SQL Server Database Search String proce...
      • Deletion Records of Duplicate
      • Oracle Sql Queries to view dependencies and partit...
 

Labels

  • Delete Query (1)
  • Oracle SQL Query (4)
  • PL/SQL Example (2)
  • Stored Procedure Example (3)
  • String Search Query (1)
  • System Query (1)

Followers

 
 
© 2011 SQL Tutorial with Examples | Designs by Web2feel & Fab Themes

Bloggerized by DheTemplate.com - Main Blogger