Sum values in last row for date format "hh24:mi"

Hi,
I have a big problem creating a sum row with date data.
I created a sql view where the result looks like that:
SELECT category_name,
user_name,
b_mmyyyy,
b_1, ..., b_31
FROM view_category_user_booking
category_name, user_name, b_1, ..., b_31
category1, user1, 122008, 01:00, ..., 03:30
category2, user1, 122008, 02:00, ..., 01:00
category3, user1, 122008, 00:00, ..., 00:15My goal is to integrate a sum row at the end for the columns b_1 ... b_31
category_name, user_name, b_1, ..., b_31
category1, user1, 122008, 01:00, ..., 03:30
category2, user1, 122008, 02:00, ..., 01:00
category3, user1, 122008, 00:00, ..., 00:15
Sum, user1, 122008, 03:00, ..., 04:45I tried it like that:
select decode(grouping(category_name),1,'Summe',category_name),
sum(to_number(replace(b_1,':',','))) as b_1,
sum(to_number(replace(b_31,':',','))) as b_31
from category_user_booking
where user_name = 'user1'
and b_mmyyyy = '122008'
group by rollup(category_name)But the result isn't really successful
category_name, b_1, b_31
category1, 1, 3,3
category2, 2, 1
category3, 0, 0,15
Sum, 3, 4,45Is there somebody with an idea?
Thanks ahead,
Tobias

Hi Avinash,
the problem is not the grouping it is the date format.
Instead of a value like 5,4 > I want 05:40 or 1,75 > I want 02:15 in the sum value.
In my table all time values are saved in the format hh24:mi.
I don't know how to get that via a sql statement.
Output I want:
category_name, user_name, b_1, ..., b_31
category1, user1, 122008, 01:00, ..., 03:30
category2, user1, 122008, 02:00, ..., 01:00
category3, user1, 122008, 00:00, ..., 00:15
Sum, user1, 122008, 03:00, ..., 04:45Regards,
Tobias

