Selecting based on current date

I wonder how I can set a value in a table based on the current date. I have viewed most of the posts and I found that it is straight forward to get current date. But my problem is to pass that current date for the comparison in my select statement. For example
I can get date using the select statement but I don't know how to use it in the next select statement. See below
select sysdate
from dual;
Like here,
UPDATE PAYMENT (payment_date)
SET (sysdate) /* this does not work */
WHERE pid='8';
So what do I need to do to set the payment_date field correctly? (for the reference my PAYMENT table is shown below for clarity)
CREATE TABLE PAYMENT     
     (pid          VARCHAR(15)          NOT NULL,
     rid          VARCHAR(15)          NOT NULL,
     payment_date     DATE,               
     due_date     DATE,
PRIMARY KEY(pid));
I would very much appreciate your response. Thank you.
Edited by: user10653046 on Nov 30, 2008 12:30 AM

If I'm not mistaken, you are asking about the basic syntax of an UPDATE statement?
You can find that in the SQL Language Reference. A link to the part where it talks about the UPDATE statement: http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_10008.htm#SQLRF01708
An example:
SQL> CREATE TABLE PAYMENT
  2  (pid VARCHAR(15) NOT NULL,
  3  rid VARCHAR(15) NOT NULL,
  4  payment_date DATE,
  5  due_date DATE,
  6  PRIMARY KEY(pid));
Tabel is aangemaakt.
SQL> update payment
  2     set payment_date = sysdate
  3   where pid = '8'
  4  /
0 rijen zijn bijgewerkt.Regards,
Rob.

