Add the time interval to the date function

trying to create a function that would add days, months + years to any date that we would provide.
try to make this work-i know there is a plethora of potential problems with this.

One of my fav Msgs guard jump me: ' WARNING: function created with compilation errors. "
line 7 is the problem no doubt - data types.



------------------------------------------------------------
create or replace function nextexit)
p_date as p_years entire p_months entire, p_days in full)
date of return
is
v_nextexit date (30);
Start
v_futuredate: = p_date + INTERVAL p_years YEAR p_months MONTH INTERVAL INTERVAL p_days DAY;
Return v_nextexit;
end;
/
-----------------------------------------------------

(otherwise I tried to use the add_months/add_years/add_days functions, but it seems that only the work of a second?)

any help is appreciated!

Hello..

Try this:

CREATE OR REPLACE FUNCTION nextexit(
   p_date    IN  DATE,
   p_years   IN  INTEGER,
   p_months  IN  INTEGER,
   p_days    IN  INTEGER
)
   RETURN DATE IS
   v_futuredate  DATE;
BEGIN
   v_futuredate   :=
        p_date
      + NUMTOYMINTERVAL(p_years, 'YEAR')
      + NUMTOYMINTERVAL(p_months, 'MONTH')
      + NUMTODSINTERVAL(p_days, 'DAY');
   RETURN v_futuredate;
END;
SELECT nextexit(TRUNC(SYSDATE),
                1,
                2,
                1
               )
FROM   DUAL

Tags: Database

