How to find an element with correspondents?

Gurus,

Please clarify this for me


I have two tables... We're item_master, second is dtls_stg, which are related to an element of the current column.

In my table of dtls_stg, except the column elements it is another column, called pre_pack_seq, which holds the numbers like 1,2,3... There may be two or more items with so many pre_pack_seq for example

Element pre-pack-seq
1001 1
1-1002
2 1003
1004 3
1005 2
1 1006
1007 3


my table of item_master:

point item_parent item_grandparent tran_level
1001 100 xxx 2
1002 100 3 xxx
1006 100 xxx 2

Now I need to find a parent or grand-parent of the current element in the dtls_stg table, which is present in the master of the order of the day.

That is to say for all the pre-pack-seq, which has the value of 1, I select these items and must check into the master of the order of the day if these items belong to the same item_parent or item_grandparent according to the tran_level of the point. (if tran_level = search the 2 item_parent and so tran_level = search the item_grandparent 3)
If the 1001, 1002, 1006 (who have pre-pack-seq 1) belong to the same parent or grandparent according to tran_level (IE item_parent or item_grandparent of the item_master table should have same value) then it should continue with the next pre_pack_seq (duty to check for 2 and so on)...
Let's assume that for a single item (s), the parent or grandparent is not corresponding, I show the item (from table dtls_stg). This should be done in the SQL and PL/SQL

You can help plse

Concerning

Published by: user10369751 on September 28, 2008 12:53 AM

Use:

select  item,
        item_parent,
        pre_pack_seq
  from  (
         select  d.*,
                 m.item_parent,
                 count(distinct case tran_level when 2 then item_parent else item_grandparent end) over(partition by pre_pack_seq) cnt
           from  dtls_stg d,
                 item_master m
           where m.item = d.item
        )
  where cnt > 1
/

SY.

Tags: Database