Similar Messages

  • FM to get previous sunday date based on current date(SY-DATUM)

    hi all,
    Is there any function module to get the previous sunday date based on current date(sy-datum)?
    Regards,
    Kapil Sharma

    Hi Kapil,
    You can follow the logic below:
    data:
    l_date like sy-datum, **TODAY
    l_date2 like sy-datum, **Previous Sunday
    data:
    l_daynr like HRVSCHED-DAYNR.
    *Get today's date
    l_date = sy-datum.
    *Gey today's day (Monday, Tuesday, etc.)
    CALL FUNCTION 'HRIQ_GET_DATE_DAYNAME'
    EXPORTING
    langu = 'EN'
    date = l_date
    IMPORTING
    daynr = l_daynr.
    CASE l_daynr.
    *If it is Monday
    WHEN 1.
    -Subtract 2 days for the previous Sunday
    CALL FUNCTION 'HR_SEN_CALE_DAYS_DATE'
    EXPORTING
    id_date = l_date
    id-operator = '-'
    is_duration = 2
    IMPORTING
    ed_date = l_date2.
    *If it is Tuesday
    WHEN 2.
    CALL FUNCTION 'HR_SEN_CALE_DAYS_DATE'
    EXPORTING
    id_date = l_date
    id-operator = '-'
    is_duration = 3
    IMPORTING
    ed_date = l_date2.
    *If it is Wednesday
    WHEN 3.
    CALL FUNCTION 'HR_SEN_CALE_DAYS_DATE'
    EXPORTING
    id_date = l_date
    id-operator = '-'
    is_duration = 4
    IMPORTING
    ed_date = l_date2.
    *If it is Thursday
    WHEN 4.
    CALL FUNCTION 'HR_SEN_CALE_DAYS_DATE'
    EXPORTING
    id_date = l_date
    id-operator = '-'
    is_duration = 5
    IMPORTING
    ed_date = l_date2.
    *If it is Friday
    WHEN 5.
    CALL FUNCTION 'HR_SEN_CALE_DAYS_DATE'
    EXPORTING
    id_date = l_date
    id-operator = '-'
    is_duration = 6
    IMPORTING
    ed_date = l_date2.
    *If it is Saturday
    WHEN 6.
    CALL FUNCTION 'HR_SEN_CALE_DAYS_DATE'
    EXPORTING
    id_date = l_date
    id-operator = '-'
    is_duration = 7
    IMPORTING
    ed_date = l_date2.
    *If it is Sunday
    WHEN 7.
    CALL FUNCTION 'HR_SEN_CALE_DAYS_DATE'
    EXPORTING
    id_date = l_date
    id-operator = '-'
    is_duration = 8
    IMPORTING
    ed_date = l_date2.
    ENDCASE.
    Regards,
    Dilek

  • FM to get the previous sunday date based on current date(sy-datum)

    hi all,
    Is there any function module to get the previous sunday date based on current date(sy-datum)?
    Regards,
    Kapil Sharma
    Moderator Message: Basic date related questions are not allowed
    Edited by: Suhas Saha on Sep 19, 2011 11:39 AM

    Hi,
    There are function modules to find out the current day of the week depending on sy-datum. These are as below:
    1. DATE_COMPUTE_DAY - Returns a number indicating what day of the week the date falls on. e.g. Monday is returned as a 1, Tuesday as 2,...., Sunday as 7.
    2. RH_GET_DATE_DAYNAME  - Returns the day based on the date provided, e.g. Monday, Tuesday,..., Sunday.
    Using any of the above, if you can find out the current day, then you can calculate and compute the date of the previous Sunday.
    My observation is that using the first FM might make the calculation simpler.
    Hope this is of help to you.
    Regards,
    Shayeree

  • How to suppress a row based on current date -  at query level?

    In an Bex query report i have suppress rows based on current date.
    There is no current date available in query.
    there is a date field in the query.
    If by chance the date in that field is lesser than current date, I have to suppress that row.
    How can this be achieved?

    What is the code ofr creating a variable to get values >= to current date?
    I have implemented the following code which is not working.
    data L_S_range like line of E_T_range[].
    CLEAR L_S_RANGE.
    L_S_RANGE-SIGN = 'I'.
    L_S_RANGE-OPT = 'GE'.
    L_S_RANGE-LOW = SY-DATUM.
    APPEND L_S_RANGE TO E_T_RANGE[].
    Actually i have written in class, which will be inherited in superclass.
    Edited by: akshara20 on Feb 2, 2011 1:21 PM

  • Data changed based on current date  in Bex

    Hi Gurus,
       Hope you are all doing good ! I have a scenario in queries in Bex. When the query is executed the current system date must be captured and the data must be divided by the count of the previous months.
       For instance if the query is executed today the data must be divided by 1 ( for  jan)
       if it is executed next month, then the data muset be divided by 2 ( jan + feb ).
       Is there any COUNT variable in Bex ? Any idea how this could be done?
      Points would be assigned for sure.
    Regards,
    Sunitha.R

    Sunitha,
        You should create a variable which is not user entry and user exit as processing type. Based upon the date entered you should write code in CMOD to derive the figure with which you can divide the amount.
    The logic can be something like this:...
    If the user enters     period like 02.2207(feb 2007), then you can pass value as 2 for the variable newly created. This is a simple code which can be written easily if you have ABAP knowledge.
    Try it out.....

  • PowerShell Script to Delete Files Based on Current Date

    I know by using Get-Date PowerShell will look at the current date.  I would like to make a very basic PS Script which will delete a file older than 8 days based on the current day.  I believe using a if/then function will be necessary. 
    I am very new to scripting so Im not sure how the syntax is written.  All help appreciated.

    Yes, use -Recurse to get subfolders too:
    $Folder = "C:\Users\Me\Backups"
    Get-ChildItem -Path $Folder -Recurse |
    Where { $_.LastWriteTime -lt [DateTime]::Today.AddDays(-8) } |
    Sort LastWriteTime |
    Remove-Item $_ -Force -Confirm:$false
    Sam Boutros, Senior Consultant, Software Logic, KOP, PA http://superwidgets.wordpress.com (Please take a moment to Vote as Helpful and/or Mark as Answer, where applicable) _________________________________________________________________________________
    Powershell: Learn it before it's an emergency http://technet.microsoft.com/en-us/scriptcenter/powershell.aspx http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx

  • Setting only the TO field on the Created on Field in Selection screen to Current date

    Hello,
    We have a requirement to Set only the To date in the Created on Field in Selection screen to the Current date, I have tried through Dynamic variable option to set the Date calculation but I am able to see Options to set the Current date to From or From and To Created on Date fields instead of setting the Current date only to To created on Field.
    We are in 4.7 and are not supported with user defined variables, Appreciate your inputs on this.
    Thanks and Regards
    Mohammed Roshan

    >
    sunitha j wrote:
    > Hi ,
    >
    > It would br gr8..if u could give some more info about the usage of this class..i mean if i hav to implement it in my program....wat is the necessary data that needs to b copied...
    >
    > Thanx,
    > Sunitha
    what Text field you want to change.
    Since you are working with Dynpros , you have to split the screen in two parts, and one for the Showing differenet fonts and other your normal Dynpro information.
    you need to use the Method ADD_TEXT Did you check the program DD_STYLE_TABLE.

  • Last month end date based on current date

    Hi,
    How to show last month end date based on the current date.
    Eg:
    Current date = "08/26/09"
    Var- Last Month End Date = "07/31/09" etc...,
    Please help me how to get it...
    Thank You!

    Good to hear that it worked for you. but not for me.
    I tried like this:
    1st::
    1. var1= ToDate("06/30/09","MM/dd/yyyy")
    2.Var2= RelativeDate([Var1];-DayNumberOfMonth([Var1]))
    result: 5/30/09
    2nd:
    RelativeDate('6/30/2009';-DayNumberOfMonth('6/30/2009'))
    result: 5/30/09
    Am working on SAP OLAP cubes.
    Please help me where am going wrong....
    Thank You!

  • Deriving previous Fiscal Period based on current date

    Hi All,
    I have a requirement wherein I need to derive the previous fiscal period based on the current date. Is there any standard FM to get the same? If not can you let me know if there is any other way of deriving it?
    Thanks
    Sundar

    Hi Srinivas, thanks for your reply. What you have suggested will work fine if I am looking for current fiscal period. I want previous fiscal period. How do I get that?
    Thanks
    Sundar

  • Fixed report period based on current date

    I want to create a report containing records over a fixed period without using a date parameter. As a example I would like the report to continually draw on data that is no more than say ten years from the current date.
    E.g. Current date (xx/xx/2008) to (Current date - 10 years) or xx/xx/1998 then next year the formula would automatically adjust to current date (xx/xx/2009) to (Current date - 10 years) or xx/xx/1999.
    I am only a novice when it comes to designing reports so please bear that in mind.

    Hi,
    Create a RecordSelectionFormula and subtract 10 years from the current date with the DateAdd formula.
    E.g.
    //DateAdd (intervalType, nIntervals, startDateTime)
    {Table.Date} > DateAdd ("yyyy", -10, CurrentDate)
    The DateAdd function has more interval types, so you can subtract months, days, hours as well. Check the CR help file and search for DateAdd for details.
    Cheers,
    Fritz

  • Is it possible to automate printer selection based on current network?

    So I travel consistantly between a couple of environments in which I've configured wireless networks. They all have different printers. Is it possible for the system to automatically select a printer based on the network to which I'm currently connected? If not, who do I call to make that happen?

    Hi Prajk, you could use audience targeting for this. An alternative would be to create a view and add a filter so that "Approver" is equal to [Me]
    cameron rautmann

  • SQL (Select) based on Excel data

    Hi
    I have accounts & their status in a Excel file (like below)
    Account     status     
    1111     1
    22222     11
    I have like 300 rows in excel file
    (sometimes Account will have only 4digits, in that case I want to append '0' in the front)
    (sometimes status will have only 1/2digits, in that case I want to append '00', if its one digit and '0' if its two digit)
    I want to write a select statement based on those, for example (in this case)
    SELECT * FROM SUPPLIER
    WHERE (Account = '01111' AND Status = '001')
    OR (Account = '22222' AND Status = '011')
    How do I write the select for all 300 rows(in excel) at one time? I don't want to use(create) tables. And I am using Oracle version 9
    Thanks

    Hi,
    I assume this question is just about how to format the numbers, not about directly reading the Ecel file.
    To use different formats in different situations, all in the same column, use CASE to to choose the appropriate format, like this:
    WITH     my_excel_table     AS
    (     -- Begin test data
         SELECT     1 AS n     FROM dual     UNION ALL
         SELECT     22     FROM dual     UNION ALL
         SELECT     333     FROM dual     UNION ALL
         SELECT     4444     FROM dual     UNION ALL
         SELECT     55555     FROM dual     UNION ALL
         SELECT     666666     FROM dual     UNION ALL
         SELECT     7777777     FROM dual
    )     -- End test data, cut here
    SELECT     n
    ,     TO_CHAR     ( n
              , 'fm'     
                ||
                CASE
                   WHEN     n < 1000     THEN '000'
                   WHEN     n < 100000     THEN '00000'
                                  ELSE '9999999999'
                END
              )     AS f
    FROM     my_excel_table
    ORDER BY     n;The code above produces:
             N F
             1 001
            22 022
           333 333
          4444 04444
         55555 55555
        666666 666666
       7777777 7777777As written, this assumes the numbers are all non-negative integers, but it can be modified.
    Message was edited by:
    Frank Kulash
    Sorry if this confused you. I see now that it doesn't really answer your question.
    You can use TO_CHAR separately on the two columns:
    TO_CHAR (account, 'fm00000')
    TO_CHAR (status, 'fm000')
    or use LPAD, as Visu demonstrated.
    Only use these things for display. In the WHERE-clause (and similar places), you can use leading zeros if you like, but do not use quotes, that is, just say "account = 1111" and "status = 1", or, if you prefer, "account = 01111" and/or "status = 001".

  • Text-Variables for 12 selection based on 1 Date Variable

    Hello.
    I have a report where the user is being prompt to enter a start date (YYYYMM) in a variable.  Based on that, my report have 12 selection using the variable + offset(1), + offset(2) .... + offset(11).
    For the label of my columns, I'd like to display the the YYYYMM value, what the best way to achieve that?  From what I see, I might have to create 11 variables that are equals to my original variable entered by the user with the use of offset and then create 12 text variables to get that information but I really hope I'm wrong...
    Thanks.
    Regards,
    John

    Ok, sounds a better way than defining 24 variables (12 text + 11 Replacement path).
    Since I only have one variable (Month Selection by user), however, I'm not sure how to deal with the Offset in ABAP so I can properly assign my ZMONTH02TEXT, ZMONTH03TEXT, ZMONTH04TEXT and so on.  Do you have any piece of code to share ?  (Sorry, I'm pretty new to ABAP and I've been searching this forum for example but can't really find what I'm interested in).
    Basically what I need to do is to assign the following:
    ZCALMONTH01TEXT = ZCALMONTH --> The actual month is no problem as it's a simple replacement path variable defined
    ZCALMONTH02TEXT = ZCALMONTH with offset of + 1
    ZCALMONTH03TEXT ...
    ZCALMONTH12TEXT = ZCALMONTH with offset of + 11
    So it's ZCALMONTH02TEXT to ZCALMONTH12TEXT that I'm not sure how to code in the user exit..
    Thanks.

  • Calendar with preselected dates based on current date

    Can we get the calendar to be prepopulated with todays' date and today-7 date as the default before it starts running the initial queries when I log into dashboard.
    I have a calendar date range based on which my chart displays metrics. If I dont choose anything its picking up all the data first before I choose something
    Your help is always appreciated.

    I apologize I read your post too quickly and misunderstood your question. Unfortunately, I thought you were referring to a dashboard you had created and asking about setting up default dates for your bind variables/parameters.
    Well I'll have to leave this one to someone else. Sorry I couldn't be more help.
    David

  • Receivable Aging Report for India based on Invoice Date

    We have a reporting/legal need for our India location to report the aging of their receivables based on the invoice date of the documents rather than the net due date.  Is there an existing report available that already does this?
    Currently when you use FBL5N and related aging reports RFDOPO10 etc. it calculates the arrears from the net due date.  They need to calculate the arrears from the document date.

    The report S_ALR_87012168 still does not allow me to choose that I want to calculate the arrears from the document date rather than the net due date:
    I guess what they really need to know is how old the receivables are based on the date they were created.
    As in the example below, current aging reports use the Net Due to calculate a days in arrears of 6 days (based on current date of 2008/11/05).
    Ty Doc. Date  Pstng Date Bline Date Net due dt Arrea
    RV 2008.09.30 2008.09.30 2008.09.30 2008.10.30     6
    What they need is the number of days in arrears based on the document date (2008.09.30) which would increase the numer of days the receivable has been open to 36.

