Problem retreving datetime

hi
how to retrieve datetime with result;
if i use rs.getDate("CREATE_DATE") i am getting numberformat exception?i am using oracle database?
i want in this format 12-Jul-2003 14:20 format???
can anybody give me code
SELECT TO_CHAR(CREATE_DATE, 'DD-MON-YYYY HH24:MI') AS CREATE_DATE FROM COMPLAINT_DETAILS A,COMPLAINT_MASTER B, OFFICE_HIRARCHY C,CONSUMER_MASTER D,USER_MASTER E WHERE RECORD_STATUS='ACTIVE'

Remove the TO_CHAR() in your sql string. Else it just return a String but not a Date then cause the NumberFormat exception.

Similar Messages

  • Problem with datetime data type in Web Service

    Hi,
      I created local ABAP proxy based on a WSDL and some of the fields for the SOAP methods has data type datetime:
    name="MsgEndTimeStamp" type="s:dateTime" />
    name="MsgStatus" type="s:string"/>
    Since ABAP stack doesnt support dataTime data type it has created the proxy method with data type STRING.  Now when I call the proxy method (consuming the service) I get an error:
    <CODE>SoapFaultCode:4</CODE>
    <ERRORTEXT>Server was unable to read request. --> There is an error in XML document (1, 626). --> String was not recognized as a valid DateTime.</ERRORTEXT>
    I am sure others have faced the same issue.  Can someone help?
    Thanks

    Thanks but I dont think that link is much relevant to the problems I am facing, because I cannot change the web service definition as it is used by many others.  Also the target application runs on oracle so thats why some of the fields are datetime and I dont want to change that, even if I could.
    I am just stuck in creating the wrapper program to call the service since the SAP converts datetime data type to string and when the messages gets to the application it cannot convert string -> datetime.
    thanks anyway

  • Problem retreving data from cluster table

    Hi friends,
    Iam facing a problem while retreving data from a cluster table..
    select knumv
              kposn
              krech
              kawrt
              kbetr
              waers
              kpein
              kmein
              kwert
              from konv
              into table gt_konv
              where knumv in s_agnm.
    In s_agnm i have 8 entries ie: iam giving manually 8 entries in s_sgnm-low.
    If i do the above way iam getting exactly the 82 entries which i have in KONV table.. This is perfect..
    But when iam using for all  entries iam getting only 58 records from the KONV table..
    ie :
        SELECT KNUMV
               KPOSN
               KRECH
               KAWRT
               KBETR
               WAERS
               WAERS
               KPEIN
               KMEIN
               KWERT
               FROM KONV
               INTO TABLE ITAB1
               FOR ALL ENTRIES IN ITAB
               WHERE KNUMV = ITAB-F1
    Here F1 is the field which is same as S_SGNM as above and it also contains same number of records as above
    Now when iam running the 2nd select statment iam getting only 58 entries ... instead it should get 82 entries as above...
    Can any one tell me how to correct..
    Regards
    Kumar

    even if i use all the key fields , its giving me the same results 58 reocrds, instead it should give me 82.
    select knumv
           kposn
           stunr
           zaehk
           from konv
           into table gt_tybh
           where knumv in s_agnm.
      if gt_tybh is not INITIAL.
        sort gt_tybh by agreement_number kposn stunr zaehk.
       select knumv
              kposn
              krech
              kawrt
              kbetr
              waers
              kpein
              kmein
              kwert
              from konv
              into table gt_konv
              for all entries in gt_tybh
              where knumv = gt_tybh-agreement_number and
                    kposn = gt_tybh-kposn and
                    stunr = gt_tybh-stunr and
                    zaehk = gt_tybh-zaehk.
    In the above iam getting all the 82 records for the select-options s_sgnm..
    later iam trying to get the other fields form the same konv table by using for all entries... here even if iam using all the key fields also its not getting me the total 82 records...
    Initially for s_sgnm which contains 8 values , for those 8 values iam getting 82 records it table gt_tybh. But later when iam using for all entries iam not getting those 82 records in the 2nd select statment in the internal table gt_konv.
    Why is this happening...
    can any one correct it..
    Regards
    Kumar

  • Problem retrieving datetime SQL data

    Hi All
    My app is trying to retrieve data from a MSDE sql datetime field in this way:
    DateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
    Date fecha = rsServicios.getDate("fecha");
    System.out.println(sdf.format(fecha).toString());But it returns me all dates with hours, mins and secs with zeros !!
    How could I do to get the real data ?
    Thanks in advance
    J

    But it returns me all dates with hours, mins and secs
    with zeros !!
    How could I do to get the real data ?
    getDate method returns only Date and not the time
    Use getTimeStamp() instead, which returns Timestamp object.
    Timestamp ts=rs.getTimestamp();
    Date d=new Date(ts.getTime());

  • SQL Command and Datetime Parameters

    <p>Hi, </p><p>I am having problems  adding datetime parameters to a SQL command.</p><p>The code is AND table.startdatetime >= &#39;{?start}&#39; </p><p>I enter the time and date in the parameter and get the following error.<br /><br /><strong>Incorrect syntax near 2006</strong></p><p>Any clues</p><p>Thanks</p>

    Hi,
    What database you are using?
    Regards
    Sarobinyal

  • Problem when connecting sql server 2005 using SQL developer

    Hi,
    I installed Sql developer and I am trying to connect sql server 2005 using windows authentication. I had previously the SSO folder problem saying the path is missing in java.library.path. I copied the SSO folder into Sqldeveloper directory. I changed the settings under computer management->services and applications->sql server configuration manager->sql server 2005 network configuration ->protocols for sqlexpress->I enabled TCP/IP.
    Now I am getting an error saying "Failure-can not open user default database.Login Failed. Login failed for user ...".
    I am able to connect thru ODBC driver using windows authentication.
    Any help on this is highly appreciated.
    Thanks in advance,
    Lakshmi

    Hi Martin,
    Your solution has solved my problem too. Thanks for posting these workaround fixes :-)
    However, there seem to be a problem with datetime fields. The query:
    select getdate()
    returns something like: oracle.datetimestamp.@1aed4
    Is there a way to get around with this? Otherwise, using SQL Developer as a client for SQL Server doesn't serve the right purpose when we cannot access simple date fields :-)

  • Store and retrieve datetime using mysql

    Hi
    Am first timer in JSP and having a problem with datetime field. My requirement is that I have to store the date and time a message is posted in mysql database.
    After the message is posted I have to retrieve the data and display it in a new page including the datetime field.
    Trying this for a long time but not able to get. Any suggestions.
    Thanks,
    Sridhar

    I am using the preparedStatement to insert into the database and retrieve from the database.
    My problem is when i am retreiving from the database datetime are not coming.
    my preparedSTatement looks like this.,
    PreparedStatement insert1ps=con.prepareStatement("insert into topic_category values(?,?,?,?,?,?,?,?,?)");
    insert1ps.setInt(1,topic_id);
    insert1ps.setInt(2,article_id);
    insert1ps.setInt(3,author_id);
    insert1ps.setString(4,heading);
    insert1ps.setString(5,article);
    insert1ps.setDate(6,sqldate);
    insert1ps.setInt(7,archives);
    insert1ps.setInt(8,verify);
    insert1ps.setInt(9,no_views);
    I am using the above statements for inserting into the database.
    PreparedStatement selectaa = con.prepareStatement("select tc.topic_description,tc.datetime,aa.fname,tc.topic_head,aa.lname,tc.no_views from topic_category tc,article_author aa where tc.author_id=aa.author_id and tc.topic_id="+topic_id);
    ResultSet rss=selectaa.executeQuery();
    <td style="{font-family:verdana;font-size:12;color:#03065f}">
    Posted on :<%=rss.getTimestamp(2)%></td>
    And using this statement for retrieving.
    Is there any error in the above

  • Ask about datetime

    Hi I have some problem about datetime. This time I can got date/time local (please see code below). I need to shift(plus) 5 minute how to?
    import java.util.*;
    import java.text.*;
    public class SimpleDateFormatDemo {
    public static void main(String args[]){
          String output;
           SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddhhmm00");
          Date today = new Date(); //get date
          output = formatter.format(today); //set format
          System.out.println(output);
    }output : 20061110105900
    2006-11-10 23:59:00I need to plus 5 minute. from 2006-11-10 23:59:00 to 2006-11-11 00:04:00
    How to do?
    Thank you for help me.

    I can do already. Thank you for help me ^ ^
    import java.util.*;
    import java.text.*;
    public class ShiftDateTime{
    public static void main(String args[]){
          String output;
           SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddhhmm00");
        Date today = new Date(); //get date
          output = formatter.format(today); //set format
          System.out.println(output);
    Calendar cal = new GregorianCalendar();
    cal.setTime(today);
    cal.add(Calendar.MINUTE, 5);
    Date later = cal.getTime();
    output = formatter.format(later); //set format
          System.out.println(output);
    }

  • Changing datetime format to another format in exixting table

    Hi i am using oracle11g version
    here i have one problem
    suppose datetime value which is in string format is 4/13/2012 03:55 PM in table
    now I want to update format to 04/13/2012 15:55 in table

    913672 wrote:
    Hi i am using oracle11g version
    here i have one problem
    suppose datetime value which is in string format is 4/13/2012 03:55 PM in table
    now I want to update format to 04/13/2012 15:55 in tableOk, so let's suppose you have a table and it has a DATE datatype column on it.
    When you're querying your data you see something like this...
    SQL> select dt from mydates;
    DT
    08/08/2012 09:41:51 AM
    08/07/2012 09:41:51 AM
    08/06/2012 09:41:51 AM
    08/05/2012 09:41:51 AM
    08/04/2012 09:41:51 AM
    08/03/2012 09:41:51 AM
    08/02/2012 09:41:51 AM
    08/01/2012 09:41:51 AM
    07/31/2012 09:41:51 AM
    07/30/2012 09:41:51 AM
    10 rows selected.Internally though, the dates are not stored in that format, that's just how they are displayed to you.
    Let's look at the internal format... (we can see a representation of the bytes of data values using the DUMP function)...
    SQL> col dmp format a40
    SQL> select dt, dump(dt) as dmp from mydates;
    DT                     DMP
    08/08/2012 09:41:51 AM Typ=12 Len=7: 120,112,8,8,10,42,52
    08/07/2012 09:41:51 AM Typ=12 Len=7: 120,112,8,7,10,42,52
    08/06/2012 09:41:51 AM Typ=12 Len=7: 120,112,8,6,10,42,52
    08/05/2012 09:41:51 AM Typ=12 Len=7: 120,112,8,5,10,42,52
    08/04/2012 09:41:51 AM Typ=12 Len=7: 120,112,8,4,10,42,52
    08/03/2012 09:41:51 AM Typ=12 Len=7: 120,112,8,3,10,42,52
    08/02/2012 09:41:51 AM Typ=12 Len=7: 120,112,8,2,10,42,52
    08/01/2012 09:41:51 AM Typ=12 Len=7: 120,112,8,1,10,42,52
    07/31/2012 09:41:51 AM Typ=12 Len=7: 120,112,7,31,10,42,52
    07/30/2012 09:41:51 AM Typ=12 Len=7: 120,112,7,30,10,42,52
    10 rows selected.So, what happens if I chance the date format for my session...
    SQL> alter session set nls_date_format = 'MM/DD/YYYY HH24:MI:SS';
    Session altered.
    SQL> select dt, dump(dt) as dmp from mydates;
    DT                  DMP
    08/08/2012 09:41:51 Typ=12 Len=7: 120,112,8,8,10,42,52
    08/07/2012 09:41:51 Typ=12 Len=7: 120,112,8,7,10,42,52
    08/06/2012 09:41:51 Typ=12 Len=7: 120,112,8,6,10,42,52
    08/05/2012 09:41:51 Typ=12 Len=7: 120,112,8,5,10,42,52
    08/04/2012 09:41:51 Typ=12 Len=7: 120,112,8,4,10,42,52
    08/03/2012 09:41:51 Typ=12 Len=7: 120,112,8,3,10,42,52
    08/02/2012 09:41:51 Typ=12 Len=7: 120,112,8,2,10,42,52
    08/01/2012 09:41:51 Typ=12 Len=7: 120,112,8,1,10,42,52
    07/31/2012 09:41:51 Typ=12 Len=7: 120,112,7,31,10,42,52
    07/30/2012 09:41:51 Typ=12 Len=7: 120,112,7,30,10,42,52
    10 rows selected.The dates are now displayed in the format I want, though the internal representation or bytes hasn't changed at all.
    Don't worry about the "format" of how the dates are stored on the database. Just remember that "format" relates to how things are displayed at the front end and can be controlled either through settings like NLS_DATE_FORMAT, or by using functions such as TO_CHAR when you query the data.
    Never consider storing the data in a different datatype than what is most suitable for it i.e. don't store DATE values as VARCHAR2, as this will cause you major problems later on. Store DATEs as DATE or TIMESTAMP datatypes, store numbers as NUMBER (or equivalent numeric datatype), store strings as VARCHAR2 etc.

  • Data Format in Cross Tab and Parameter window about numeric and date

    Hello,
    I got a problem to show Year 2008 as 2,008.00, it's rediculous...
    My PC and Notebook both show "2008",  but my three co-workers' PCs all show "2,008.00"
    the group field is:      CStr(Year({SJ_Inv;1.TaxDate}))+ '  Sales Analysis'
    How to convert such a numeric into text without decimal?  CStr looks not workable.
    also,
    the numeric var in parameter window, sometimes I don't want it to show up comma and decimal, how to format it?
    And, the datetime var in parameter window from store procedure,  can it be a "Date" without Time for user to entry only?
    I will be very appreciate for your helping.
    ~Michelle

    Hi, Raghavendra,
    The reason to use stored procedure is to save server room -- limited data for output; this is why we declare variable in Store procedure, and got problem there -- datetime but not date.
    On the other hand, if we declare variable in Crystal report, it's allowed date type, but how to defaut the Date-from as 1st day of current month, and Date-to as Today in Crystal Report parameter setup ??  And then how to pass the parameter to store procedure to limit the data output volume?
    (I am also trying to get this done in Store procedure right now..)
    The pros and cons exist in Store procedure and Crystal report, which is better is not definite!
    Best regards,

  • DRM patch

    Hi Experts,
    We were looking to apply the following patch:
    Patch 12962660: Patch Set Update: 11.1.2.1.103 to fix login issues in hyperion DRM.
    Can you provide any database schema updates with this? Or specific instructions on how to apply this?

    Hi
    What version do you update?
    I've updated 11.1.2.0. to 11.1.2.1. and all db changes were made by Configuraion Console, but there were some problems with datetime type.
    Best regards

  • NLS_LANG ?? Urgent!!

    Hi all,
    My os is window2000 chinese
    Database 9i with NLS_LANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK
    Developer 9i NLS_LANG has been set SIMPLIFIED CHINESE_CHINA.ZHS16GBK in registry
    I built a 9i form.When I insert a serial of item values
    it always give me error ORA-01401:Inserted value is too large for column
    After I changed the 9i Form NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1,I can insert record and commit form,But lov retrieved value are wrong like '???'(they are chinese).
    I am really eager to know how to fix NLS_lang set and Ora 01401.Thank you so much!!!

    hi ,Shay Shmeltzer
    Thank you for your response!!
    I tried to insert simple value like '99' on the feild which is need to be inserted chinese value.It didn't work.
    By the way,I doubt it is problem on datetime feilds.
    I set the user_datetime_format 'yyyy-mm-dd HH24:MI'using set_application_property in pre_form trigger ,I monitored the datetime feild value is '2003-02-01 09.00',It looks not a problem,right?but I can't continue further!!ORA-01401!!!
    So,I suppose that is a probelm of NLS_LANG setting!!
    Plz help me

  • Mapping problem with xs:dateTime

    Hi there,
    I am trying to set up a demo project for training purposes illustrating the implementation of composite services using third party and ECC services. For the third party portion of it, I am using the Fedex web services.
    After importing the remote services, I defined my custom complex datatypes for the application services and mapped the lean app service interface to the broad remote service interface. The missing mandatory data fields of the remote service I stored as fixed values within the mapping itself. so far so good.
    The problem appeared with a time stamp field (xs:dateTime). When storing a value like "2009-08-19T22:00:00+0100", the resulting code in the constants file (<ServiceName>_<OperationName>_In_Constant.java) looks like this:
    javax.xml.datatype.XMLGregorianCalendar ShipTimestamp = RequestedShipment.getShipTimestamp();
    if ( ShipTimestamp == null ){
           ShipTimestamp = "2009-08-19T22:00:00+0100";
           RequestedShipment.setShipTimestamp(ShipTimestamp);
    Obviously, this got to fail as there is a type mismatch (String vs. XMLGregorianCalendar).
    After this, I tried to use the proper java expression as the default value in the mapping
    ........javax.xml.datatype.DatatypeFactory.newInstance().newXMLGregorianCalendar("2009-08-19T22:00:00+0100")
    As expected, the expression is copied into the code 1:1, but after that, the compiler complains that there is an unhandled exception (DatatypeConfigurationException).
    One solution would obviously be to put the timestamp into the signature of my application service operation, but I would consider this an unnecessary workaround.
    any ideas ?
    Nick

    I actually did find the solution although a very messy one. If I use the following snippet as the default value
    ........com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl.parse("2009-08-19T22:00:00+0100")
    the generated code compiles without error. Nevertheless, not very nice. hope there is an alternative way of doing that.
    Nick

  • Obiee 11g problem with dimension time DATETIME

    Hi experts!
    I have a problem with a column of my time dimension. In my database I have a column called "DATE" and it has this format "01/12/2009 00:00:00" (property column is DATETIME) when I import this table in Oracle Administration I see the same format that my database but I want to see without any Hours,minutes...like this: "01/12/2009"
    How can I fix this??
    Thanks!!!

    Hi alex,
    check the column name your passing and then cast it....the error is not related to that i suppose as it is internal assertion.
    chk this http://tipsonobiee.blogspot.com/2009/06/error-nqserror-46036-internal-assertion.html
    UPDATED POST
    You can alternatively use oracle trunc function in the physical layer to trunc the timestamp.
    1) go to the table where the date column is coming in physical layer
    2) go to the general properties and select SQL and write the SQL of all the columns needed from that table like
    select x,y,z,trunc(date) from table_name.
    3) this truncates the timestamp
    UPDATED POST-2
    By the way which database are you using,if its oracle trunc works out....other databases it wont work
    select trunc(sysdate) from dual in your TOAD and check out.
    hope helps you,
    Cheers,
    KK
    Edited by: Kranthi.K on Jul 27, 2011 3:15 AM
    Edited by: Kranthi.K on Jul 27, 2011 4:01 AM

  • Problem with hours-from-dateTime in a predicate

    I'm seeing strange behavior trying to perform queries using the hours-from-dateTime function. It seems like it is invalid to use it in a comparison but you can use it other places. Is there a way around this?
    dbxml> query '
    declare namespace fn="http://www.w3.org/2005/xpath-functions";
    for $x in collection("audit2009.dbxml")//event
    let $y := fn:hours-from-dateTime(fn:data($x/@timestamp))
    where $x/@id=10000
    return $y'
    1 objects returned for eager expression '
    declare namespace fn="http://www.w3.org/2005/xpath-functions";
    for $x in collection("audit2009.dbxml")//event
    let $y := fn:hours-from-dateTime(fn:data($x/@timestamp))
    where $x/@id=10000
    return $y'
    dbxml> print
    22
    dbxml> query '
    declare namespace fn="http://www.w3.org/2005/xpath-functions";
    for $x in collection("audit2009.dbxml")//event
    let $y := fn:hours-from-dateTime(fn:data($x/@timestamp))
    where $y=22
    return $y'
    stdin:262: query failed, Error: Invalid lexical value [err:FORG0001], <query>:4:15
    let $y := fn:hours-from-dateTime(fn:data($x/@timestamp))
    ^
    dbxml> query '
    declare namespace fn="http://www.w3.org/2005/xpath-functions";
    collection("audit2009.dbxml")//event\[fn:hours-from-dateTime(fn:data(@timestamp)) = 20]'
    stdin:265: query failed, Error: Invalid lexical value [err:FORG0001], <query>:3:42
    collection("audit2009.dbxml")//event\[fn:hours-from-dateTime(fn:data(@timestamp)) = 20]
    ^
    dbxml>
    Edited by: user12302021 on Dec 2, 2009 1:26 PM

    I solved the problem. After reinstalling Oracle 10g Client everything is fine.

Maybe you are looking for