Similar Questions

  • How to find an element ID (primary key)

    Hello

    How to find the ID of an element when you have the item already?

    For example, in my table of data, I have two columns - one for the primary key (ID), and the other matches the element.

    I can find an element with the given ID but not vice versa.

    Is there a way to find the ID of the item?

    Thank you. : D

    Okay, it's very basic and probably does not work in the real world for the reasons I have explained above, but for your example, you can use the following query:

    SELECT THE ID
    FROM someTable
    WHERE itemName = "hat".

    That would give you the ID, but it can return multiple rows of data if there are several elements called "hat" in the table.

    Who help me?

  • How to add an element with a namespace prefix.

    I have a very simple problem, but I think I go about it the wrong way.

    I have the following variable of XMLTYPE in pl/sql:

    <A xmlns="namespace" xmlns:def="myns_namespace">
         <B/>
    </A>
    

    In a separate step, I would like to add the following after B: element

    <C attr="attribute" def:defattr="def_attribute"/>
    

    To produce the following XML:

    <A xmlns="namespace" xmlns:def="myns_namespace">
         <B/>
         <C attr="attribute" def:defattr="def_attribute"/>
    </A>
    

    What is the best way to do it?  I tried the following:

    1. the following statement fails because when you create the item C, oracle complains "prefix 'def' is not declared."  It's logical.

    SELECT
    insertChildXML(
         eltA,
         '/A/B',
         'C',
         xmlElement("C", xmlAttributes('attribute' "attr", 'def:defattr' "def_attribute")),
         'xmlns="namespace" xmlns:def="myns_namespace"'
    )
    INTO ...
    

    2. I also tried to create C element with namespace attributes before adding to the element and then removing the namespace declaration attributes using deleteXML.  This does not apparently the function can remove attributes, but it cannot remove namespace declarations. I try to avoid ending up with this:

    <A xmlns="namespace" xmlns:def="myns_namespace">
         <B/>
         <C xmlns="namespace" xmlns:def="myns_namespace" attr="attribute" def:defattr="def_attribute"/>
    </A>
    

    I was hoping to find a function that could be one of the following:

    1 create fragments of the element, ignoring prefixes to namespace and does not throw an error.

    2 remove the specific namespace declarations, or any statement redundant namespace.

    3. Add a child element otherwise wherein the child element would not need to be created and validated independently before being added to the parent.

    4 maybe I treat everything the wrong way and need to rethink my strategy on this xml creation?

    You will have to do it in two steps in order to avoid the redeclaration of namespace at the level of the child:

    SQL > SELECT xmlserialize (document

    (2 insertchildxml)

    (3 appendChildXML)

    4 xmltype ("")

    5             , '/A'

    6, xmlelement ("C", xmlattributes ('attribute' is "attr"))

    7, 'xmlns = "namespace" '

    8             )

    9           , '/A/C'

    10, ' @def: attribute '

    11, "def_attribute".

    "12, ' xmlns ="namespace"xmlns:def ="myns_namespace""

    13           )

    14 indent

    15         )

    16 DOUBLE;

    XMLSERIALIZE (DOCUMENTINSERTCHI

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

  • How to find a list with all the shortcuts in EBS R12

    How everything,.
    Someone knows how to find all the shortcuts for R12 as CTRL + F11, F11, F4... etc?




    Thanks in advance,
    Bahchevanov.

    Someone knows how to find all the shortcuts for R12 as CTRL + F11, F11, F4... etc?

    You can search all of this (help > keyboard help).

    Thank you
    Hussein

  • How to find the program with high Internet usage

    Original title: I get a message that, due to a long term, my internet use program is too high. How can I find out what that this prog. is?

    With the help of paid AVG security.

    Vista

    Do not download movies or anything high usage.

    message appears everytime I go to the line. Have deleted the progs as much as poss

    Hello

    1 did you do changes on the computer before the show?

    2. What is the exact error message that you receive?

    3 you have installed any program of Internet service provider to track the use of the Internet?

    Clean boot

    See the following site:

    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7

    http://support.microsoft.com/kb/929135.

    Note: once you work with the boot, use step 7 in the link to set the computer back to start normally.

    If in case, you are connected via a wireless connection, click the start & Services one in time and to ensure wireless see corresponding section is checked (enabled).

     

     

  • SocialCast API: How to find private messages with subjects in their

    Hello!

    I use the api / conversations to send a private message with a new hashtag (for example #myNewTag) in it.

    But I can't manage to find this message later by using the following method: api/messages/search with q = #myNewTag,.

    I can't find the new subject itself with api/themes/research or api / themes...

    This new section is not visible in the view is exploration of the web application.

    How to create a private message with a new tag in there? (is that enough to insert #... in his body?)

    Thank you in advance for your help!

    guimcha

    Hi Guimcha - Hashtags, or topics are not supported in private Messages, because they are conversations private and not visible to the rest of the community. Topics can only be used in regular messages (groups, projects, challenges). You can tell when a topic/hashtag is validated successfully because it will turn into a hyperlink and create it's own page of topics.

    I hope this helps!

    -Samantha

  • How to download Photoshop Elements with Adobe Download Assistant?

    It was pretty simple, you would launch ADA and it would show all the programs available for download.

    Now it just shows "products you might like", which show any items (at least not that I can find).

    So, how do Photoshop Elements? I looking in the wrong place?

    If you have tried another web browser and are still facing problems please try to launch a direct download of the software by following the steps listed in http://prodesigntools.com/photoshop-elements-11-direct-download-links-pse-premiere-pre.htm l.  Please note that you must complete section very important before you click the link to download the software.

  • How to find a file with the author of 'unknown '. Its an antivirs software and I cannot locate the uninstall/remove. I already have 'Norton' and I don't want to "Avira" HOW THEN I DISCOVERED "WINDOWS the PROGRAMS of START-UP BLOCKED."

    Can I locate? It is in the "(chose fenêtres bloquées les programmes de démarrage) that lights up when I start my computer." but I disabled it and I know what to do, but how can I veiw the program 'windows blocked startup programs' if it does not start?

    answered in another thread

    http://social.answers.Microsoft.com/forums/en-us/vistafiles/thread/e425669e-93f8-457d-852b-4416bba88f3d
    Rob - bicycle - Mark Twain said it is good.

  • How to find end rowa with 1 digital duplicates in a table

    Hello world

    I have a customer requirement to get the records in a table that are end with the digital 1.

    Few of the user accounts, added with a '1' at the end of their normal user IDs. Everything by making some process in-house, the system has created a new account with the '1' appended to the end.

    So I need a query to correctly identify these users.

    Here is the sample records:

    PK1 userid name lastname email

    1 AAA Jack smith j.smith@a

    2 AAA1 Jack smith j.smith@a

    3 BBB Scott S s.scott@a

    4 BBB1 Scott S s.scott@a

    Note: name and email id and name are the same

    Of the above, I need to get the records of AAA1 and BBB1.

    My output should be like below

    AAA1 2 Jack

    4 Scott BBB1

    Please help me on this.

    Thanks in advance.

    Hello

    One way to do that is to add a condition EXISTS to the above:

    SELECT pk1, userid, name

    From your_table m

    WHERE SUBSTR (userid,-1) = "1" - or userid WHERE AS '%1 '.

    AND THERE ARE)

    SELECT 1

    From your_table

    WHERE userid | '1' = m.userid

    AND name = $m.name

    AND lastname = m.lastname

    AND email = m.email

    )

    ;

  • find the percent with grep sign

    Hello. I know it must be simple, but I can't seem to find it: how to find the percent with grep sign? Or % or -% nor [%] seem to do.

    Thank you

    There is nothing in particular the % sign: you should be able to find it by using one of the three methods you have tried. Have a good overview of the control panel search/replace. Don't find it what domain contain only the %? No space lurking here? It is on a locked layer? You have a style of paragraph or character set in the Panel "Find format '?

    Peter

  • How to find and view the results in flash

    Hello friends,

    I work in Flash 8 and using AS 2.0 coding.

    I work with failover-page application. Here I have an option 'search '. I'll tell you the scenario.

    Here I am loading images/pages dynamically through xml. He loading and works as a page flipping. so far, it has been done. Now if you enter some text inside the search option and press, he must search all loaded images/pages and view pages resulted.

    How this feature is indeed. How to find the jpg with a given string?

    Your help will be really appreciated.

    Kind regards

    Rajesh

    You must have a database of information related to the pages.  If the pages are only jpeg images, then they will not be able to provide you with anything in the way of useful data searchable beyond possibly titles image.  So, you will need to create a database that contains all of the information in these pages that you can have your (matching chain) diagram of function search works with to find matching information.

  • How to find the number of data items in a file written with the ArryToFile function?

    I wrote a table of number in 2 groups of columns in a file using LabWindows/CVI ArrayToFile... Now, if I want to read the file with the FileToArray function so how do I know the number of items in the file. during the time of writing, I know how many elements array to write. But assume that I want the file to be read at a later time, then how to find the number of items in the file, so that I can read the exact number and present it. Thank you all

    Hello

    I start with the second question:

    bytes_read = ReadLine (file_handle, line_buffer, maximum_bytes);

    the second argument is the buffer to store the characters read, so it's an array of characters; It must be large enough to hold maximum_bytes the value NULL, if char [maximum_butes + 1]

    So, obviously the number of lines in your text tiles can be determined in a loop:

    Open the file

    lines = 0;

    While (ReadLine () > 0)

    {

    lines ++;

    }

    Close the file

  • How I find myself with two passwords to iCloud for the same account?

    How I find myself with two passwords to iCloud for the same account?

    For security reasons, I only use iCloud for Contacts and "find my iPhone".

    Several months ago Apple forced me to change my password to iCloud.  So I did this.   In the last months, I used successfully the new password to 10 or 12 times when asked without problem.

    However, I received a notification of a software update for my Apple Watch. I did the update without problem. However, after completing the update my iPhone asked me to connect to my iCloud account. When I did this, she rejected my password. I made 4 attempts typing very slowly and with care for you sure I did it right.

    Then, operating under a hunch, I decided to enter my old password to iCloud. It worked?  I'm confused about this, any ideas would be appreciated.

    I had a similar problem last year. I had to call Apple. Contact is a bottom of this page.

  • How can I copy a location of a photo and paste it in another? iPhoto can do this, but I can't find a way with Photos.

    How can I copy a location of a photo and paste it in another? iPhoto can do this, but I can't find a way with Photos.

    Accessible location via Get Info (command-I) information.

  • How can we do a single element with the content of two clips

    How can we do a single element with the content of two clips

    You try to get a picture of image? In other words, that contained two visible clips at the same time? If you are, change the substantive item to you main plot and another tie on top using an edit connect to the battery. Select the top item. Activate the transform tool and resize and reposition the clamp if necessary.

    Russ

Maybe you are looking for

  • Controller ActiveX does not at all appear

    XP SP3 are installed, Microsoft Update will not start due to no ActiceX controller appears. I have checked all security options, activation/deactivatin Blocker for popups, turned off the firewall. updated IE7 to IE8 and the only difference that was f

  • Photosmart 6510: Photosmart 6510

    I recently bought a new laptop and I would like to install my printer Photosmart 6510, but can't find the software anywhere CD. Is someone can you please tell me where I can download the software/driver for it. Thank you

  • remove the old widows

    If I have the latest version of windows PE is safe to remove older versions of my computer?

  • Sony VAIO drivers and utilities are not compatible with Windows 8.1.

    OT: Sony laptop Vaio question. Hello. I was using Genuine Windows 7 Home Premium in my Sony VAIO laptop. Recently, I bought PRO 8.1 Windows and installed. Now, most of my drivers and utilities VAIO is not compatible! Support for Sony is saying, direc

  • Signature tuning

    Can anyone help on how I can resolve signature 2000 and 2004 to allow my PC monitoring to send ICMP to target IP addresses. Whenever I have activate these signatures my monitor screen turns red. Fast pls help.