Update date field

Hi All,
I need to update datafiled in a manner where it display only month and year.
Date
05-APR-09
05-MAY-09
05-FEB-09
05-MAY-09
08-MAY-09
07-MAY-09
10-MAY-09
woule resemble like below one.
Date
Apr09
May09
Feb09
May09
May09
May09hare krishna

Hi,
Amit Beheria wrote:
Yes you are right, but I have a requirement, where , I need a single value coming out, when applied group by function. for example, I have purchase_date , category, amount_spent like field in a table, when I need to query which is the category, on which I spent maximum is bit difficult, because, then it returns many value, becuase a month can have many dates. in office, right now, otherwise, i would've paste the result set here.A lot of folks store the dates in a DATE column, and use something like TRUNC (dt, 'MONTH') (as Charred did, in the first reply to this thread) when they want to map everything from one calendar month into one value.
For example:
REATE TABLE     table_x
(     id     NUMBER (4)     PRIMARY KEY
,     dt     DATE
,     amt     NUMBER
INSERT INTO table_x (id, dt, amt) VALUES (301,  TO_DATE ('31-Mar-2010 00:00', 'DD-Mon-YYYY HH24:MI'),  10);
INSERT INTO table_x (id, dt, amt) VALUES (302,  TO_DATE ('31-Mar-2010 00:01', 'DD-Mon-YYYY HH24:MI'),  20);
INSERT INTO table_x (id, dt, amt) VALUES (401,  TO_DATE ('01-Apr-2010 07:30', 'DD-Mon-YYYY HH24:MI'),  30);
INSERT INTO table_x (id, dt, amt) VALUES (402,  TO_DATE ('02-Apr-2010 20:45', 'DD-Mon-YYYY HH24:MI'),  40);
SELECT       TO_CHAR ( TRUNC (dt, 'MONTH')
            , 'Mon YYYY'
            )     AS month
,       SUM (amt)     AS total_amt
FROM       table_x
GROUP BY  TRUNC (dt, 'MONTH')
ORDER BY  TRUNC (dt, 'MONTH')
;Output:
MONTH              TOTAL_AMT
Mar 2010                  30
Apr 2010                  70There are some valid reasons for not using DATEs, such as needing fractions of a second or timezone information. In those cases, use a TIMESTAMP instead of a DATE.
Never use a VARCHAR2 or a NUMBER to store date information.

Similar Messages

  • How can I update data fields in a merged document ?

    Hi,
    I'm looking for a way to update the values of data fields in a merged document with a script just as you can do with the user interface.
    I don't find any method like "updateDataFields ()" in the DataMerge object.
    Si I try to invoke the menu action "Update Data Fields", but it fails. The script error message is: "Error 53762, the script is not active." On the contrary, the action works if I use the interface.
    Can anyone help me?
    Thanks in advance,
    FredIsnard
    PS : I work with CS5.5 and JavaScript.

    Hi!
    You might be looking for this one:
    DataMerge.mergeRecords (outputOversetReportFile: File )
    Merges records and produces an optional overset report.
    outputOversetReportFile: Data Type: File
    The path to the file in which to store the overset report. (Optional)
    Best regards,
    Andreas

  • Error while updating Date Field on Process Form.

    Hi,
    I am using java code to pre-pop date on the process form.First I used a java code whic took java.sql.date as input and returned the same java.sql.date.But it gave an error that:java.lang.String cannot be converted to java.sql.date.......
    So I changed the java code and now it takes string as input and returns java.sql.date. This code works fine for Pre-pop adapter and the date is populated on the process form.
    But when i use the same code in a Process Task adapter to update the date, then it gives the following error:
    ERROR [ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)' XELLERATE.ADAPTERS - Class/Method: tcAdpEvent/updateDataSetValuePost encounter some problems: Adapter Execution Error: updateDataObjFieldValuePost: error updating UD_OID_USR_DATE_OF_BIRTH
    ERROR [ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)' XELLERATE.ADAPTERS - Class/Method: tcAdpEvent/updateDataSetValuePost encounter some problems: {1}
    Can anyone suggest any method to update date field on process form?

    Hi Abhi,
    Can you tell me how you have implemented populating an UDF based on Prepopulation of another UDF. I have a similar kind of requirement. It would be great if you share your code or relevant part of it.
    Regards,
    Sunny Ajmera

  • Issue in Updating Date Fields in JDBC

    Hi Experts ..
      I am having issues in updating date fields in Oracle Database.
    My Sender Sends date in format 2007-05-19T14:34:55.0000000+02:00
    Can any one please suggest me how does the above format can be updated in JDBC with format 2007/05/19
    Thanks !

    Hi,
    See this Scree shot
    http://img517.imageshack.us/my.php?image=16324662pf7.jpg
    Take the Substring Function From Text Functionsand mention the position from 0 to 10 to take the Date alone from the Whole String which is getting in Source Field.
    And after that apply the Transform date Function fron Date Functions and mention the source date format and the target date foramt that needs to convert into.
    REgards
    Seshagiri

  • Update Date field automatically

    When a user is adding a new entry I want two of the fields in the table to be automatically updated without the user knowing (hidden fields), I want a current date and time to be entered into the Updated Date field and the :APP_USER to be entered into the Updated_by VARCHAR2 field.
    How do I go about doing this can I just put code to do so into the source of ITEMS or do I have to create a process?
    Thanks
    s

    S,
    Triggers are a good method, see this thread:
    Re: Table Trigger Syntax
    Jeff

  • I want to update date field in oracle table using database adaptor

    Hi Guys,
    I want to update date in oracle table field which is 'DATE' type , but i am getting following error.
    Pure SQL Exception.
    Pure SQL Execute of update crp3apps.IFACE_SO_DATE_CHANGES set PROCESSED_DATE=? where CTRL_ID=? failed. Caused by java.sql.SQLException: ORA-01830: date format picture ends before converting entire input string
    The Pure SQL option is for border use cases only and provides simple yet minimal functionality. Possibly try the "Perform an operation on a table" option instead.
    </summary>
    </part>
    - <part name="detail">
    <detail>
    ORA-01830: date format picture ends before converting entire input string
    </detail>
    i am formated the date using following code and assigned to one variable.
    ora:formatDate(ora:getCurrentDateTime(),'dd-MMM-yyyy hh:mm:ss ')
    this is update query
    update crp3apps.IFACE_SO_DATE_CHANGES set PROCESSED_DATE=#date where CTRL_ID=#id
    Please provide solution.
    regards
    janardhan

    The thing is that XSLT often doesn't deliver the functionality required when it comes to times.
    You suggest appening "Z" to the time but this means that the time is now in UTC time. What if the system from where the date is being converted is running in NZ using local time? Other systems that recieve the date (and correctly handle the time zone) will now have a time that is out by a number of hours.
    You often can't ignore the time zone (drop the 'Z') as if you send the time to a system it has to either assume the time is local to it (which may not be the case... the other system coudl be in a different time zone) or assume the time is UTC (I think crossfire does this by default).
    Typically can't just append a time zone (e.g. +11:00) either as many places have daylight savings so the value to appended is variable (you then need some way of determining what the value is... either Java Embedding or a Service).
    As you mention it does depend on the use case but in many circumstances using Jaba Embedding, not as suggested above but with the appropriate Java.util.Calendar classes, is the best way to handle date and time in BPEL. Even still you need to ascertain the format of times external to the system and ensure you parse them correctly.
    ANd even if you do all this you can still run into problems. I've seen a real world example where two systems which both handled time zones correctly and had previously been working together for quite a while, satrted reporting different times. It turns out that only one of them had had the most recent Java Time Zone patches applied and there had been a change in the dates for daylight savings here (Australia). Be warned!

  • Help with Updating Data Fields in Merged Document

    I'm working in InDesign CS5 v7
    I have a multipage report, all using one master page for about 80  seperate records. Each page has their own linked graphs/images.
    We  now have need to alter the source data, and while these alterations can be seen in  'Preview mode' on the Master Page, they are not carrying through  into the pages themselves. No amount of 'Update Data Source' clinking changes this,  and the 'Update Content Data Fields' remains greyed out...
    I really don't want to have to remerge the whole document, as I will loose all of the linked graphs and images.
    Can anyone help?

    You've seen the other thread, so I think you already know the answer...

  • Update Date Field in Table Row to SysDate

    This appears to be an easy thing to do, but I can't figure out the best way to do it.
    I have a table with 2 input text boxes and some output text boxes.  When either input text box changes for a row, I need to update the date in one of the output text boxes in the same row to the current date. Then, when I commit the changes, the database should show the current date for that date field in that record.
    I'm using JDev 11.1.1.6
    Thanks,
    Ray

    Any help would be appreciated.
    I figure the RowImpl class is being instantiated when the table loads.  Is there a method in the RowImpl class that gets called when a row is changed?  Should I have an action on my submit button that scrolls through all rows to see if any are dirty and update the date from there?
    Please help.

  • Update date field to database

    Hi All,
    I tried to update a date field to my database by using dataprovider, however, I got the following error "java.lang.RuntimeException: Number of conflicts while synchronizing: 1 SyncResolver.INSERT_ROW_CONFLICT row 1 Can't infer the SQL type to use for an instance of java.util.Date. Use setObject() with an explicit Types value to specify the type to use." Anyone can help me to resolve this problem?

    Also, following:
    http://blogs.sun.com/jfbrown/entry/using_creator_to_insert_into
    http://developers.sun.com/prodtech/javatools/jscreator/reference/techart/2/insert_row_in_table.html#4

  • Updating date field in db table.

    Hi ,
      I need to update a table which has a date field the and its of type dats.
    i need to insert  the date from the flat file. If the date field is blank it is updating in the table like
    "  /  /     ". if the date is 3/5/2006 it is updating properly.
    if the date is blank the table should be inserted with null values . it should not have " /  /    " also.
    can anyone help me on this.
    Regards,
    Rose.

    Use WRITE statement to transfer date into dats field.
    DATA : v_date TYPE d ,
           v_date1 TYPE d.
    WRITE v_date TO v_date1.
    Regards,
    Shailaja

  • Problem updating date field on user table

    Hi,
    I am having difficulty updating the value for a date field on a user defined table.  All of the other fields update fine.  Below is the code I am using.  Does anyone have any suggestions?  I have tried updating to both a date variable or a string variable.  Thanks in advance for your help
    Dim d As Date
        d = CDate("01/01/2004")
        pRecord.GetByKey (editForm.Items("Code").Specific.String)
        pRecord.UserFields("U_CardCode").Value = editForm.Items("CardCode").Specific.String
        pRecord.UserFields("U_CardNbr").Value = editForm.Items("CardNbr").Specific.String
        pRecord.UserFields("U_CardType").Value = editForm.Items("CardType").Specific.String
        pRecord.UserFields("U_ExpDate").Value = d
        pRecord.UserFields("U_Name").Value = editForm.Items("Name").Specific.String
        pRecord.UserFields("U_CVN").Value = editForm.Items("CVN").Specific.String
        pRecord.UserFields("U_Addr1").Value = editForm.Items("Addr1").Specific.String
        pRecord.UserFields("U_Addr2").Value = editForm.Items("Addr2").Specific.String
        pRecord.UserFields("U_City").Value = editForm.Items("City").Specific.String
        pRecord.UserFields("U_State").Value = editForm.Items("State").Specific.String
        pRecord.UserFields("U_Zip").Value = editForm.Items("Zip").Specific.String
        If editForm.Mode = fm_UPDATE_MODE Then
            pRecord.Update
        End If

    I think I have figured it out.  The cardtype field (which I was also updating) has a list of valid values.  If I didn't specify a value for this field none of the other fields would update either.  I'm still not sure of the reason for this behavior.

  • How to update date field in oracle using jdbc

    Hi all,
    In my database i have a column LAST_UPDATED_DTTM which is used to store last updated date . when i try to update using the following query stmt
    update MD_TABLE set LAST_UPDATED_DTTM= + " new java.sql.Date(c.getTime().getTime()) where PROD_ID=" + msdn ;
    ' c ' is instance of Calendar Class as below
    Calendar c=Calendar.getInstance()
    it gives the following error
    ORA009:Expected date got number
    can anybody please help with this?
    Thank you

    can't i do that without prepare statement?If you insist on stuffing that String, then format it in some convenient String format using SimpleDateFormat and call the TO_DATE function in Oracle, so that the database understands your Date too.
    ***Annie***

  • Setting and updating Date field in a jsp form

    Hi:
    I have a form (in jsp) where in I have a field for Date. The Date is entered in the form: 12/18/2002. I using beans to retrieve the form values and then pass to the program. THe date field is passed as String to the bean. The program changes the String to util date
    (assignment ===> name of bean)
    String strDate = assignment.getDueDate();
    java.util.Date adate = null;
    DateFormat fmt = DateFormat.getDateInstance(DateFormat.SHORT,Locale.US);
    try {  
    adate = fmt.parse(strDate);
    System.out.println("Util date in Bo: "+adate);
         catch (ParseException e)
              System.out.println(e);
    and before inserting into database, it is changed from util.date to sql.date.
    long time = adate.getTime();
    java.sql.Date sqldate = new java.sql.Date(time);
    Until now everythign is working fine. On my way back, when i retrieve the sql.date from the database, I change it to util date:
    java.sql.Date sqlDate = rs.getDate("dueDate");
    java.util.Date uDate = sqlDate;
    and then covert this util date to String
    String strDate = uDate.toString();
    When I display this string date on my form... it is in the format
    2002-12-18, although i have inserted it in 12/18/2002 format.
    Can anyone help me since i want my date to appear on the form in the format I enter (12/18/2002) and not the 2002-12-18 format of database

    Already answered elsewhere.

  • BAPI or FUNC, MOD. to Update Date Field in Item Detail Sub-Header In PO

    Hi All,
    I'm working with SAP IS-Retail. In a PO, at the Item Detail, Import Tab, there are 2 sub-tabs Verif.4 and Verif. 5. This fields which are EIPO-NACD4 and EIPO-NACD5. When a new X-factory is entered for PO, this dates are deleted. I'm required to write a program to feed these fields of the required dates.
    So basically, the user will run the program, input the PO no., the range of Line items they want to use the date for and lastly input the date he/she wants to use to populate the Verif. 4/5 date field.
    Is there any BAPI's or Function Modules I can use to export the values to the EIPO fields.
    Thanks.

    This issue is resolve.
    I foung a Function Module to use. The FM is
    "EXPIMP_POSTING"
    Thanks all.

  • Updating Date field that is set as read only

    I have a date field that I have set the "HTML Form Element Attributes" to "readonly = "TRUE" " I would like to have the option of clearing the value in the date box without a computation, I'd like it to be java based so that it is "on the fly" without having to refresh...
    I have an example that I use that works on POPUP LOV's ...
    "<"img src="/i/delete.gif" onClick="document.getElementById('#CURRENT_ITEM_NAME#_HIDDENVALUE').value='';document.getElementById('#CURRENT_ITEM_NAME#').value=''" ">"
    Both examples are used here .. http://htmldb.oracle.com/pls/otn/f?p=22240:2
    Any ideas?

    Just use the same technique that you use for popup lovs except just use #CURRENT_ITEM_NAME#, not #CURRENT_ITEM_NAME#_HIDDENVALUE
    See an example at http://htmldb.oracle.com/pls/otn/f?p=24317:91

  • Update Date field with mm/dd/yyyy format

    I have a Field with Date Type then I have to update it with sysdate but only with the mm/dd/yyyy (not TIME)
    I make:
    UPDATE TABLE
    SET DATE_FIELD = to_date(to_char(sysdate, 'mm/dd/yyyy'),'mm/dd/yyyy')
    Is There a better way to do it?????
    Thanks!

    You can use
    trunc(sysdate)
    for the insert.
    Regards,
    Gerd

Maybe you are looking for

  • Sharing iTunes Library with two users on the same computer

    I have all of my music stored on a external hard drive. Both users on the same computer have the iTunes music location folder as the external hard drive. How do I see music added in one persons log-in? For example: I just purchased two albums under o

  • How do I know if someone has submitted a form?

    How do I know if someone has submited a form, Do I get e-mailed?

  • Syncing with re-installed itunes

    Hi Looking for some help as not very techy with itunes.  I de-installed itunes from my computer then re-installed it.  now when I go into itunes none of my music apps etc are there.  Can I access my account?  If I synch my iphone and ipad with itunes

  • Newbie to Hibernate

    Hello, I am starting to use Hibernate and am working on some examples in order to see it working. I am now working on this one-to-many example that is raising exceptions that I am not beeing able to get rid of nor have I found anything clear enough,

  • Pound (£) sign prefixed with Â

    Hi, I've setup a form which processes/emails the data using PHP. The form gathers data including price (in GBP). When the form results come in by email, the £ sign is prefixed with a Â. Is there a way I can change the php script to remove this charac