R/3 Date Conversion problem

How to convert the R/3 Date to Array.

If you are receiving a date field from R/3, please use <b>SimpleDateFormat</b>(class) to re-arrange your date in any fashion. Along with the method <b>format</b> you can just have your date in any format :
DD-MM-YYYY
MM-DD-YY
DD-MMMMM-YYYY (Month will be spelled out as text)
All you need to do is :
SimpleDateFormat sf = new SimpleDateFormat("DD/MM/YYYY");
sf.format(myDateField);
Since R/3 date conversion is usually for this reason, I mentioned the above class.
Regards,
Subramanian V.

Similar Messages

  • Char to Date conversion problem - again!

    Hi,
    in order to make date selection 'more attractive' for end users I have been tasked with presenting a text field with 'January 2010', 'February 2010' etc to the end users for their prompts.
    So far so easy...
    However, I then need to use the values to derive either dates, or years, or date numbers.
    This all works fine during development when I am testing using a default parameter thus; -
    '@{MYMONTHYEAR}{September 2010}' - which is fed into various very complex functions.
    BUT - when I try to use the report in conjunction with the parameter I get; -
    'The evaluation of the index 6 expression on row count -1 failed. [nQSError: 46046] Datetime value 2010/09/01 does not match the specifiied format'
    However, cast('2010/09/01' as date) works fine... and convoluted as the logic of my functions is, the fundamental char to date conversion is exactly in this format.
    Anyone shed any light on this, give me a guaranteed way to handle char to date conversion?
    thanks,
    Robert.

    Hi,
    I tried your workaround case when 1=2... but I still get the same error....
    Not when I have the format from my default value, but when I get the value from a dashboard prompt in a page.
    The full error is; -
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 46046] Datetime value 2012/09/01 does not match the specified format. (HY000)
    SQL Issued: SELECT s_0, s_1, s_2, s_3, s_4, s_5, s_6, s_7, s_8, s_9, s_10, s_11, s_12, s_13, s_14, s_15, s_16, s_17, s_18, s_19, s_20, s_21, s_22, s_23, s_24, s_25, s_26, s_27, s_28, s_29, s_30, s_31, s_32, s_33, s_34, s_35, s_36, s_37, s_38, s_39, s_40, s_41, s_42, s_43, s_44, s_45, s_46, s_47, s_48, s_49, s_50, s_51, s_52, s_53, s_54, s_55, s_56, s_57 FROM ( SELECT 0 s_0, "Vivaldi Detail"."Product Global Hierarchy"."Tobacco Category Groups" s_1, "Vivaldi Detail"."Product Global Hierarchy"."Tobacco Category" s_2, "Vivaldi Detail"."Product Global Hierarchy"."Total Tobacco Products" s_3, FILTER("Vivaldi Detail"."Fact Sales Detail"."SOM %" USING ("Vivaldi Detail"."Time"."Year" =cast((cast(right('September 2012',4) as integer)-1) as char(4)))) s_4, FILTER("Vivaldi Detail"."Fact Sales Detail"."SOM %" USING ("Vivaldi Detail"."Time"."Year" =cast((cast(right('September 2012',4) as integer)-2) as char(4)))) s_5, FILTER("Vivaldi Detail"."Fact Sales Detail"."SOM %" USING ("Vivaldi Detail"."Time"."Year" =cast((cast(right('September 2012',4) as integer)-3) as char(4)))) s_6, FILTER(FILTER("Vivaldi Detail"."Fact Sales Detail"."SOM %" USING ("Vivaldi Detail"."Time"."Year" =cast((cast(right('September 2012',4) as integer)-1) as char))) USING "Vivaldi Detail"."Time"."Month Number" <=month(CASE WHEN 1=2 THEN CURRENT_DATE ELSE cast(right('September 2012',4)||'/'||CASE left('September 2012',LOCATE(' ','September 2012')-1) WHEN 'January' THEN '01/01' WHEN 'February' then '02/01' when 'March' then '03/01' when 'April' then '04/01' when 'May' then '05/01' when 'June' then '06/01' when 'July' then '07/01' when 'August' then '08/01' when 'September' then '09/01' when 'October' then '10/01' when 'November' then '11/01' ELSE '12/01' END as date)END)) s_7, FILTER(FILTER("Vivaldi Detail"."Fact Sales Detail"."SOM %" USING ("Vivaldi Detail"."Time"."Year" =right('September 2012',4))) USING "Vivaldi Detail"."Time"."Month Number" <=month(CASE WHEN 1=2 THEN CURRENT_DATE ELSE cast(right('September 2012',4)||'/'||CASE left('September 2012',LOCATE(' ','September 2012')-1) WHEN 'January' THEN '01/01' WHEN 'February' then '02/01' when A brief sample of a typical formula which causes this is; -
    FILTER(FILTER(FILTER("Fact Sales Detail"."SOM %" USING ("Time"."Year" =   right('@{MYEAR}{September 2010}',4))) USING ("Time"."Month Number" = 2)) USING "Time"."Month Number" <= month(CASE WHEN 1=2 THEN CURRENT_DATE ELSE cast(right('@{MYEAR}{September 2010}',4)||'/'||CASE left('@{MYEAR}{September 2010}',  LOCATE(' ','@{MYEAR}{September 2010}') -1) WHEN 'January' THEN '01/01'  WHEN 'February' then '02/01' when 'March' then '03/01' when 'April' then '04/01' when 'May' then '05/01' when 'June' then '06/01' when 'July' then '07/01' when 'August' then '08/01' when 'September' then '09/01' when 'October' then '10/01' when 'November' then '11/01' ELSE '12/01' END as date)  END    ))The September 2010 default being EXACTLY what is selected from the dashboard prompt when testing. It does not error, but returns no data in isolation, but when when from the prompt it errors...
    And the date format, if fed into a cast ('2012/09/01' as date) does not error.
    Anyone help - this is really driving me mad, syntax is good - it should work!!!
    thanks,
    Robert.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Date conversion problem.

    I use 2 adaptive RFC function with a r3 backend system:
    1- Search
    2- Update
    The first works fine, I show the data, one of the fields is a date (with r3 Date format) binded and in the web dynpro is showed in inputfield, with a little calendar icon on the right.
    I have problem with the second one. Cause I use the same inputfield for both RFC. I bind in design time with the Search RFC and for the update I pass the changed values to the 2nd RFC trought coding.
    What I want is just to save in a Variable, the value of the binded UI element, with the string type I have no problem, but when I wanna save my date field in a String It say that the conversion cannot be done.
    <u>EXAMPLE:</u>
    String value1 = wdContext.currentTable_CelElement().getNumcel();
    I wanna accomplish that example but With Date format. So the question would be How can I save in a Variable a Date format field of R3.
    <b>"?"  </b>value2 = wdContext.currentTable_CelElement().getFecha();
    Thx

    Hi!
    I think that this problem occurs because of different Date formats in your Web Dynpro Application: The R/3-Date format is mapped to java.sql.Date, and for your variable you probably use java.util.Date.
    If so, try to use the sql.Date for your variable, too, or make a conversion like this:
    java.util.Date myDate = new java.util.Date(wdContext.currentTable_CelElement().getFecha().getTime());
    Regards,
    Thomas

  • XML Data Conversion Problem

    Hi,
    Am facing problem in flex that using web services am getting the data in xml format (below provided) am not able to provide the data from xml to datagrid. Am getting the data in datagridcolumn with the tag also. I need only data to be displayed without the child tag in the datagrid.
    XML Format output as below:
    <UDSObjectList>
    <UDSObject>
    <Handle>cr:400503</Handle>
    <Attributes>
    <Attribute DataType="2005">
    <AttrName>ref_num</AttrName>
    <AttrValue>671</AttrValue>
    </Attribute>
    <Attribute DataType="2005">
    <AttrName>impact</AttrName>
    <AttrValue>5</AttrValue>
    </Attribute>
    <Attribute DataType="2005">
    <AttrName>priority</AttrName>
    <AttrValue>1</AttrValue>
    </Attribute>
    </Attributes>
    </UDSObject>
    </UDSObjectList>
    Attached the screenshot of output for your reference. The screenshot showing the datawith tag and here is other problem is for request id and impact and priority columns showing three columns data in all the columns.
    Actual data is as below:
    Request Id is 671
    Impact is 5
    Priority is 1
    but the data is shown in all the columns not shown in related columns.
    Thanks in advance..........

    Can anyone provide a solution. As this problem was facing since long time.
    Thanks

  • String to date conversion problem

    Hai braniees,
    i am new to java.I have a problem in converting string to date.my code is this
    dob="2/05/2005";
    SimpleDateFormat sf=new SimpleDateFormat("dd/MM/yyyy");
         Date dt=sf.parse(dob);
    i this i am getting the error in the last line.the error is
    " Unhandled exception type ParseException"
    I am not able to getrid of this.
    Thanks
    anieshuk

    I would advise against doing what ranjithcp suggested unless you are such a perfect programmer that you'll never get invalid data into your methods. Also what ranjithcp has failed to mention is that you'll have to put the throws instruction all over your code right up to your main method otherwise your just moving your error message up through your program.
    You should always try and handle checked exceptions not throw them.

  • MS SQL Server 2005 Data Conversion Problem

    Hello all,
    I'm using the Microsoft JDBC Driver with SQL Server 2005 and getting an exception from the database server indicating that it is attempting to convert an nvarchar to an int (SQL Error 8114). This is the stack trace and code. I've exhausted all my resources... anybody have an idea?
    com.microsoft.sqlserver.jdbc.SQLServerException: Error converting data type nvarchar to int.
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
    at com.microsoft.sqlserver.jdbc.IOBuffer.processPackets(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.getPrepExecResponse(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement (Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PreparedStatementExecutionRequest.executeStatement(Unknown Source)
    at com.microsoft.sqlserver.jdbc.CancelableRequest.execute(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeRequest(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.execute(Unknown Source)
    at com.boeing.ict.workmonitor.swing.JMainFrame$33.insertIntoDB (JMainFrame.java:986)
    at com.boeing.ict.workmonitor.utils.SafeUDPWorker.respond(SafeUDPWorker.java:65)
    at com.boeing.ict.workmonitor.utils.SafeNetWorker.runWork(SafeNetWorker.java:113)
    at com.boeing.ict.workmonitor.utils.SafeNetWorker.access$000 (SafeNetWorker.java:21)
    at com.boeing.ict.workmonitor.utils.SafeNetWorker$1.run(SafeNetWorker.java:59)
    at java.lang.Thread.run(Unknown Source)
        private void listenToCOTMessages() {
            // the listener has not started yet.
            if (cotMessageWorker == null) {
                cotMessageWorker = new SafeUDPWorker() {
                    public void insertIntoDB(Iterator<NameValuePair> nvPairs) {
                        try {
                            int numParameters = 0;
                            if (isDebugMode()) {
                                System.err.println("Entered insertIntoDB");
                            while (nvPairs.hasNext()) {
                                NameValuePair pair = nvPairs.next();
                                // Aircraft callsign
                                if (pair.getName().equalsIgnoreCase("callsign")) {
                                    cotStatement.setString(1, pair.getValue());
                                    // debug code
                                    System.err.println("{1} " + pair.getValue());
                                    cotStatement.setString(2, pair.getValue());
                                    // debug code
                                    System.err.println("{2} " + pair.getValue());
                                    numParameters++;
                                    if (numParameters > 7)
                                        break;
                                // Aircraft altitude (meters)
                                else if (pair.getName().equalsIgnoreCase("hae")) {
                                    int height = Integer.parseInt(pair.getValue());
                                    height = (int)((height * 39.37) / 12);
                                    cotStatement.setInt(3, height);
                                    // debug code
                                    System.err.println("{3} " + height);
                                    numParameters++;
                                    if (numParameters > 7)
                                        break;
                                // aircraft latitude N/S (+/-)
                                else if (pair.getName().equalsIgnoreCase("lat")) {
                                    String rawLatitude = pair.getValue();
                                    // we have a south latitude
                                    if (rawLatitude.charAt(0) == '-') {
                                        // we need to append an " S"
                                    } else {
                                        rawLatitude = rawLatitude.substring(1) + " S";
                                    cotStatement.setString (4, rawLatitude);
                                    System.err.println("{4} " + rawLatitude);
                                    numParameters++;
                                    if (numParameters > 7)
                                        break;
                                // aircraft longitude E/W (+/-)
                                else if (pair.getName ().equalsIgnoreCase("lon")) {
                                    String rawLongitude = pair.getValue();
                                    // we have a west longitude
                                    if (rawLongitude.charAt (0) == '-') {
                                        rawLongitude = rawLongitude.substring(1) + " W";
                                    cotStatement.setString(5, rawLongitude);
                                    // debug code
                                    System.err.println("{5}" + rawLongitude);
                                    numParameters++;
                                    if (numParameters > 7)
                                        break;
                                // aircraft course
                                else if (pair.getName().equalsIgnoreCase("course")) {
                                    cotStatement.setString(6, pair.getValue());
                                    // debug code
                                    System.err.println("{6} " + pair.getValue());
                                    numParameters++;
                                    if (numParameters > 7)
                                        break;
                                // we have a speed number
                                else if (pair.getName ().equalsIgnoreCase("speed")) {
                                    cotStatement.setInt(7, Integer.parseInt(pair.getValue()));
                                    System.err.println("{7} " + pair.getValue ());
                                    numParameters++;
                                    if (numParameters > 7)
                                        break;
                                else {
                                    continue;
                            // execute the callable statement
                            cotStatement.execute();
                        } catch (SQLException ex) {
                            ex.printStackTrace();
                            // statusPanel.getStatusTextArea().append( ex.getMessage());
                // set the debugging mode
                cotMessageWorker.setDebugMode(debugMode);
                // set the output area for the worker
                cotMessageWorker.setMessageArea(cotTextArea);
                String portField = cotPortTextField.getText();
                // get the port setting from the portTextField
                if (portField.length() != 0) {
                    try {
                        cotMessageWorker.setPort(Integer.parseInt(portField));
                    } catch (NumberFormatException nfe) {
                        cotPortTextField.setBackground(Color.RED);
                cotMessageWorker.setStatusArea(statusPanel.getStatusTextArea());
                // set the java.sql.Statement object to do the data insertion
                if (cotStatement != null)
                    cotMessageWorker.setSqlStatement(cotStatement);
                cotMessageWorker.start();
            } else { // the listener has started
                // there are no errors generated for making multiple resume requests
                cotMessageWorker.resumeRequest();
        }

    Ideas? Not really, there's nothing wrong-looking about your code, but maybe I could ask some dumb questions.
    Has this code never worked, or does it usually work but occasionally this error occurs? Have you just switched to SQL Server 2005 from 2000 and the error started happening?
    Does the table you are inserting to only have those 7 columns, or are there others that are getting default values? Does it contain auto-generated identity columns? Are you sure you're using the right table in the right database?

  • Phillips date conversion problems

    Hi chaps,
    I am trying to convert a CHAR7 field from a phillips date, into an Oracle date format. The following expression does not work:
    SELECT TO_DATE('2006214', 'YYYYWWD') FROM dual
    (gives error "ORA-01820: format code cannot appear in date input format")
    However, if I try to convert the system date the other way to this format, it works:
    SELECT TO_CHAR(sysdate, 'YYYYWWD') FROM dual
    I am obviously missing something obvious!!? Does anyone have any ideas?
    thanks in advance
    Mike

    Yep I had a couple of bugs, last substr should have been 7 not 6, also week 1, day 1 should be Jan 1st (I think) so I had to remove a week and a day from each.
    Now I get
    SQL> exec :d := '2006214'
    PL/SQL procedure successfully completed.
    SQL> select trunc(to_date(substr(:d,1,4),'yyyy'),'y')
      2      + (to_number(substr(:d,5,2)) * 7) - 7
      3      + to_number(substr(:d,7)) - 1
      4  from dual;
    TRUNC(TO_D
    05-24-2006
    SQL> exec :d := '2006011'
    PL/SQL procedure successfully completed.
    SQL> /
    TRUNC(TO_D
    01-01-2006
    SQL> exec :d := '2006021'
    PL/SQL procedure successfully completed.
    SQL> /
    TRUNC(TO_D
    01-08-2006
    SQL>

  • Problem with the date conversion

    Hi Friends,
    i am facing the problem with the date conversion,  Actuall my requirement is to pass the date to the screen based on the user setting roles(SU01).
    I have fetched the user setting date format by using the funciton module SUSR_GET_USER_DEFAULTS, The function module picks the exact user date setting (Like as MM/DD/YYYY, MM.DD.YYYY, DD.MM.YY).
    After that i have implemented the FORMAT_DATE_4_OUTPUT funciton module for converting of the user role setting date format into system  date format.
    for the english language case the funciton module FORMAT_DATE_4_OUTPUT works fine but the funciton module not supported for other languages
    Can you please provide the Function Moudle for user setting date conversion.
    The funciton module is most important for us,
    Thanks
    Charan
    Moderator message: date conversion questions = FAQ, please search before posting.
    Edited by: Thomas Zloch on Dec 21, 2010 2:19 PM

    Hope this logic helps you.
    DATA LF_DATE    TYPE DATS VALUE '21122010'. " 21-dec-2010
    DATA LF_DATE_BI(10).
    WRITE LF_DATE TO LF_DATE_BI.  "Now LF_DATE_BI contains the date in user format
    "Now populate the value LF_DATE_BI to the screen field

  • Character integrity issue after data conversion in database/JDBC

    Hi
    I am using oracle 9i with the following NLS setting:
    NLS_LANGUAGE :AMERICANS
    NLS_CHARACTERSET : UTF8
    NLS_NCHAR_CHARACTERSET :AL16UTF16
    I am running on Linux with this as my environment Language:
    Lang: en_US.UTF8
    I am sending hindi characters in XML file (UTF-8 encoding) to my java application to be stored in the database. In my xml file, I give this encoding (ignore the double quotes, reason for putting in the quotes so that the browser will not interpret it)
    "&#x928";"&#x92E";"&#x938";"&#x94D";"&#x924";"&#x947"
    But the characters appeared unreadable in the database. When I use Select DUMP to check the characters encoding:
    Typ=1 Len=12 CharacterSet=UTF8: 0,28,0,2e,0,38,0,4d,0,24,0,47
    When I retrieve data from the database via my application, the weird characters will appear.
    However, if i manually input the hindi characters into the column of the table, then the Hindi characters appear correctly. When I do a DUMP to check, this is what I get:
    Typ=1 Len=12 CharacterSet=UTF8: 9,28,9,2e,9,38,9,4d,9,24,9,47
    When I check the unicode chart here http://www.unicode.org/charts/PDF/U0900.pdf, the second DUMP result is correct. When I retrieve data from the database via my application, the correct hindi string appear.
    I understand that in Java the encoding is in UTF-16 and Oracle JDBC will convert from UTF-16 to UTF-8 before storing in my database and vice versa. The thing that puzzles me is why correct hindi string appears on my web interface when that the same conversion is used to extract the data from the database. At first I suspect it is the conversion problem in JDBC when the UTF-16 characters get truncated to UTF-8 when I try to store the data to database. But when good data is stored in the database, the extraction seems to be correct albeit that it is going through the same conversion.
    I read from several threads of this forum and also the Oracle Globalization Support article but I cannot find an answer to my question.
    Can anyone help? Thanks.
    Edited by: user13085722 on May 10, 2010 1:12 AM
    Edited by: user13085722 on May 10, 2010 1:16 AM

    A couple of checkpoints for you:
    1. When you load the XML from SXMB_MONI in the test tab of message mapping it turns red..this means the constructed XML (from CC content conversion) doesnt match the one (XSD) defined in your ESR/IR. In this case you have to check again thoroughly the file content conversion fields values/field length in the sender Communication chaneel.
    2. Once you rectify the error above then you can test the mapping in ESR message mapping.

  • Data Conversion rules for EDI processing (same client IDOC processing)

    Hi,
    I am trying to post IDOCS in same client.Its a PO->SO process.
    ie. there will be 1 outbound and inbound idoc in same client using EDI processing.
    I am using Data Conversion using Rulesfor converting sender fields.
    The LIFNR and PAORG od segment E1EDKA1 has to be converted.
    For ALE processing, the Data conversion is been done correctly.
    But no conversion is done for EDI.
    Can anybody help me with this problem ?
    Thanks in advance.
    Regards
    Megha

    Issue solved

  • Data conversion is necessary at field level

    Hi everybody.
    Im a BW consultant in a BCS project, and I had to make a change in a objetct that is used in BCS as a custom attribute.
    What I made, is to remove the ALPHA routine in the object.
    Later, the BCS consultant generetad the data basis again, and now when enter the UCWB a warning is showed, the message below:
    But I dont know how to do the procedure showed in the message, does anyone face with the same problem? Any suggestion? 
    Best Regards,
    Thiago
    Field /BIC/ZC_EMPBPM: Data conversion is necessary
    Message no. UGMD418
    Diagnosis
    Following a change to the definition of field /BIC/ZC_EMPBPM it is necessary to convert the old data for this field before the new attributes can be activated. This arises, for example, when the following attributes have been changed:
    Conversion exit
    Version or time dependency of hierarchies
    System Response
    You cannot start the application. A data conversion is necessary first.
    Procedure
    Execute the necessary data conversion at the field level. To do this, press the respective button with the  symbol in the hierarchical detail display at the level of field /BIC/ZC_EMPBPM. If necessary, the system will prompt you for more information in a separate dialog box.
    Regards!
    Edited by: Thiago  França Carvalho Silveira on Jun 10, 2010 11:13 PM

    Hi,
    I quess the following should help.
    Execute UCWB01 t-code, goto your data basis, in the tabstrip for assigning roles drag and drop any characteristic, then save. The system will find the change and check and regenerate data structures (that's what you need).
    Then either in UCWB or UCWB02 t-code got your ConsArea and regenerate it.

  • Data Conversion issue

    Hello I'm new to Oracle DB and still learn SQL.
    I have a problem with data conversion in a CASE expression.
    Example:
    select ... ,     
    CASE column WHEN 1 THEN
    select max(column)
    from table
    where ...
    ELSE 0 END AS value,
    from     ...
    where ...
    order by ...
    What I'm basically intend to do is to select a value from another table depending on the value of
    a special column.
    The problem now is that the
    select max(column)
    from table
    where ...
    statement in its original form selects the right value as float (e.g. 0.24)which I need.
    But the same statement embedded in the CASE expression returns (e.g. 0 ) which seems to be the same result converted to an integer or something.
    I tried to convert the result in the CASE expression but without success.
    Does anybody know what could cause this behavior and how to fix it ?
    Thanks for any help with this.

    Welcome to the forum!
    Whenever you have a problem, post a complete script that people can run to re-create the problem. Include CREATE TABLE and INSERT statements for a little sample data if necessary. (A lot of folks show the problem using commonly available tables, such as those in the scott or hr schemas, so they don't have to post any sample data.)
    if your problem involves an error message, post the complete error message you're getting, including line numbers.
    Always say which version of Oracle you're using, e.g. 10.2.0.1.0.
    Sorry, I can't re-create the problem.
    I did something as similar as I could to what you posted:
    SELECT       deptno
    ,       CASE deptno
              WHEN  10
              THEN  (
                   SELECT  MAX (sal)
                   FROM     scott.emp
                   WHERE     deptno     = d.deptno
              ELSE  0
           END          AS value
    ,       dname
    FROM       scott.dept     d
    WHERE       deptno     <= 30
    ORDER BY  deptno
    ;And it ran, producing this output:
    `   DEPTNO      VALUE DNAME
            10       5000 ACCOUNTING
            20          0 RESEARCH
            30          0 SALES
    886562 wrote:Hello I'm new to Oracle DB and still learn SQL.I've been using Oracle for 20 years, and still learn SQL.
    select ... ,     
    CASE column WHEN 1 THEN
    select max(column)
    from table
    where ...
    ELSE 0 END AS value,
    The problem now is that the
    select max(column)
    from table
    where ...
    statement in its original form selects the right value as float (e.g. 0.24)which I need.
    But the same statement embedded in the CASE expression returns (e.g. 0 ) which seems to be the same result converted to an integer or something.Are you sure that 0 is being returned by the sub-query in the THEN clause, and not by the ELSE clause?
    I tried to convert the result in the CASE expression but without success.What did you try? Post your code.
    What problem did you have? Post the error message.
    Edited by: Frank Kulash on Sep 21, 2011 6:15 AM

  • Date Format problem...

    Hi users,
    Forte version : 2.e.2 and ForteWebSDK
    Datacase : Oracle
    We have a problem with a simple HTML text field which acccepts
    a date. When we try to update the record with some date, the following
    exception occurs:
    24-Jun-1998 04:32:28 : XV01086 : Execute failed for SQL statement in
    project Rap
    tServices, class RaptSqlMethods, method updateActivity, methodId 104,
    line 51, e
    rror from database is:
    ORA-01830: date format picture ends before converting entire input
    string
    The Oracle manual says that the above exception occurs when there are
    some extra characters on that field, which is not the case. In fact,
    we raise our own exception for the cases like : o1-Apr-1997,
    01-apr-97 etc. The correct format is 01-apr-1998.
    Same date soemtimes is added to the database successfully. Waht I mean
    to say that the exception deos not occur consistently.
    We just conevert the String taken from the HTML field into a Forte
    DateTimeData Object and send it to database. May be, the conversion
    part is causing the problem. But, once again the problem is not
    consistent.
    Any ideas in this will be appreciated.
    Thanx in advance
    -Rajeev Talwar
    Get Your Private, Free Email at http://www.hotmail.com
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    We had the same problem when our application first went live. The
    default date format for our Oracle database is 'dd-mmm-yy' without the
    time component. The default format for datatype DateTimeData is
    'dd-mmm-yyyy hh:mm:ss'. Since we did not want to change the default date
    format for the Database, we included in our service partitions an Alter
    Session statement to change the NLS_Date_format attribute in Oracle to
    conform to the Forte DateTimeData format. It worked.
    Kam Chow
    Mazda Australia
    -----Original Message-----
    From: Gary F Giger [mailto:[email protected]]
    Sent: Thursday, June 25, 1998 4:11 AM
    To: Rajeev Talwar
    Cc: [email protected]
    Subject: Re: Date Format problem...
    I was having the same problem a few weeks back when I would
    read/write
    dates to Oracle. I was using objects of type DateTimeData and I would
    occasionally get errors like you said you were. I found discovered my
    problem. Sometimes I would process a null date and would get an error.
    So to
    resolve this issue, I simply changes my objects of type DateTimeData to
    type
    DateTimeNullable. This enabled my Forte Application to handle regular
    dates
    as well as null dates. I have not gotten any oracle errors since then
    with
    regards to dates. Hope this helps.
    Rajeev Talwar wrote:
    Hi users,
    Forte version : 2.e.2 and ForteWebSDK
    Datacase : Oracle
    We have a problem with a simple HTML text field which acccepts
    a date. When we try to update the record with some date, the following
    exception occurs:
    24-Jun-1998 04:32:28 : XV01086 : Execute failed for SQL statement in
    project Rap
    tServices, class RaptSqlMethods, method updateActivity, methodId 104,
    line 51, e
    rror from database is:
    ORA-01830: date format picture ends before converting entire input
    string
    The Oracle manual says that the above exception occurs when there are
    some extra characters on that field, which is not the case. In fact,
    we raise our own exception for the cases like : o1-Apr-1997,
    01-apr-97 etc. The correct format is 01-apr-1998.
    Same date soemtimes is added to the database successfully. Waht I mean
    to say that the exception deos not occur consistently.
    We just conevert the String taken from the HTML field into a Forte
    DateTimeData Object and send it to database. May be, the conversion
    part is causing the problem. But, once again the problem is not
    consistent.
    Any ideas in this will be appreciated.
    Thanx in advance
    -Rajeev Talwar
    Get Your Private, Free Email at http://www.hotmail.com
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive<URL:http://pinehurst.sageit.com/listarchive/>
    Gary Giger
    Raytheon Systems Company
    300 Science Park Road
    State College, PA. 16804
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>
    This message has successfully passed virus checking.
    Mazda Australia takes every precaution to ensure email messages are virus free. For complete protection, you should virus test this message.
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

  • Date conversion logic using function modules

    Hi there,
    I have been researching in the forum how data conversion is done in ABAP and I found out about the function modules
    CONVERSION_EXIT_LDATE_OUTPUT
    and
    MONTH_NAMES_GET
    It seems that the first function module can convert the date format 06/08/2011 to MONTH DD,YYYY and the second function can easily translate the month names once language SPRAS has been specified.
    Problem is I am not sure how I can convert my VBRK-FKDAT with format MM/DD/YYYY into the format DD MONTH YYYY format with the MONTH still dependent on the specified language.
    I tried to look at how to MONTH_NAMES_GET FM works and made this code:
    DATA: d_return like sy-subrc,
          itab_T247 like T247 occurs 0 with header line,
          gs_spras type spras.
    gs_spras = 'RU'.
    CALL FUNCTION 'MONTH_NAMES_GET'
    EXPORTING
       LANGUAGE                    = gs_spras
    IMPORTING
       RETURN_CODE                 = d_return
      TABLES
        MONTH_NAMES                 = itab_T247
    EXCEPTIONS
       MONTH_NAMES_NOT_FOUND       = 1
       OTHERS                      = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Loop at itab_t247.
    Write:/ itab_t247-LTX.
    endloop.
    The code just lists the months in Russian (which is the language I need). I am just new to ABAP so I am an avid reader of the forum. I hope someone can help.
    Thanks,
    dgrachee

    Hi Dgrachee ;
    You can change it as follows.
    Best Regards.
    gs_spras = sy-langu. "'RU'.
    CALL FUNCTION 'MONTH_NAMES_GET'

  • Oracle to Mysql character set conversion problem!!! PLZ IGNORE

    Hi Experts,
    I have created a database link from Oracle 10g to Mysql 5.
    I have installed Oracle Gateway 11g for this purpose.
    When i retreive the data from sql plus the text is displayed as question marks.
    Oracle 10g Database character set is WE8MSWIN1252
    Mysql character set --->latin1
    Character set of ODBC connector for mysql is  latin7
    Character set in the parameter file of HS folder is WE8MSWIN1252When i retrieve data from sql developer the text is fine(as i think it directly takes the character set of target) but
    when i login from sqlplus i get question marks!
    I have another post in Heterogeneous Connectivity forum
    Re: Oracle to Mysql character set conversion problem!!! PLZ HELP
    Kindly update your comments there,
    @@@@@@@@@@@@@@2
    Appreciate your help,
    regards
    Edited by: user10243788 on Apr 21, 2010 3:25 AM

    It is OK to post a globalization-related question in this forum in addition to the forum pertaining to the main technology. Not all experts follow all possible forums on OTN. Of course, you should cross-link the posts to let people merge the answers.
    Regarding the problem itself, make sure that SQL*Plus has the right NLS_LANG setting in the environment. On Windows, in the Command Prompt:
    C:\> set NLS_LANG=.WE8PC850
    C:\> sqlplus ...On Unix:
    $ setenv NLS_LANG .WE8ISO8859P1   (or NLS_LANG=.WE8ISO8859P1; export NLS_LANG)
    $ sqlplus ...-- Sergiusz

Maybe you are looking for