I need to pivot the 6 newest open jobs into 6 different columns for a item.

I need to take a table WIP_JOBS with columns ID,ITEM,JOB,STATUS,CREATE_DATE and populate 6 newest jobs for an ITEM into 6 different fields in a procudure
example
CREATE OR REPLACE PROCEDURE APPS.JOB6(Errbuf OUT VARCHAR2, Retcode OUT VARCHAR2,
ITEM IN VARCHAR,
JOB1 OUT NUMBER,
JOB2 OUT NUMBER,
JOB3 OUT NUMBER,
JOB4 OUT NUMBER,
JOB5 OUT NUMBER,
JOB6 OUT NUMBER)
fyi, this is my first Thread, sorry if I did not provide enough info.

Hi,
user13173058 wrote:
I my have miss lead my question by using the word pivot. I'm not aggragating values but listing the newest 6 jobsTaking data from 6 different rows and displaying it on one row is aggregating.
fyi, this is my first Thread, sorry if I did not provide enough info.Whenever you have a problem, you should post a little sample data (CREATE TABLE and INSERT statements), and the results you want from that data. Explain how you get those results from that data.
Simplify the problem if you can. For example, instead of posting enough data to get the last 6 jobs, how about just the last 3? You can explain that you really need 6, if you think it will matter.
If you can pose a question using commonly available tables, such as those in the scott schema, then you don't have to post any sample data, just the results and the explanation.
For example, say you're using the scott.emp table, which contains this data:
SELECT       deptno
,       hiredate
,       ename
FROM       scott.emp
ORDER BY  deptno
,            hiredate
    DEPTNO HIREDATE  ENAME
        10 09-JUN-81 CLARK
        10 17-NOV-81 KING
        10 23-JAN-82 MILLER
        20 17-DEC-80 SMITH
        20 02-APR-81 JONES
        20 03-DEC-81 FORD
        20 19-APR-87 SCOTT
        20 23-MAY-87 ADAMS
        30 20-FEB-81 ALLEN
        30 22-FEB-81 WARD
        30 01-MAY-81 BLAKE
        30 08-SEP-81 TURNER
        30 28-SEP-81 MARTIN
        30 03-DEC-81 JAMESand you want to pivot this data so that it shows the names of the 3 most recentently hired employees in each department, like this:
