Consolidate the results of the WORK of DBMS

Hi people,
I understand that we can perform several tasks using DBMS Job. However kindly help me with the following scenario.
I have a procedure/function called get_studentlist (number ENROLL_YEAR); This procedure gives me a value.
On the front-end server by using a report that I would like to get the results of 2010-2011
Then I call
Select testfun (2010) double
Union
Select testfun (2011) double;

Yes using DBMS JOB I was able to run both jobs at the same time. But the question is how to capture the result of both of them.
Even if I store the result in a table (temtable)... a job can finish first, then the other. How long should I query the table?
In short, I'm trying to simulate the concept of thread JAVA using PLSQL.

Thank you
AJ

You've posted enough to know that you will need to provide your Oracle version 4-digit (result of SELECT * FROM V$ VERSION).
>
I understand that we can perform several tasks using DBMS Job. However kindly help me with the following scenario.
I have a procedure/function called get_studentlist (number ENROLL_YEAR); This procedure gives me a value.
On the front-end server by using a report that I would like to get the results of 2010-2011
Then I call
Select testfun (2010) double
Union
Select testfun (2011) double;

Yes using DBMS JOB I was able to run both jobs at the same time.
>
What are the "two" jobs you are talking about?

Your post is very confusing please change to clarify what you are saying.

You are referring to a 'get_studentlist' function, but your example uses a function called "testfun.

You show a query that queries both unions to get two years of data, and it is a request; He won't be back for results before completing the request (either two years of data).

You mention two DBMS_JOBs running, but your example is a simple United request. What two jobs are you talking about?
>
In short, I'm trying to simulate the concept of thread JAVA using PLSQL.
>
You have a query so that the example has nothing to do with threads.

If you want to create several jobs and dependencies between them, you must use DBMS_SCHEDULER.

See examples of creating strings in the database administrator's guide
http://docs.Oracle.com/CD/B28359_01/server.111/b28310/schedadmin006.htm#BAJHFHCD

Neither DBMS_JOBS nor DBMS_SCHEDULER will allow you to consolidate data from two different jobs. That can only be done by using a table to store data or by using a pipeline that would run two queries and return results one after another.

Tags: Database