Similar Questions

  • Add the date and time to a photo

    How to add the date and time to a photo or contact sheet in OS X El captain?

    KADRI

    Christiana

    You want to write the date and time in the photo?

    You need to do it in an external editor.  Photos can't.

    You can print the date and time and other legends on a Board-contact, however.  When you select a photo and then use the model of the "Contact Sheet", you can click the 'Captions' button and select the metadata to use as the legend on the contact sheet.

    To write directly to the photo, you can use the Preview.app.

    Export the photo to go to Photos and then open it in preview or install the extension of"external editors" of the App Store. Then you can open preview directly from the Panel of editing in Photos.  See this tip for user: external photo editors are here

  • Add the date and time to a text field when the form is submitted

    Is it possible to add the date and time to a text field where the user is clicking the button of form submit?

    I created a custom send form button and do not use the distribution process to collect the results and would like to have a time stamp of when the form has been sent.

    Thank you!

    Sure. Before your submit order add a command run JavaScript with this code:

    this.getField("SubmitDate").value = util.printd ("mm/dd/yyyy hh: mm", new Date());

    Change the field name or date that required such boss.

  • Add the date/time of sending of the e-mail form

    Is it possible to add the date and time, a form is sent in the e-mail subject or body when the sender clicks a button to send email? So what I want to do, is when they click the send e-mail button, the subject could say 'Submit form' 16/02/15 at 09:27.

    Research further and was able to reach my goal with a bit of JavaScript.

  • How can I add the date of my taskbar notification area?

    I have the time but not the date in my notification area of the taskbar, how can I add the date?

    Right-click in an empty area of the taskbar, click Properties and then on the tab of the properties task bar, clear the check mark next to "Small icons"  This, of course, also means that the taskbar will be slightly higher, and you won't have the small icons.

  • Add the data in a field of multiple selection?

    Just got got off the phone with the support of Eloqua ask about the possibility of adding data in a field of multiple selection over time. Apparently, it's possible through mailings of form, but no list will be mailed.  Wouldn't be great if during a download list, you had the ability to add data from a field in your file .csv for existing values in this area in Eloqua.  Here's a use case for this scenario... in our society of industry can be part of multiple market segments.  Depending on the event, a person can feel they are part of the market segment 'Radar', but another event specializing in Sonar... they indicate that they are part of the market segment "Sonar", both being true.  There is currently no easy way to enter these data in Eloqua over time as part of the downloads from the list.  Based on the scenario above, the existing value is 'Radar', but if "Sonar" is the value of the field for the next download it replaces the value of 'Radar '.  Ideally, we would be able to capture the two values.

    I said that if there is enough interest in this idea, Eloqua would consider developing a new option for downloads from the list add vs crush.  I hope others can find a use case for this idea.

    Hi Tina,

    I know it's a bit old but I had a simular problem on adding values to a multi select.  Here's how I approached it.

    1. Add a text based contact field Eloqua to transfer your csv values.  Let's call it "MultiSelect download Value" for this example.

    2. Add Eloqua add values to a multiselect contact field.  What we'll call "MultiSelect Final.

    3. create a program that will add the download list.

    4. in the program, create a step to update Contact data

    . in the update rule, update "Definitive MultiSelect' field, Append the value in the field value, value will be hardcoded, check use a delimiter": ", marks the conditional rule the field" value to download MultiSelect "equals the value hard coded or one that you would like the field to be.

    b. create all update settings you need for your data.

    I approached this way because our downloads from the list should be add the data over time.  The field ' value to download MultiSelect ' allows it to be overwritten on each download.

    Let me know if you want more details.

    Thank you

    Blake

  • When OMF add the data file in the tablespace

    Hi friends,

    We use oracle 11.2 with CMS (oracle managed file) for the database on the linux platform. the parameter - DB_CREATE_FILE_DEST had been set. at the present time, we received a message from global warming this tablespace criterion is 85% full.

    According to the document of the oracle, OMF auto will add a data file in the tablespace tast. more than a week, I do not see any data file has been added by OMF.

    I want to know when OMF adds the data file in the tablespace? 85% or 95% or some (parameter) setting this action?

    Thank you

    newdba

    OMF does not automatically add a new data file.  You must explicitly add a new data file with the ALTER TABLESPACE ADD DATAFILE command tbsname.

    What is OMF is to provide a Unique name and a default size (100 MB) for the data file.  That is why the ALTER TABLESPACE... Command ADD DATAFILE that you run didn't need to specify the file size or file name.

    Hemant K Collette

  • Add the date

    I would like to display a date in the future based on a date that a user enters in a date field, but also a choice they make out a drop-down list.

    Drop-down list (dl1) allows the user to select "1 week, 2 weeks, 3 weeks, 4 weeks" etc upwards to "9 weeks. They have a date field (date1) that they enter a date. I want to put in a calculated field, reading one date adds date1 + the result of dl1 - call this calc1 (defined as a date field).

    All date codes, that I found in the research of always use the Date() function to call the current date, it will not work for me because I need to compare a date the user enters in the form, not the date current system.

    I placed a COMPUTER code in the calc1 that looks like this:

    Switch (dl1.rawValue)

    {

                    box "1":

    this.rawValue = date1.rawValue + 7;

                    break;

    case '2 ':

    this.rawValue = date1.rawValue + 14;

    break;

    }

    And it was all possible values in dl1. , But of course that simply adds the number 7 or 14 at the end of the date (if the date1 field is set for 2 August 2011, the result I get is 08-027-2011 or 2011-08-0214).

    I have to analyze the year, month, day of date1 and do some manipulation in this way? Or is there a practical function date already who can read a value of date and add days in it?

    Thank you!

    I would use FormCalc to date rather than JS operations...

    Here's an example simple and similar...

    var

    dSelected

    var

    wSelected

    var

    dResult

    dSelected

    = Date2Num(DateSelect.rawValue, "YYYY-MM-DD")

    wSelected

    = WeekSelect.rawValue

    dResult

    = dSelected + (7 * wSelected)

    DateResult.rawValue

    = Num2Date(dResult, "YYYY-MM-DD")

    and I chose for the drop-down menu, specify values in the object point > tab link and I chose 1 for 1 week, 2 for 2 weeks...

    Try this and let us know...

    Good luck

  • How to add the date felxfiled in OFA

    How to add the date felxfiled in OFA

    Hi gurus,

    How to add a date in the form OFA field. I tried but no optin schedule it. I need to add the calendar options before the flexfiled.

    Concerning

    Hello

    Allocate FND_STANDARD_DATE segment value your FDF everywhere where you want to see the calendar on the page of the OFA.

    Let me know if you need more help on this.

    Kind regards

    Hemant

  • When you add the data to the host of the second store it wants to format storage

    I have two hosts ESXi 5.5, one is the main host who currently runs the set of virtual machine from this data store. I would add the data store to the host, but to do so is greyed out on the new server, and he wants I want to format the data store.

    UPDATE:

    I used this thread to solve: cannot add to ESXi host VMFS datastore

    More precisely:

    Try the following command

    #esxcfg - volume - l

    This should show the volume

    To constantly increase the volume, use esxcfg-volume - M followed of the UUID or volume name

    Thank you for looking, sorry to distract. I saw this thread when troubleshooting first. Good day to all!

    Post edited by: TH2

    What type of shared storage using you, and you haven't set up the presentation of the logic unit number for the second host in the same way that you did for the first host? Do you manage the host with vCenter Server, or if you use two autonomous host computers?

    André

  • Is it possible that we can add the search function?

    Hello

    Is it possible that we can add the search function so we can search if the files sent to the front specific e-mail address?

    Without the search functions, it is very difficult to know if he was sent to nobody in particular, saw that expands the list of sent people.

    Kind regards

    Jim

    Hi decommoditizer,

    I'm sorry, there is no such function to find whether or not a particular file has been sent to a person in particular.

    You go through the emails individually research.

    However, you can maintain a database in Excel or another application note which file is send by the user.

    Kind regards

    Nicos

  • How to add the data without loss of data store?

    Hello

    We had ESXi 3.5 installed on 1 HDD and data store was on a different HARD disk.

    Now the HDD with ESXi host got crashed and I had to replace it with another HARD drive and make new ESXi installation on the new HARD drive.

    Now after the new ESXi install on new HARD drive, it does not detect the data store on the HARD drive second.  It is, however, detect the LUN of the second HARD disk.

    Now, how can I do detect the data store on the second HARD drive?  Or y at - it anyway I can add the data store on the second HARD drive to the new host ESXi?

    Thanks in advance.

    Kind regards

    Denis

    You will need to activate lun resignaturing and snapshot LUN, mount and rename the store of data back to its original name, and then disable them.

    -Matt

    VCP, vExpert, Unix Geek

  • How to add the data in asm file

    Hello


    Can someone let me know how to add the data using ASM file

    DB-ORACLE 10.2
    OS RHEL

    create tablespace tbl_name
    DATAFILE '+ DATA' SIZE 1 G REUSE
    autoextend on next maxsize of 250 M 2 G;

    where is your asm disk group + DATA

  • Add the date and time to the header or footer of page NUMBERS

    I'm designing a spreadsheet for a fundraiser following the suppliers, the delivery of requested supplies and supplies used. Given that it will be shared and continuously updated with other participants, I would like to include the date and the current time into the header or the footer. The time would be important, so everyone is looking at the last impression.

    I use an iMac end of 2015 with El Capitan 10.11.4 and NUMBERS 3.6.1

    Thanks in advance for your help.

    Brudduh,

    I think that you must manually update the time every time in the header or footer options

    Numbers for Mac: using headers and footers for printing - Apple Support

    But it's simple, just go to print spread out and make the changes, then print and distribute your worksheet updated for your fundraising.

  • Add the date and time in DBMS_SCHEDULER. Name of the job CREATE_JOB

    Hello
    I have a JDeveloper application that needs to create

    'DBMS_SCHEDULER. CREATE_JOB ().

    The problem which I am facing is that I might need to create two jobs that may be waiting at the same time. When this happens, I get an error saying that the name of this work already exists.

    So I tried to create the name of the task so that it has the data and the time that the job was created, which will give it a unique identifier. But when I tried the following I have an invalid name for the database object error.

    Start
    DBMS_SCHEDULER. () CREATE_JOB
    "EmailJobDefinition" | TO_CHAR (SYSDATE, "DD-MM-YY HH24:MI:SS) |".
    "PLSQL_BLOCK,"
    "BEGIN EMAIL. SEND_LONG_MAIL('','','','') END '.
    0,
    TO_DATE (March 12, 2009 09:30 ',' MM/DD/YYYY HH24:MI:SS'),
    NULL,
    NULL,
    "DEFAULT_JOB_CLASS,"
    FAKE-WHAT IS TRUE?
    TRUE,
    'Comments');
    end;

    Is it possible to integrate the name of employment, the date and time?

    Thank you
    Steve

    Try this way:

    "EmailJobDefinition" | TO_CHAR (sysdate, 'YYYYMMDDHH24MISS') | ".

    Max

Maybe you are looking for