Maybe you are looking for

  • Diferencial de Alíquota - Optante pelo Simples

    Experts, boa tarde. Tenho um issue aqui no projeto e gostaria de uma juda de vocês. O business apresentou a necessidade de ter um tax code  que calcule o diferencial de alíquota (DIFAL), porém quando a condição de ICMS for a ICM0. Ou seja, complement

  • Bridge & Photoshop CS5, opening Photoshop files from Bridge

    If I open Bridge in Photoshop CS5, & double click on a jpeg thumbnail in Bridge, it will not automatically open the file in Photoshop. Why? How can I change my settings so that the files selected in Bridge will automatically open in Photoshop when do

  • Sun Portal 6 vs Oracle Portal

    Hi, I would be interested what Sun Portal people thing about the Sun Product and the Oracle Portal if they have some knowledge.... We are evaluating right now both products. What would be the advantage of the Sun Portal ? Oracle Portal has a nice con

  • Mac Mini for photshop and photosuite 8 from on one sofware

    I am looking to upgrade my mac mini. 1.66 Ghz intel core duo. Memory 1GB 667 Mhz DDR2 SDRAM. The reason is I am using Corel painter, phtoshop CS version 8, along with a wacom tablet and want to also purchase "on one photosuite 8." The configuration w

  • /dev/sequencer does not exist --- Found a fix for this !!!!!

    Hi guys i used to be able to play midi files and load sf2 into my audigy 2 platinum card. But last week i upgraded my system which was a 2.4 kernel and since then i get /dev/sequencer no such device. I bit the bullet and upgraded to the 2.6-scsi kern