Similar Questions

  • killing the work of DBMS do not work

    Hello
    I ran a job using a command like this:

    DBMS_JOB. Submit (l_job, 'procedure_name;', sysdate, 'NULL');

    Now the interval is null... The work should not have run again after this particular job to be killed... We have killed this work & killed session and removed the work queue.

    Still, we found that this work ran after a while... How it would have happened...
    can someone pls advise...

    THX
    KP

    How it would have happened...

    That Oracle is in error, or you are.

    How can we reproduce what report you it?

  • Speed/performance of my mac mini (mid-2010) is very slow. Need help, consolidate the files, software updates, etc. in order to improve the speed and performance.

    My mac mini (mid-2010) speed/performance is very slow - think of it as a result of letting my kids do "whatever" about it in recent years.  Need help, consolidate the files, software updates, etc. in order to improve the speed and performance.  You will also need to get data out of old PowerBook G4.

    < object edited by host >

    We are users like you.  Search locally by using something like Yelp or similar

    http://www.Yelp.com/search?find_desc=Apple+repair & find_loc = Chicago, + IT & start = 0 & ortby = rating s

    or read a few links which may be relevant on this forum about the slow mac mini

    http://BFY.tw/5C63

  • Could not create the work file. Check the temp environment

    After I did my Vista SP2 update, the only thing I could do was to reformat the HD. After all, including Office 2007 reloading, Outlook and work has worked well. Again, I went through the updates, Vista and Office SP 2 and now in Outlook and Word I get this error message Outlook (Word) could not create the work file. Check the temp environment

    variable. I am alos having other problems in Word. Help, I can't find all the answers!

    Follow the steps below at our own risk.  Set a restore point before doing this. Make a mistake in the registry can have bad results

    In your registry HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Explorer\User Shell Folders\Cache Database Cache data value must be %USERPROFILE%\Local Settings\Temporary Internet Files

    Close all programs. Then in the registry editor, once you get in the folder above, right click on "Cache", make a left-click on "Change", paste in "%USERPROFILE%\Local Settings\Temporary Internet Files" (without the quotes), on the left, click 'Ok' close the editor of the register. Restart the PC.

    This should solve your problem.

    - Http://blogs.msdn.com/powlo/archive/2007/01/01/fix-for-error-outlook-could-not-create-the-work-file.aspx

    a. start-> Run-> enter "regedit" and press "Enter" to run the program to change registry variables.

    b. navigate to the folder-> "HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Explorer\User Shell Folders\Cache"

    c. check the values of variables [for everything in the "User Shell Folders" folder] - all the variable should have values from '% USERPROFILE%\ '. ». Any variable that is not of this starting point is probably damaged. In my case, all variables corrupt has been a correspondent of "Backup_VariableName". Example: my variable "cache" was damaged when there is a variable called 'backup_cache' with the correct values

    d. change the value of variables corrupt to correct the values. Example of change variable value "cache" in "%USERPROFILE%\Local Settings\Temporary Internet Files" and so on.

    e. close all of Ms Office programs, and turn. The problem should be solved now.

    I added the text in square brackets [] above.

    Microsoft partner - "gentlemen, you can't fight in here! This is the war room. »

  • Problems with the work computer remote desktop connection

    I used the remote desktop for VPN connections to work for a few years.  My new employer has a Sonic Wall VPN.  My home PC is running XP.  The work computer is Windows 7.  I activated the remote on this computer connectivity.  I can connect to the VPN with a number.  Remote Desktop detects the computer to work without problems as well.  When I try to signon with my valid credentials, I get a message that my ID or password is invalid.  By using the same credentials locally everything works perfectly.  I tried to connect with my user disconnected and connected in the workplace with no difference in results.  Any thoughts there?

    Hi DougH_50,

    Your Windows XP question is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for the IT Pro TechNet public. Please post your question in the TechNet Windows XP Networking forum.

    http://social.technet.Microsoft.com/forums/en-us/category/windowsxpitpro

  • Failed to open the Works document after Windows Update

    Original title: failed to open the works document, after a month of update.__9 of configuration of microsoft of 350 pages. Help!

    no change...

    Hi SILLIVEN,.

    1. what exactly happens when you open the works document?
    2. do you get an error message?

    Try these steps and check the result.
    Step 1: Update remove recently installed
    a. see remove an update
    b. Once you have removed the update, restart the computer.
    c. open work document and check if the problem persists.

    Step 2: If the problem does not persist after the removal of the update, try to install updates on hold by turning off all non-Microsoft programs and check the result. To do this, try the following steps:
    a. open the article: http://support.microsoft.com/kb/929135
    b. Article, follow "step 1: perform a clean boot" the implementation of these measures will disable all programs not Microsoft currently running on the computer.
    c. install the updates. See the updates Windows Installer
    d. Once you have installed the updates, the article, follow "step 7: reset the computer to start as usual.
    e. check if the problem persists.

    For further assistance on Microsoft Works, please post your request here: http://www.microsoft.com/products/works/support.mspx

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • WMP copy the work even on hundreds of albums

    Hello

    I just bought and torn Marina & album The Family Jewels diamonds.

    It was not recognized by WMP, or rather, that it has not been properly recognized as the album of jewels of Chieli Minucci. So I came home all song names manually in 'Finding information', found the correct application on the web, and right click 'Paste album art' on the fake picture. That has worked, but then WMP has started to implement this Chieli Minucci on dozens of albums in my library, or overwrite an existing work, or to make this work on albums with no work.

    This behavior already happened once, last year with 2 different albums, on a system Vista with WMP11 or 12, can't remember, now it happens again, probably under the same steps to repro, so I think it's bug still present in WMP12, probably related to this feature to 'Find info', because I edit dozens of names of the song or replaced directly album art in the library WMP, apart from this feature 'Finding information' without any problem.

    This has happened on most of my CD with no work or work that I copied manually. My setting to "Retrieve additional information from the Internet" is the default value 'Only add missing information', I turned off the setting of recovery as soon as I noticed this problem, but it seems that most of this work already propagated itself like a virus on 199 albums, so I reset it back as it was. A lot of classical music boxsets are particularly affected.

    Anyone experienced the same number, or can repro it? Now I need to delete all the 4 files incorrect work by album of close to 200 albums, I can do it with a little script, but I don't know if there are other registry keys, or else I should delete. And I also want to make sure that Microsoft corrects this destructive behavior.

    System: Windows 7 x 64 Ultimate + WMP 12.0.7600.16415

    Edit 1:

    I think I know why this bug occurs, it seems that the albums that are not recognized by the online database are assigned a null GUID:
    {00000000-0000-0000-0000-000000000000}

    Somehow, when you manually change the information of the album and the work, the incorrect database online is assigned to all the albums in your library that have already a null GUID, think that all of these 199 different albums are actually the same!

    All artwork crushed have names such as file AlbumArt_ {00000000-0000-0000-0000-000000000000} _large.jpg.
    As far as I can do it, here is 199 albums for which I pasted work manually, using WMP "Pockets of dough" standard feature. Some were in my library for the month and was removed when I replaced one after you change the names of the songs via the function "Find album info", which I'll never use again.

    This is a serious bug in WMP which should get fixed as soon as POSSIBLE, each album must have a unique GUID and must never use a null.

    Here are more details on the steps of reproduction:
    -J' inserted the CD mentioned above in the CD with WMP player on rip automatically when inserting
    -All the tracks on the CD got torn, but with a different artist, album, information of the work
    -J' opened 'find info"to see if I could find the correct album information
    -No luck, then I entered the song names manually in this same dialog box
    -Back in the library, I selected all the songs and the artist name game properly and the artist contributing empty
    -J' copied the correct work on the web (amazon.com) to the Clipboard
    -J' clicked "Dough pockets" to replace the incorrect work
    -J' got an error message indicating that one of the song was in use so stick would not work, but it seemed to work even when
    -J' noticed that art had white stripes at the top and at the bottom, so I removed the in MS Paint, which makes the work perfectly square
    -J' copied the fixed work of MS Paint and paste again in WMP

    Result: WMP has replaced all my work manually selected with an image completely out of words of another artist and album.

    Edit 2:

    I have no idea what WMP does with this work, now I have 2 additional jpg in my file of the album:

    8 649 AlbumArtSmall.jpg
    File 30 309 AlbumArt_ {00000000-0000-0000-0000-000000000000} _Large.jpg
    8 649 AlbumArt_ {00000000-0000-0000-0000-000000000000} _Small.jpg
    File 7 107 AlbumArt_ {1CAEDEDE-A93E-42F6-8194-78E868FFC53B} _Large.jpg
    1 945 AlbumArt_ {1CAEDEDE-A93E-42F6-8194-78E868FFC53B} _Small.jpg

    30 309 Folder.jpg

    Jpg 2 files in bold with GUID not null are bad, the other 4 are those that were created when I used the function "Paste album art" WMP.

    I deleted all the 6 files and reused 'Paste album art' and got the same 4 files with null GUIDS like the first time:

    8 631 AlbumArtSmall.jpg
    File 30 129 AlbumArt_ {00000000-0000-0000-0000-000000000000} _Large.jpg
    8 631 AlbumArt_ {00000000-0000-0000-0000-000000000000} _Small.jpg
    30 129 Folder.jpg

    Well, almost the same, folder.jpg seems to have lost some bits between copy & paste.

    I'm sure only a few hours, will WMP 'Retrieve additional information from the Internet', i.e. copy again 2 Chieli Minucci non-null GUID JPGs on my album Marina & The Diamonds.

    Am I bad luck? All MS trying to repro this

    Edit 3:

    Before I deleted all these great AlbumArt_ {00000000-0000-0000-0000-000000000000} | Small.jpg files, I kept a dozen and fact the following:

    -On the first album, use 'Find info', it is a good album with illustrations

    -J' deleted all JPGs of the album and used "update the album information.

    Results:

    -All other albums with null GUIDS have been updated with the work of this first album. Not sure if it happened after the first or second stage.

    My question is: How did I get these works GUID null in the first place? I never created these files manually, but still using the "Pockets of dough" function regular WMP. WMP should never allow to create these null GUID, the purpose behind GUID is that they are "unique in the world."

    Correction of the information earlier: I got 199 albums with the work of Chieli Minucci even, but I also had 124 albums with good work manually copied and pasted but assigned the GUID null on top. The second step in this post has reset many of them to the work of the first step. In total, it's 323 carefully created albums I've lost or who will no doubt be crushed by WMP at some stage.

    (I moved all the separate modifications in this single ticket because obviously posts prevent people from answering the initial question MS).

    Hi Chimel,

    Check the settings of the library in windows media player. Steps to follow:

    i. open Windows media player

    II. click on organize

    III. Select Options, select the Library tab

    IV. in the title of the newsletters of automatic support for files

    v. Select only adds the missing information

    VI. and uncheck then to retrieve additional information on internet

    If you think this is a bug in Windows Media Player, you can report it by using the link given:

    https://connect.Microsoft.com/?WA=wsignin1.0

    Thank you, and in what concerns:

    Samhrutha G S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Adobe Muse and edge animate - how to consolidate the files on the ftp/server?

    Hi all

    I'm working on a site, and I've recently added edge animations animate.  They look great, but the only problem I encounter is that the site load faster I want that there.  I did a few speed test and I think that what is originally the loading time is that I have about 5 edge animations animate different and they each have their own folder separately with their own javascript into a folder called "assets".

    Is there a way to consolidate the "assets" folder, so that my site loads more fast?

    Any help would be greatly appreciated!

    Hi, VelveteenWebDesignGroup-

    You're in luck!  Add us in a feature in the latest version of edge animate CC (3.0) to activate the CDN for OAM option publish (what we call the "animate Deployment Package").  This means that your animated compositions can now reference jQuery and the runtime Animate the network rather than from the project directory.  (Please note that this will only feel for the integration of Dreamweaver and Muse with OAM and will not make sense for InDesign.)

    To enable this, launch Animate and go to file > publishing settings.  Select the Deployment Package animate on the left and click on 'executable files on Adobe CDN to host.  Save and publish, and you should be good to go.

    Hope this helps,

    -Elaine

  • How can I change the base color in the work of Recolor settings?

    How can I change the base color in the work of Recolor settings? I know that this seems a silly thing but I really need to figure this point and I have read and went through the manual and the forum for help, without result. Help, please.

    Click the color you want in the "new color" column. Then click the base color next to the list of color harmonies, which will change then, but the harmonies of color will depend on your desired color.

  • What is the work around the downloaded CD 2 of CS2 installer disk prompt error?

    What is the work around the error of the 2 CD downloaded CS2 replacement installer disc prompt?

    OK, I paid for this software.  I have the media, and the series here.  There is no problem with either.  The problem is with Adobe reluctance to save it.  So, Adobe has a downloadable "fix".  They replace the software that I own with a downloadable set of files.  They provide instructions that are inaccurate and a Setup program that requires a CD that does not exist (Please insert CD 2 to continue installation?)

    What is the work around the error of the downloaded installer CS2 urging "Please insert CD 2 to continue installation"?

    I'll tell you what is the solution... Do not buy Adobe products because they are trying to manipulate customers in the purchase of new products.

    I'll upload the separate installation programs for each of the sequencing of CS2.  After I cancel my check again to get another installer Adobe "oopsy" around, I'll install each application separately.  There should not be a disk command prompt.  But I suspect another error display of ineptitude and deceit will result.

    If I can not port this old app on my new computer, so I guess that's where Adobe and I part ways.

    T. St lover see message #11 in http://forums.adobe.com/message/4919014#4919014?sdid=KCHDS where the extraction process is discussed.

  • Why 'Do the work path' give lousy paths?

    I do not use Photoshop a lot, so I bet, I'm missing something obvious. Lately I drew hollow ellipses on top of existing photos, with results miserable.

    I was making a selection and stroking the selection (should I do something different)?

    If I make the selection into a path, with 'do the work... path. " "(or the icon which is not pop up a dialog), it gives paths very bad appearance with distortion.

    If I caress with Edit > stroke, so it's great. (So I'll just use Edit > stroke).

    But I understand why.

    Here is a screenshot:

    The left is a striped work path.

    The

    paths.png

    The left one is the path of work. The circle in the Center is to Edit > stroke. The path on the right is the way of working of a circle.

    All the circles created with SHIFT by dragging between the elliptical selection tool, then they shuould be the same.

    The defined tolerance as low as possible, to 0.5.


    12.0.2 Photoshop x 64 under OSX 10.6.7, but this problem is not new.

    It is in mathematics. You have business with creates a vector object based raster data, then caressing it.  You can create similar things in Photoshop, but there is always a better way of doing things. Now that you know how do better elsewhere, you may want to give up on making the wrong way.

  • Help with comparisons between the work units in the base line

    P6v7 running, I have a base calendar to resources and I want to see the work units of base from the current hourly work units. I go to the spreadsheet of the use of resources and discover real work, budgeted and other units, but I don't have the option to display the basic units. I first thought the budgeted units were the base line reading, but it is not true that the planned duration does not match the unit duration of work budgeted for each particular activity or it corresponds to the duration of the current activity. Don't know what the length of buget reads from.

    I found that I can use the activity using profile window to display units of basic work compared to the real and remains as a histogram, but not in a spreadsheet format.

    Does anyone know how to check the times of the base line in the format of the worksheet?

    Thank you

    user12850365,

    I occasionally use resource and activity of histograms with spreadsheets. After reading your question, I decided to change my own setup and launch a scenario similar to what you're asking and got positive results.

    First of all, I guess a few things...
    * You already have a reference assigned to your project database
    * You are viewing the 'use spreadsheet activity' on the bottom of your screen

    First thing to do is to filter your activities within the project,

    * Group and sort * by 'Total' and show subtotals and totals
    Side to the left of the screen... Display ""BL project Labor units * "and" * budgeted Labor units * "columns on the left side of your screen"
    * To the right of the screen... (The custom Spreadsheet fields) displays budgeted Cum Labor units and Cum BL project Labor
    * My time scale is set to days and weeks

    Adjust your timescale to allow all of your data to display. You will thus limit much of your future data on the screen.

    This should display the two hours provided for in the budget and hours of departure within the spreasheet

    I would like to know if it works for you.

    Hope this helps you

  • [8i] help with function with parameters (for the calculation of the work)

    Let me start by saying, I've never written a function before, and I do not have access to create a feature in my database (that is, I can't test this feature). I am trying to achieve a function I can ask my IT Department to add for me. I hope that someone can take a look at what I wrote and tell me if this should work or not, and if it's the right way to go to solve my problem.

    I'm creating a function to make a very simple calculation of work (add/subtract a number of days to a date in the calendar).

    The database, I work with has a table with the schedule of work. Here is a sample table and sample data, representative of what is in my work table calendar:
    CREATE TABLE caln
    (     clndr_dt     DATE,
         shop_days     NUMBER(5)
         CONSTRAINT caln_pk PRIMARY KEY (clndr_dt)
    );
    
    INSERT INTO     caln
    VALUES (To_Date('01/01/1980','mm/dd/yyyy'),0);
    INSERT INTO     caln
    VALUES (To_Date('01/02/1980','mm/dd/yyyy'),1);
    INSERT INTO     caln
    VALUES (To_Date('01/03/1980','mm/dd/yyyy'),2);
    INSERT INTO     caln
    VALUES (To_Date('01/04/1980','mm/dd/yyyy'),3);
    INSERT INTO     caln
    VALUES (To_Date('01/05/1980','mm/dd/yyyy'),3);
    INSERT INTO     caln
    VALUES (To_Date('01/06/1980','mm/dd/yyyy'),3);
    INSERT INTO     caln
    VALUES (To_Date('01/07/1980','mm/dd/yyyy'),4);
    INSERT INTO     caln
    VALUES (To_Date('01/08/1980','mm/dd/yyyy'),5);
    INSERT INTO     caln
    VALUES (To_Date('01/09/1980','mm/dd/yyyy'),6);
    INSERT INTO     caln
    VALUES (To_Date('01/10/1980','mm/dd/yyyy'),7);
    INSERT INTO     caln
    VALUES (To_Date('01/11/1980','mm/dd/yyyy'),8);
    INSERT INTO     caln
    VALUES (To_Date('01/12/1980','mm/dd/yyyy'),8);
    INSERT INTO     caln
    VALUES (To_Date('01/13/1980','mm/dd/yyyy'),8);
    INSERT INTO     caln
    VALUES (To_Date('01/14/1980','mm/dd/yyyy'),9);
    The table includes since 01/01/1980 but 31/12/2015.

    I have written (and validated) this parameter query that performs the calculation of my working day (mday):
    SELECT     cal.clndr_dt
    FROM     CALN cal
    ,     (
         SELECT     cal.shop_days+:mdays     AS new_shop_days
         FROM     CALN cal
         WHERE     cal.clndr_dt     =:start_date
         ) a
    WHERE     cal.shop_days     = a.new_shop_days
    AND     ROWNUM          =1
    ORDER BY     cal.clndr_dt;
    Based on this request, I created the following function (and I have no idea if it works or if the syntax is right, etc..):
    CREATE OR REPLACE FUNCTION add_mdays 
         (start_date     IN DATE,
         mdays          IN NUMBER(5))
    RETURN     DATE 
    IS
         new_date DATE;
    BEGIN
    
         SELECT     cal.clndr_dt
         FROM     CALN cal
         ,     (
              SELECT     cal.shop_days+mdays     AS new_shop_days
              FROM     CALN cal
              WHERE     cal.clndr_dt     =start_date
              ) a
         WHERE     cal.shop_days     = a.new_shop_days
         AND     ROWNUM          =1
         ORDER BY     cal.clndr_dt;
    
         RETURN     new_date;
    
    END add_mdays;  //edit 9:31 AM - noticed I left off this bit
    I'm also not sure how to do to have the function handle results that would return a date outside the range of dates that appear in the table (prior to 01/01/1980 or after until 31/12/2015 - or, another way to look at what was, before the caln.clndr_dt or the caln.clndr_dt MAX value MIN value).

    My goal is to be able to use the function in a situation similar to the following:

    First of all, here is a sample table and data:
    CREATE TABLE orders
    (     ord_no          NUMBER(5),
         plan_start_dt     DATE,
         CONSTRAINT orders_pk PRIMARY KEY (ord_no)
    );
    
    INSERT INTO orders
    VALUES (1,To_Date('01/08/1980','mm/dd/yyyy'));
    INSERT INTO orders
    VALUES (2,To_Date('01/09/1980','mm/dd/yyyy'));
    INSERT INTO orders
    VALUES (3,To_Date('01/10/1980','mm/dd/yyyy'));
    And here's how I would use my function:
    SELECT     orders.ord_no
    ,     orders.plan_start_dt
    ,     add_mdays(orders.plan_start_dt, -3) AS prep_date
    FROM     orders
    Thus, the function would allow me to come back, for each command in my table of orders, the date is 3 days working (mdays) before the start of the plan of each order.

    I go about it the right way? I have to create a function to do this, or is there a way for me to integrate my request (which makes my mday calculation) in the example query above (eliminating the need to create a function)?

    Thank you very much in advance!

    Published by: user11033437 on February 2, 2010 08:55
    Fixed some typos in the last insert statements

    Published by: user11033437 on February 2, 2010 09:31 (fixed some syntax in the function)

    Hello

    Ah, referring to Oracle 8 and is not not able to test your own code makes me nostalgic for the good old days, when you have entered your cards and led to a window to the computer center and waited an hour for the work to be performed and then seen printing to find that you had made a typo.

    If you write functions, you should really test yourself. Like all codes, functions forge be written small not: write a line or two (or sometimes just a part of what would later become a single line), test, make sure it is running properly and repeat.
    Ideally, your employer must create a pattern of development in a development database that you can use.
    You can legally download your own instance of Oracle Express Edition free; just be careful not to use features that are not available in the database where the code will be deployed.

    You need a function to get the desired results:

    SELECT       o.ord_no
    ,       o.plan_start_dt
    ,       MIN (e.clndr_dt)     AS prep_date
    FROM       orders     o
    ,       caln          l
    ,       caln          e
    WHERE       l.clndr_dt     = o.plan_start_dt
    AND       e.shop_days     = l.shop_days - 3
    GROUP BY  o.ord_no
    ,            o.plan_start_dt
    ;
    

    It would be more effective (and somewhat simpler) If you've added a column (let's call it work_day) identified whether each line represents a work_day or not.
    For each value of shop_days, exactly 1 row will be considered as a working day.
    Then, the query may be something like:

    SELECT       o.ord_no
    ,       o.plan_start_dt
    ,       e.clndr_dt          AS prep_date
    FROM       orders     o
    ,       caln          l
    ,       caln          e
    WHERE       l.clndr_dt     = o.plan_start_dt
    AND       e.shop_days     = l.shop_days - 3
    AND       e.work_day     = 1
    ;
    

    You can use the analytic LAG function to populate the work_day column.

    A function would certainly be useful, although perhaps slower.

    The function you have posted has some errors:
    an argument can be stated under NUMBER (5); Just NUMBER.
    (b) when you SELECT in PL/SQL, as you do, you must SELECT a variable to store the results.
    (c) ROWNUM is arbitrary (making it useless in this problem) unless you draw a neat subquery. I don't think you can use ORDER BY in subqueries in Oracle 8. Use the ROW_NUMBER analytic function.
    (d) the service must end with an END statement.

    Given your current caln table, here's how I would write the function:

    CREATE OR REPLACE FUNCTION add_mdays
         ( start_date     IN           DATE          DEFAULT     SYSDATE,
           mdays          IN           NUMBER          DEFAULT     1
         )
    RETURN     DATE
    DETERMINISTIC
    IS
         --     add_mdays returns the DATE that is mdays working days
         --     after start_date.  (If mdays < 0, the DATE returned
         --     will be before start_date).
         --     Work days do not include Saturdays, Sundays or holidays
         --     as indicated in the caln table.
    
         new_date     DATE;          -- to be returned
    BEGIN
    
         SELECT     MIN (t.clndr_dt)
         INTO     new_date
         FROM     caln     f     -- f stands for "from"
         ,     caln     t     -- t stands for "to"
         WHERE     f.clndr_dt     = TRUNC (start_date)
         AND     t.shop_days     = f.shop_days + TRUNC (mdays)
         ;
    
         RETURN     new_date;
    END     add_mdays;
    /
    SHOW ERRORS
    

    Production code forge be robust (which includes "fool-proofing").
    Try to anticipate what people errors might appeal to your function and correct for them where possible.
    For example, if it only makes sense for start_date at midnight, mdays to be an integer, use TRUNC in the function where soembody passes a good value.
    Allow default arguments.
    Comment of your function. Put all comments within the service (i.e. after CREATION and before the END) so that they will remain in the data dictionary.
    If, given the same arguments, the function always returns the same value, mark it as DETERMINISTIC, for efficiency. This means that the system will remember the values transmitted rather than to call the function whenever it is said to.

    I wish I could score questions such as 'Correct' or 'useful '; you get 10 points for sure.
    You posted CREATE TABLE and INSERT statements (without even be begged).
    You gave a clear description of the problem, including the expected results.
    The code is well formatted and easy to read.
    All around, one of the more thoughtful and well written questions I've seen.
    Play well! Keep up the good work!

    Published by: Frank Kulash, February 2, 2010 13:10
    Added to my own version of the function.

  • Why most of the work has disappeared from the artist list in the update of iTunes 12.5.1 and 10 IOS and how I get it back?

    Update to the latest version of iTunes on my iMac and update my iPhone to IOS10 why most of the work in the list of artist in my iTunes library disappeared, and how do I get it back?

    Hello

    If you use iTunes game, try here > get help with iTunes - Apple Support

  • Hi all, I bought apple phone I 5s recently is the power button / stop does not. Bought in the United States, but I was shifted to the India, the works of will to guarantee in India please help

    Hi all, I bought apple phone I 5s recently is the power button / stop does not. Bought in the United States, but I was shifted to the India, the works of will to guarantee in India please help

    Ask an authorized service provider regarding iPhones, a guarantee of a country may or may not be honored in another function where you take the device.

    (143868)

Maybe you are looking for