Similar Messages

  • Compare values in different rows for date/time clashing

    Hello,
    Odd one this so bear with me...
    If I'm asking this question in the wrong place I apologise in advance
    I'm building a C# application that queries SQL tables, one of the functions I need to be able to implement is the ability to query a row(1) for it's datetime value, and disallow another rows(2) datetime value to be updated if the value of that row(2) is
    within an hour of the other row(1).
    I hope that makes sense...
    Any help will be greatly appreciated!
    Thanks
    Brendan

    Hello,
    Thanks for your reply.
    Would there be another way to do this?
    If there was some way to do this:
    UPDATE table SET 'column' VALUES '02/02/2015 14:00' WHERE Date = 02/02/2015 IF 'Column' = 02/02/2015 14:00 OR 02/02/2015 13:00 DENY
    I know that's not a proper statement, but you get the idea.
    The problem is that the datetime value is likely to change a lot, and I would like to avoid having to change this manually, but if I could somehow check for a datetime value with an hour either side of the update value that would be great.
    Thanks
    Brendan 

  • Input Value long enough for date format ,Error in executing parallel query

    Hi,
    My Table: ANML( ID, STATUS,B_DATE,B_MONTH,B_YEAR, DEATH_DATE)
    status 1 for alive and 2 for dead.
    i wrote a view to get age.
    as
    create or relace view view1 as
    select top."ID",top."STATUS",top."DOB",top."DEATH_DATE",top."ANML_AGE",top."DAYSDIFF",
    CASE
    WHEN anml_age < 1
    THEN 'D'
    ELSE 'M'
    END age_unit,
    CASE
    WHEN anml_age < 1
    THEN TO_CHAR (daysdiff || ' Day(s)')
    WHEN anml_age < 12
    THEN TO_CHAR (anml_age || ' Month(s)')
    WHEN MOD (anml_age, 12) = 0
    THEN TO_CHAR (ROUND (anml_age / 12, 0) || ' Year(s) '
    ELSE TO_CHAR ( ROUND (anml_age / 12, 0)
    || ' Year(s) '
    || MOD (anml_age, 12)
    || ' Month(s)'
    END age_string
    from
    (SELECT a.*,
    CASE WHEN status IN ( 1)
    THEN FLOOR(MONTHS_BETWEEN(TRUNC(SYSDATE),dob))
    WHEN death_date IS NOT NULL AND status IN (2)
    THEN FLOOR(MONTHS_BETWEEN(death_date,dob))
    END anml_age,
    CASE WHEN status IN (1)
    THEN FLOOR(TRUNC(SYSDATE)-TRUNC(dob))
    WHEN death_date IS NOT NULL AND status IN (2)
    THEN FLOOR(TRUNC(death_date) - TRUNC(dob))
    END daysdiff
    from (
    SELECTanml.id, status,
    TO_DATE ( DECODE (b_date,
    NULL, 1,
    b_date
    || '-'
    || DECODE (b_month,
    NULL, 1,
    b_month
    || '-'
    || b_year,
    'dd-mm-yyyy'
    ) DOB,
    death_date
    FROM anml
    WHERE b_year IS NOT NULL
    ) a) top
    when i tried to fetch all values from view its working fine.
    But when i tried to fetch values based on condition like as follows,
    select * from view1 where anml_age > 20 and anml_age<30
    I am getting error like:
    Input Value long enough for date format and Error in executing parallel query
    Please tell me wht is wrong.

    Here is your formatted code
    create or relace view view1 as
    select top."ID",top."STATUS",top."DOB",top."DEATH_DATE",top."ANML_AGE",top."DAYSDIFF",
    CASE
    WHEN anml_age < 1
    THEN 'D'
    ELSE 'M'
    END age_unit,
    CASE
    WHEN anml_age < 1
    THEN TO_CHAR (daysdiff || ' Day(s)')
    WHEN anml_age < 12
    THEN TO_CHAR (anml_age || ' Month(s)')
    WHEN MOD (anml_age, 12) = 0
    THEN TO_CHAR (ROUND (anml_age / 12, 0) || ' Year(s) '
    ELSE TO_CHAR ( ROUND (anml_age / 12, 0)
    || ' Year(s) '
    || MOD (anml_age, 12)
    || ' Month(s)'
    END age_string
    from
    (SELECT a.*,
    CASE WHEN status IN ( 1)
    THEN FLOOR(MONTHS_BETWEEN(TRUNC(SYSDATE),dob))
    WHEN death_date IS NOT NULL AND status IN (2)
    THEN FLOOR(MONTHS_BETWEEN(death_date,dob))
    END anml_age,
    CASE WHEN status IN (1)
    THEN FLOOR(TRUNC(SYSDATE)-TRUNC(dob))
    WHEN death_date IS NOT NULL AND status IN (2)
    THEN FLOOR(TRUNC(death_date) - TRUNC(dob))
    END daysdiff
    from (
    SELECTanml.id, status,
    TO_DATE ( DECODE (b_date,
    NULL, 1,
    b_date
    || '-'
    || DECODE (b_month,
    NULL, 1,
    b_month
    || '-'
    || b_year,
    'dd-mm-yyyy'
    ) DOB,
    death_date
    FROM anml
    WHERE b_year IS NOT NULL
    ) a) top

  • How To Find Last Row With Data +2, Then Format?

    I need to find the last row +2, select the range A:L, then format.
    Could someone please supply the code?  I can handle the format part.
    Thanks!
    A. Wolf

    Works great!
    I need to do 2 other things:
    1) Add a text value to r in A: & center over selection A:L
    Dim r As Long
        r = Cells.Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
           USED THIS BUT ENDING UP IN MIDDLE OF L:!
        ActiveCell = Range("A" & r)
        ActiveCell.Value = "Estimated True Up Total"
    2) 2) Format a total in r as currency/2 decimels/aligned to right.
    THANKS AGAIN!!!
    A. Wolf

  • Class Cast Exception for Date Format .

    Hi Friends ,
    I am getting a error for casting type from Object to Date type .
    Could you please some one help me . I am using a prepared statement in OAF for inserting a data .
    All fields are inserting except Date format .
    My code in controller as follows :
    try {    String StartDate=row.getAttribute("StartDate").toString();
    // String StartDate="30-Apr-2011";
    DateFormat formatter ;
    Date StartDate1;
    formatter = new SimpleDateFormat("dd-MMM-yy");
    StartDate1 = (Date)formatter.parse(StartDate);
    //System.out.println("Today is " +date );
    pstmt.setDate(12,StartDate1);
    } catch (ParseException e)
    {System.out.println("Exception :"+e);    }
    Thanks in Advance ,
    Keerthi

    Thanks so Much for the quick response .
    Exception Details.
    oracle.apps.fnd.framework.OAException: java.lang.ClassCastException at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:888) at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(OAPageErrorHandler.java:1145) at oracle.apps.fnd.framework.webui.OAPageErrorHandler.processErrors(OAPageErrorHandler.java:1408) at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2637) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1659) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418) at OA.jspService(OA.jsp:40) at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727) at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306) at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106) at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803) at java.lang.Thread.run(Thread.java:534) ## Detail 0 ## java.lang.ClassCastException at SONY.oracle.apps.inv.xx_slapg.webui.ServiceRequestCO.processFormRequest(ServiceRequestCO.java:153) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:799) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363) at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1118) at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363) at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363) at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363) at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2633) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1659) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418) at OA.jspService(OA.jsp:40) at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727) at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306) at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106) at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803) at java.lang.Thread.run(Thread.java:534) java.lang.ClassCastException at SONY.oracle.apps.inv.xx_slapg.webui.ServiceRequestCO.processFormRequest(ServiceRequestCO.java:153) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:799) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363) at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1118) at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363) at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363) at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363) at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2633) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1659) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418) at OA.jspService(OA.jsp:40) at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727) at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306) at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106) at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803) at java.lang.Thread.run(Thread.java:534)
    Here is my code .
    java.util.Date StartDate=(java.util.Date)row.getAttribute("StartDate");
    ------------------------------------------------------------------------------------------------

  • Parsing Issue in Filter For Date Format

    Hi Folks,
    I am having Parsing Issue on "Key Date" Object in Universe. See the Error and Code below for your review
    Error: Parse Failed: Exception: DBD, The value entered is not valid. It must adhere to one of the following formats.
    YYYYMMDD
    DD.MM.YYYYState:N/A
    Code:
    <OPERATOR VALUE="AND"><OPTIONAL><FILTER KEY="0I_DAYIN"><CONDITION OPERATORCONDITION="Between"><CONSTANT TECH_NAME="@Prompt('Day Interval From','A','Calendar Day\LovDay IntervalBase',mono,primary_key)"/><CONSTANT TECH_NAME="@Prompt('Day Interval To','A','Calendar Day\LovDay IntervalBase',mono,primary_key)"/></CONDITION></FILTER></OPTIONAL><FILTER KEY="0P_KEYDA"><CONDITION OPERATORCONDITION="Equal"><CONSTANT TECH_NAME="@Prompt('Key Date','D',,mono,free)"/></CONDITION></FILTER></OPERATOR>
    This universe is created by someone else and client need to modify it with a calendar but i did not modify it yet however its already giving me the hard time. Kindly advise, any kind of help will be appreciated
    Thanks

    Hi,
    With the information provided I cannot for sure get to the error but here is what I would check.
    Firstly, I was wondering if the 5th parameter in the @Prompt can be Primary_Key. I thought it would be either free or constrained.
    Secondly, please the LOV values for the @ prompt are being populated from 'Calendar Day\LovDay IntervalBase'. So I would check the date format being used there.
    Third, the To and From dates are alphaneumeric and not dates, so I am not sure how the comparision would happen.
    Hope this helps.
    Regards,
    Madhur

  • NEED ALTER TABLE ALTER COLUMN FOR DATE FORMAT

    Need something like this :
    ALTER TABLE ABC
    ALTER COLUMN DATE1 AS (DD/MM/YYYY)
    need to appear in this format (29/03/2014) in the table.
    also needs to be recorded in DB in that format.

    changed system date format, works. Thanks!
    You should always store values as dates itself in date/datetime related field in SQLServer
    The formatting can very easily be done in your front end (presentation layer) using format function
    Even in T-SQL you can use CONVERT or FORMAT functions to get the date values in the format you want
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page
    I don't follow you? Anyway, Olaf Helper's answer was the solution.
    SQL Server has a data type called DATETIME. To correctly query dates, it is easier to use this as it allows the SQL engine to do all the calculations for you, also the canonical format for dates in any database language is YYYY-MM-DD, this ensures correctly
    tiered dates that are stored in the right order. The way you store data and the way you display it should be kept as two seperate entities. This is the ISO standard and has been thoroughly investigated ...alot to say the least. This is where the term "front-end"
    and "back-end" developers come from, and also the distinction between server-side and client-side scripting.
    To cut a long story short, take the advice of the multiple professionals here, and follow standards otherwise you'll find yourself stuck, or worse, your legacy code will make someone tear their hair out.

  • Query to return separate rows for date range including NULLs

    I'm trying to write a query that will return all customers from table 1. Table 1 also provides a start date and an end date that may be different for different customers. Left join with Table 2  provides all matches and NULL if NO matches.
    If there is any match at all, I do not get the NULLs for other dates. There should be a match for each date from start to end. How can I write the code so that my return will loop thru each date and provide the match or NULL?

    Sorry. I am somewhat new to this and am not sure what you are requesting. I receive a return of all customers with the code below but if customer 1 has a start date of 1/1/15 and a stop date of 1/5/15 and a document exists for 1/1/15 and 1/3/15
    I do not receive the rows with NUL for 1/2/15, 1/4/15, and 1/5/15 which is what I'm trying to accomplish. If there is no match at all, I only receive the one row with NULL and I would like to see a row for each date from start to stop.
    SELECT  T1.IDNumber,T1.StartDate,T1.StopDate,T3.SignDateTime
    FROM
    Table1 T1
    INNER
    JOIN Table2
    T2
    ON
    T1.CustID
    = T2.CustID
    LEFT
    JOIN Table3
    T3
    ON
    T1.CustID
    = T3.CustID
    WHERE
    T1.StartDate
    > '2015-01-20 00:00:00.000'
    AND
    (T3.ReportID
    IN ('DOC1',
    'DOC2',
    'DOC3') OR
    T3.ReportID
    IS NULL)
    AND
    T2.YesNo
    = 'Y'

  • How to use value of Report Rows for another Item heading (interesting)

    Hi!
    This seem to be interesting question.
    I have a classic report which has 4 rows with date values. The Row1 has Date1, Row2 has Date2 and so on.
    The report is structured like this
    DATE_COL COL1 COL2
    Row1 Date1 100 101
    Row2 Date2
    I want to use the values of DATE_COL of ROW1 which is Date1 in the label of ITEM1 which can be on same page or different page.
    Also I want to sue the value of DaTE_COL of ROW2 which is Date2 in the label of Column 1 of Report 2.
    How to accomplish this? Appreciate your suggestions.
    Thanks,
    --CP                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    cpora007 wrote:
    Hi!
    This seem to be interesting question.
    I have a classic report which has 4 rows with date values. The Row1 has Date1, Row2 has Date2 and so on.
    The report is structured like this
    DATE_COL COL1 COL2
    Row1 Date1 100 101
    Row2 Date2In your report attributes of DATE_COL column > add column link as follows
    Link Text: #DATE_COL#
    Target Type: URL
    URL: javascript:alert('#DATE_COL#');
    And set the Display as property to Standard Report Column
    Now when the link is clicked you will get the alert with corresponding value
    Next step is to set the value as the label of your item.
    If it is on the same page
    -- Use javascript to set the label
    If its on a different page then you will need to pass this value to that target page and set the label using *&P1_MY_ITEM_NAME.* syntax
    See this to learn how to pass the value in URL http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21674/concept_url.htm#HTMDB03017
    I want to use the values of DATE_COL of ROW1 which is Date1 in the label of ITEM1 which can be on same page or different page.
    Also I want to sue the value of DaTE_COL of ROW2 which is Date2 in the label of Column 1 of Report 2. You can sue if you are in England! :)

  • Validating JTextField for Date Format

    hello,
    everybody.
    i am trying to perform a validation on text field, i.e if the input is in a date format then it will show, other wise it will consume the character.
    please help me out of this problem i am stucked with it.
    waitng for reply. the following is my code.
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    import java.util.*;
    import java.text.*;
    public class RilJDateField implements KeyListener
         JFrame frame;
         JPanel panel;
         JLabel label;
         JTextField text;
         GridBagLayout gl;
         GridBagConstraints gbc;
         Date date = new Date();
         public static void main(String a[])
              new RilJDateField();
         public RilJDateField()
              panel = new JPanel();
              gl = new GridBagLayout();
              gbc = new GridBagConstraints();
              panel.setLayout(gl);
              label = new JLabel("Only Date Format");
              text = new JTextField(5);
              gbc.anchor = GridBagConstraints.NORTHWEST;
              gbc.gridx = 1;
              gbc.gridy = 1;
              gl.setConstraints(label,gbc);
              gbc.anchor = GridBagConstraints.NORTHWEST;
              gbc.gridx = 2;
              gbc.gridy = 1;
              gl.setConstraints(text,gbc);
              panel.add(label);
              panel.add(text);
              text.addKeyListener(this);
              text.requestFocus();
              frame = new JFrame("RilJDateField Demo");
              frame.getContentPane().add(panel);
              frame.addWindowListener(new WindowAdapter() {
                        public void windowClosing(WindowEvent we)
                             System.exit(0);
              frame.setSize(300,300);
              frame.setVisible(true);
         public void keyTyped(KeyEvent ke)
         public void keyPressed(KeyEvent ke)
              DateFormat df;
              df = DateFormat.getDateInstance();
              df = (DateFormat) ke.getSource();
              if(!(df.equals(date)))
                   ke.consume();
         public void keyReleased(KeyEvent ke)
    }

    hi,
    thanks very much, u gave me great idea.
    according to ur suggestion i used JFormattedTextField as well as SimpleDateFormat, but while giving keyevent i am getting the error,
    so please if possible reply for this.
    the error is
    java.lang.ClassCastException
         at RilJDateField.keyTyped(RilJDateField.java:61)
         at java.awt.Component.processKeyEvent(Unknown Source)
         at javax.swing.JComponent.processKeyEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
         at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
         at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
         at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
         at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Window.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)and my source code is
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    import java.util.*;
    import java.text.*;
    public class RilJDateField implements KeyListener
         JFrame frame;
         JPanel panel;
         JLabel label;
         JFormattedTextField text;
         GridBagLayout gl;
         GridBagConstraints gbc;
         Date date = new Date();
         SimpleDateFormat formatter;
         public static void main(String a[])
              new RilJDateField();
         public RilJDateField()
              panel = new JPanel();
              gl = new GridBagLayout();
              gbc = new GridBagConstraints();
              panel.setLayout(gl);
              label = new JLabel("Only Date Format");
              text = new JFormattedTextField();
              text.setColumns(10);
              formatter = new SimpleDateFormat("dd mm yyyy");
              gbc.anchor = GridBagConstraints.NORTHWEST;
              gbc.gridx = 1;
              gbc.gridy = 1;
              gl.setConstraints(label,gbc);
              gbc.anchor = GridBagConstraints.NORTHWEST;
              gbc.gridx = 2;
              gbc.gridy = 1;
              gl.setConstraints(text,gbc);
              panel.add(label);
              panel.add(text);
              text.addKeyListener(this);
              text.requestFocus();
              frame = new JFrame("RilJDateField Demo");
              frame.getContentPane().add(panel);
              frame.addWindowListener(new WindowAdapter() {
                        public void windowClosing(WindowEvent we)
                             System.exit(0);
              frame.setSize(300,300);
              frame.setVisible(true);
         public void keyTyped(KeyEvent ke)
              Date date = (Date) ke.getSource();
              if(!(date.equals(formatter)))
                   ke.consume();
         public void keyPressed(KeyEvent ke)
         public void keyReleased(KeyEvent ke)
    }

  • Obiee 11g upgrade issue for date format

    Hi,
    I am facing a date format issue with obiee 11g report. This statement cast(cast(current_date as char) as timestamp) is failing with "not a valid month" error in obiee 11g. This worked fine with obiee 10g.
    I am basically trying to set the date to 12:00:00 am of the sysdate. Below is what I am trying to achieve:
    timestampadd(sql_tsi_hour, 1, cast(cast(current_date as char) as timestamp)))
    the above statement fails in obiee 11g.
    Thanks for your help,
    AP

    I dont think you need any functions to get the required output, try to set the date format as below
    [FMT:timeStampShort]
    If helps mark
    Thanks
    Edited by: Srini VEERAVALLI on Apr 23, 2013 4:18 PM
    I think with format and then the below should work with no issues.
    timestampadd(sql_tsi_hour, 1,current_date)
    I think you are wasting time by posting here, just do it. You no need any ones permissions to do it ;)
    Edited by: Srini VEERAVALLI on Apr 24, 2013 8:55 AM

  • Value interaction is Navigate but data format is HTML

    hi, I have a column says BRAND (string)
    but I dont want to show the text directly.
    I changed the data format to HTML, and the value of the column is HTML code (showing a image per brand).
    my goal is to:
    the users click on the image, then navigate to another request.
    how to achieve my goal ?

    1. select Data Format = HTML
    2. In formula (fx) window use the following code
    ''||Table.Brand||''
    where <URL> is the link to the page you want to navigate to.
    By doing this, Brand will appear as a hyperlink.
    Note: I wrote the html hyperlink tag <a></a> to show you how to get a link on your column, but this editor is turning that code in to a hyperlink. I dont know how to avoid this. Hope you get the point in the solution though.
    Edited by: vahibg on Aug 18, 2009 2:27 AM

  • FM For date Format

    Hi,
    Could anybody assist me, the date format is like 20080519, but it should be in the format of 19.05.2008.Is there any function module .
    Thanks in advance.
    Regards.
    I.Reddy Prasad.

    Hi,
    CALL FUNCTION 'CONVERT_DATE_TO_INTERN_FORMAT'
        EXPORTING
          DATUM = W_DATE1
          DTYPE = 'DATS'
        IMPORTING
          IDATE = W_DATE2.
    Month in words
    Date Format (month in words, day and year in number)
    Regards
    Adil

  • Function module for date format

    Hi,
    what is the function module name to get the date format in <b>(dd.mm.yyyy)</b> from (<b>dd-mon-yyyy)</b>
    Thanx.

    try this Fm
    CONVERSION_EXIT_SDATE_INPUT
    input as dd-mon-yyyy
                28FEB2007
    im assuming mon in literal format.
    output is 20070228
    WRITE STATEMENT WILL DISPLAY THE DATA IN DEFALUT DATE FORMATS OF SU3 .
    <b>Elaborate teh query with an example .</b>
    check this
    regards,
    vijay.

  • How to declare data type for DATE format

    Hi,
    I need the data format in this format  DD-MM-YYYY HH:MI:SS
    So, I m using    select TO_CHAR(Date_Column, 'DD-MM-YYYY HH:MI:SS')  from dual;
    Now, In my procedure I need to assign this to a OUT  variable, what should be the Data type of out variable.
    My OUT variable is used by other program.
    Thanks

    You can use VARCHAR2. Try the below
    CREATE OR REPLACE PROCEDURE proc_test(p_indate DATE, p_outdate OUT VARCHAR2) 
    AS 
    BEGIN 
       p_outdate:= TO_CHAR(p_indate,'DD-MON-YYYY HH:MI:SS'); 
    END; 
    SET SERVEROUTPUT ON
    DECLARE 
       v_date  VARCHAR2(50); 
    BEGIN 
       proc_test(SYSDATE,v_date);
       DBMS_OUTPUT.PUT_LINE(v_date);  
    END; 
    OUTPUT:-
    anonymous block completed
    15-JAN-2014 12:13:46

Maybe you are looking for