`   DEPTNO MOST_RECEN SECOND     THIRD
        10 MILLER     KING       CLARK
        20 ADAMS      SCOTT      FORD
        30 JAMES      MARTIN     TURNER'JAMES' was the last person hired in department 30, 'MARTIN' was the last person hired in deptno=30 before that, and 'TURNER' was the last before that, so on the row for deptno=30 we want 'JAMES', 'MARTIN' and 'TURNER', in that order, and all the others in deptno=30 can be ignored.
Here's one way to get those resuilts:
WITH         got_r_num     AS
     SELECT       deptno
     ,       ename
     ,       ROW_NUMBER () OVER ( PARTITION BY  deptno
                                  ORDER BY          hiredate     DESC
                         )           AS r_num
     FROM       scott.emp
SELECT       deptno
,       MIN (CASE WHEN r_num = 1 THEN ename END)     AS most_recent
,       MIN (CASE WHEN r_num = 2 THEN ename END)     AS second
,       MIN (CASE WHEN r_num = 3 THEN ename END)     AS third
FROM       got_r_num
GROUP BY  deptno
;Whenever you have a question, say which version of Oracle you're using.
The query above will work in Oracle 9 (and up), but starting in Oracle 11 it's better to use the SELECT ... PIVOT feature.

Similar Messages

  • Aperture keeps crashing. "Check with developer to make sure aperture works with version of mac os x you might need to reinstall the application ..be sure to install any updated for aplication and mac os x"

    "Check with developer to make sure aperture works with version of mac os x you might need to reinstall the application ..be sure to install any updated for aplication and mac os x"
    I updated aperture and os x. Latest versions. I also reinstalled aperture. Still getting the same.  please help

    Process:    
    Aperture [448]
    Path:       
    /Applications/Aperture.app/Contents/MacOS/Aperture
    Identifier: 
    com.apple.Aperture
    Version:    
    3.2.2 (3.2.2)
    Build Info: 
    Aperture-201096000000000~2
    App Item ID:
    408981426
    App External ID: 5333832
    Code Type:  
    X86-64 (Native)
    Parent Process:  launchd [125]
    Date/Time:  
    2012-02-24 23:05:55.982 +0000
    OS Version: 
    Mac OS X 10.7.3 (11D50b)
    Report Version:  9
    Interval Since Last Report:     
    18654 sec
    Crashes Since Last Report:      
    20
    Per-App Crashes Since Last Report:   20
    Anonymous UUID:                 
    244A3A5D-F483-4E17-AFD2-B35CB6B4EBD4
    Crashed Thread:  0
    Exception Type:  EXC_BREAKPOINT (SIGTRAP)
    Exception Codes: 0x0000000000000002, 0x0000000000000000
    Application Specific Information:
    dyld: launch, loading dependent libraries
    Dyld Error Message:
      Library not loaded: /Library/Frameworks/PluginManager.framework/Versions/B/PluginManager
      Referenced from: /Applications/Aperture.app/Contents/MacOS/Aperture
      Reason: no suitable image found.  Did find:
    /Library/Frameworks/PluginManager.framework/Versions/B/PluginManager: no matching architecture in universal wrapper
    I havnt installed anything for last 10-15 days.
    Aperture library located on hd.
    12 ram  870GB free space

  • Do you need to have the retina display option to have 3 different video outputs?

    Do you need to have the retina display option to have 3 different video outputs?

    http://en.wikipedia.org/wiki/Video_card
    http://support.apple.com/kb/ht5842 Maverick requirements.

  • Firefox won't open a message tells me it is all ready running I need to close the window to open firefox. Firefox is not open so why do I get this message

    When I try to open firefox a box opens up and tells me firefox is already running in another window and I need to close the window if I want to open firefox in a new window. Firefox is already closed, nothing is left open when I close out firefox. I would only have this problem once in a while but now it is happening more often why?

    Open Task Manager and click on the Processes tab. Scroll down to "Firefox.exe" , click on that line and click on "End Process" button.

  • I need a reliable office suite.   Open Office is not working well for me.  Any suggestions?

    I need a good reliable office suite.  Open Office is not working well for me.  Any suggestions?

    If you mean Open Office is not always able to correctly open documents received from clients created with MS Office, then the only real solution is to purchase Office 2011 for Mac. As good as some of the free alternatives are, they can't duplicate every feature of MS Office.

  • What is the formula to get document link in calculated column for document library ?

    Hello,
    would you please let me know the formula to get document link in calculated column ?
    Thanks and Regards,
    Dipti
    Dipti Chhatrapati

    hi Dipti,
    there is no column which contains the ItemURL.
    if you want a colum to have url than you need to create a workflow
    which calculate the ItemUrl and store it in custom column
    use the below article to do this
    http://www.sharepointusecases.com/2013/05/how-to-show-file-path-inside-a-sharepoint-document-library-view/
    Whenever you see a reply and if you think is helpful,Vote As Helpful! And whenever you see a reply being an answer to the question of the thread, click Mark As Answer

  • How to Get Choices as a Dropdown from a different Column for the same Item In a Document Library?

    Hello All,
    I was trying to see if there is any way that we can get the choices for a Field from another filed in the same item in a Document Library.
    To be specific.
    I have Created a Project Document Set, Which has a Column called "Project Members" where all the members will be listed. This will be inherited to all the documents in that Project Document Set. This is used to grant Permission using Workflow.
    I also have "Document Members" Column(This is only for Documents) who will be given Edit permissions to that Document using a Workflow. This can be any type of column(choice, People or Group etc) As long as I can select multiple values.
    I am looking for a way to get the "Project Members"(Values or Users) as choices for "Document Members". I know this is possible in the List as you can customize in the InfoPath Form. But not sure in the Document Library.
    Document Members can only be the members from the Project Members, In order to grant granular Permissions for the project And Documents using a Workflow
    Document Library
    Project Document Set Name
    File Name
    Project Members
    Document Members
    Project A
    User1;User2;User3
    Doc1
    User1;User2;User4
    User1;
    Doc2
    User1;User2;User5
    User1;User2;
    Doc3
    User1;User2;User6
    User1;User2;User3;
    Project B
    User5;User6;User7;
    Doc1
    User5;User6;User7;
    User7;User5
    Doc2
    User5;User6;User7;
    User7;User5
    Doc3
    User5;User6;User7;
    User5;User6;User7;
    Thanks for your time.

    >
    Jenny Karunakaran wrote:
    > Hi Jung,
    >
    > Thanks for the reply. But I dont know how to assign value set to this attribute(i.e. Context atribute to which filter value property is bound). Can I use a supply function for this ?
    >
    >
    > Regards,
    > Jenny
    No. A value set and a supply function are two completely different things. You use this Context API to populate the value set for an attribute:
    IF_WD_CONTEXT_NODE_INFO=>SET_ATTRIBUTE_VALUE_SET
    Value Sets are also how ByKey UI elements (like the DropDownByKey) are built.  Here is a help document that discusses value sets - but in the context of the ByKey UI elements.  The process is the same for creating the value set however:
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/bb/69b441b0133531e10000000a155106/frameset.htm

  • I need not see the menu to open the page but after a few seconds

    How I can make a menu of Adobe Muse appears not once to open the page.    That looks after an animation that I have.    But without using the scroll.      I just want to slow their appearance on the page.

    Perhaps you could put the menu in a composition widget and tick 'auto play' and 'hide all initially'.
    If you set the time of the autoplay at 4 seconds then (I think) this would delay the appearance of the menu for 4 seconds.
    Hope that helps.
    Ben

  • Why does the image not open in Elements when I opt for Edit in Photoshop Elements 11 from the Photos tab in Aperture?

    With an image in Aperture, when I got Photos one of the options offered is "Edit in Elements Photoshop 11", but although selecting this opens Elements, there is no image and it is necessary to open the image in the normal way from within Elements.  Other plugins, e.g. from Topaz work superbly from within Aperture.  I am puzzled to know the reason, and in particular if there is any setting in either Aperture of Elements that need to be attended to.  I would be very grateful for any suggestions.
    Barry Willcock

    Hi Frank, and many thanks.   I can now get the picture into Elements, and work on it.  However, when I have finished, I save it (giving it another name that I can recognise if the amendments are slight) it puts the file back into the same folder, but I have then to import it into the Aperture library in order to see it back in Aperture.  Not a big problem, but an interesting one.
    Again, many thanks
    Barry

  • I need to deny the use of usb devices on MACs and Macboks for non admin users. Can this be done?

    I am new to MACs and have been tasked with providing new users with Macs and MacBooks. I have been told that the CIO does not want the users to be able to transfer data from the machines to any devices via the usb port, but to allow the support staff the use of the same usb ports.
    I thought of just changing permissions and allow only the administrators access, but am not sure if this would work.
    Help!! lol... I need to do this "YESTERDAY" as my CIO would put it.
    Thanks for your help!

    Your CIO is asking the wrong question. What about FireWire ports? What about AirDrop? However, if you need to go through the motions of placating him, search for "Removing USB Support Software" in this document:
    http://images.apple.com/support/security/guides/docs/SnowLeopard_Security_Config _v10.6.pdf

  • HELP ! Need help with the MyZenChecker. (Zen Vision:M isn't charging for first ti

    I bought a Zen Vision : M some days ago. It won't charge. I?have WinXP,Service Pack and WMP0. I got GOOD on everything on MyZenChecker. I use the USB at the back. I've also tried with a USB charger which I put into the wall, but that didn't work either. I tried fix2, but I didn't get everything on how to get it work.
    I download it. Double click the .bat file. It comes a black route. It's written that it was succesful. Then after that what should I do in details, please ?
    I tried to restart the computer right after getting successful on the .bat file with the Zen connected. Nothing happens after I turn it on again. No blue light or anything. The computer can't detect it. Am i supposed to connect the Zen after restart ? Should it come a blue light right after restart or should I let charge for 5+ hours without the blue light and then connect it again to get blue light.
    Please tell me what to do in details step by step. Thx
    Message Edited by perry_09 on 07-29-200706:56 AM

    you shd connect it and reboot your PC. the myzenusb.bat is to amend your open up your USB permission. no blue LED light flashing means its not charging. I suggest you exchange this with your retailer since you just bought it

  • When the Firefox homepage opens I get a window asking for the master password security device - - - also a fake Adobe window asks me to update: malware.

    Apparently, I'm not the first.
    Other than "x-ing" the Pop-Ups can these be totally eliminated. I know that the Adobe Pop-ups are fake . . . and add malware. I just had to re-install my OS and get a new hard-drive. I want to keep my computer clean.

    Sometimes a problem with Firefox may be a result of malware installed on your computer, that you may not be aware of.
    You can try these free programs to scan for malware, which work with your existing antivirus software:
    '''[https://support.mozilla.org/en-US/forums/support-forum-contributors/710576 Possible Mal-Ware Scan For Macs]''' {web link}
    '''Windows'''
    * [http://www.microsoft.com/security/scanner/default.aspx Microsoft Safety Scanner]
    * [http://www.malwarebytes.org/products/malwarebytes_free/ MalwareBytes' Anti-Malware]
    * [http://support.kaspersky.com/viruses/disinfection/5350 Anti-Rootkit Utility - TDSSKiller]
    * [http://general-changelog-team.fr/en/downloads/viewdownload/20-outils-de-xplode/2-adwcleaner AdwCleaner] (for more info, see this [http://www.bleepingcomputer.com/download/adwcleaner/ alternate AdwCleaner download page])
    * [http://www.surfright.nl/en/hitmanpro/ Hitman Pro]
    * [http://www.eset.com/us/online-scanner/ ESET Online Scanner]
    [http://windows.microsoft.com/MSE Microsoft Security Essentials] is a good permanent antivirus for Windows 7/Vista/XP if you don't already have one.
    Further information can be found in the [[Troubleshoot Firefox issues caused by malware]] article.
    Did this fix your problems? Please report back to us!

  • I need help with the Media Encoder, but do not see a forum for that

    I'm having difficulty with some large Windows Media Files--200 to 300 MB--using the CS4 Media Encoder to encode into FLV. Is there a file size limit for source files? I moved the files locally to remove any network issues. If this is not the correct forum, pelase advise.
    Thanks!

    http://forums.adobe.com/community/ame

  • When I attempt to download new subscription I do not get the download screen. I just paid for the new subscriiption and the cloud requires me to buy a different subcription for each of the features. I need to talk to customer support. what is the phone nu

    how can I get directly to customer support!!

    Something to try:
    http://helpx.adobe.com/contact/what-contact-options.html
    Be well...

  • InDesign CS3 crash during document open (at XML Attribute Value update for locked item)

    OS: Windows XP
    InDesign: InDesign Release 5.0.0.458   
    Plugins: No additional plugins
    I am facing crash in InDesign at following workflow
    Steps:
    1. Create a new document.
    2. Create a graphic frame.
    3. Place an Image (C:\TESTDIR\images\test-image.jpg)
    4. Tag the graphic frame (Right Click -> Autotag).
    5. Lock the layer.
    6. Save the doc at (C:\TESTDIR\files\test-doc.indd).
    7. Move the image file to (C:\TESTDIR\)
    8. Open the same document.
    9. InDesign Crash.
    Crash log:
    Adobe InDesign Protective Shutdown Log
    06/01/09 14:48:51
    Unhandled error condition
    Session started up at 2:44 PM on Monday, June 01, 2009
    Version: 5.0.0 - Build: 458
    Error Code 0xbfcd: "Cannot modify elements that contain locked content, or are contained by locked content. Please unlock or check out the content and try again."
    Command Sequence:
    > kOpenFileWithWindowCmdBoss = ""
    > kOpenFileCmdBoss = ""
      > kOpenDocCmdBoss = ""
       > kSetDocNameCmdBoss = ""
       > kSetDocNameCmdBoss = ""
    > kSetAllUsedStyleCmdBoss = ""
      > kSetAllUsedStyleCmdBoss = ""
    > kRestoreLinkCmdBoss = "Restore Link" : kBeforeDoMessageBoss @ kDocBoss (IID_ICOMMANDMGR)
    > kSetAssetAttributesCmdBoss = "" : kBeforeDoMessageBoss @ kDocBoss (IID_ICOMMANDMGR)
      > kSetAssetAttributesCmdBoss = "" : kAfterDoMessageBoss @ kDocBoss (IID_ICOMMANDMGR)
    > kXMLSetAttributeValueCmdBoss = "Set Attribute Value" : kBeforeDoMessageBoss @ kDocBoss (IID_ICOMMANDMGR)
      > kXMLSetAttributeValueCmdBoss = "Set Attribute Value" : kAfterDoMessageBoss @ kDocBoss (IID_ICOMMANDMGR)
    > kRestoreLinkCmdBoss = "Restore Link" : kAfterDoMessageBoss @ kDocBoss (IID_ICOMMANDMGR)
    Please let me know how to stop XML tag updation (execution of  kXMLSetAttributeValueCmdBoss) at document open.

    Is the first time one of these files crashes always on one system or another, or is it random across systems?
    It is random and it's not related to a file (one time i can open the file andanother time it cause an InDesign crash);
    It sounds very much like a font problem. Are you using a font manager, and if so, which one?
    We have reproduced the problem also on machine with only system's fonts.
    I forgot to say that the crashes happen only with InDesign files with InCopy files linked in.
    Thanks
    Alessandro

Maybe you are looking for