Converting number from 0 to 1

Hi,
Iam generating a query in which the following fields are used:
date1, date2 of data type character. I am calculating the difference between two dates and applying sum function. query is as follows
select sum(translate((To_Date((date2),'yyyymmdd') - To_date((date1),'yyyymmdd')),0,1)) from disdate
problem 1:- if dont use translate when date1 and date2 are equal it is giving value 0 so i used translate to convert 0 to 1 and apply sum function over the result. But it is converting even the number 10 to 11.
Can any one suggest me a solution?
thankyou
satyanag

I've found in the past that if you want to calculate the period of time for something then you want to add 1 onto your calculation.
for example:
with t as (select sysdate as fromdate, sysdate as todate from dual
          union all select sysdate-1, sysdate from dual)
select todate - fromdate from t         
0
1let's say we're talking about policies. the first record has a duration of one day (starts and ends on the same day) so you should add 1 to the calculation
the second one is quite obviously 2 days in duration so you should add 1 to make it reflect the true state of afairs:
with t as (select sysdate as fromdate, sysdate as todate from dual
          union all select sysdate-1, sysdate from dual)
select todate - fromdate + 1 from t      
1
2

Similar Messages

  • Classifier mapping to read Sender & Receiver  Identification Number from XML. How to handle in B2B Add on

    In current See burger tool, We have this functionality to read Sender and Receiver Identification number from the XML. Is there any way in b2b add on to do this.

    Hi,
    The classifier within the Seeburger context is being used to call your parent mapping, in case you want to dynamically determine your mapping, based on data in the UNB/UNH segment.
    Within the B2B add-on, there is no need to.
    Only use module localejbs/EdifactConverterModule in case you want to convert to or from EDI.
    You have a specific requirement or do you want to test something out?
    Kind regards,
    Dimitri

  • Get IDoc-number from flat IDoc using dynamic configuration

    Dear experts
    In an IDoc2File scenario I have added the IDoc-number to dynamic configuration using the folling code in an UDF:
    DynamicConfiguration conf = (DynamicConfiguration)
    container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey FileName = DynamicConfigurationKey.create("http:/"+"/sap.com/xi/XI/System/File","DOCNUM");
    conf.put(FileName, a);
    The information is stored in the SOAP message
    <SAP:DynamicConfiguration SOAP:mustUnderstand="1">
      <SAP:Record namespace="http://sap.com/xi/XI/System/File" name="DOCNUM">0000000000012345</SAP:Record>
    </SAP:DynamicConfiguration>
    Can anybody tell me how I can access this information in the "variable substitution" section of the CC? Perhaps something like "message:docnum"?
    Additional information:
    Taking the IDoc-number from the payload using e.g. "payload:ORDERS05,1,IDOC,1,EDI_DC40,1,DOCNUM,1" does not work, since the XML-IDoc has been converted to an flat-IDoc.
    Thanks in advance for any good ideas
    Markus

    Dear Rodrigo and Sarvesh
    Thanks for your help so far! I applied your hints and now it is working fine.
    But now I have the following additional questions
    1.) My message mapping only maps the input IDoc to an output IDoc of the same type and structure. The MM is only required to process the UDF. Is there another, better solution to achieve my requirement that the IDoc-number shall be part of the filename?
    2.) In the CC you have the possibility to use temporary files (section "Processing", Option "Put File" = "Use Temporary File". I think this will not work with the given solution, will it?
    To possibly help somebody else or clarify the mechanism once again, I wrote down how my solution now looks like.
    My UDF in the message-mapping looks like this
    - Input = DOCNUM of IDoc, e.g. ORDERS05/IDOC/EDIDC/DOCNUM
    - Outpt = DOCNUM of IDoc, e.g. ORDERS05/IDOC/EDIDC/DOCNUM
    - UDF:
    public String putDynamicConfiguration(String docnum, Container container) throws StreamTransformationException{
    try
         DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
         DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
         String filename = "Prefix_" + docnum + ".txt";
         conf.put(key, filename);
         return docnum;
    catch (Exception e)
         return docnum;
    In the CC the settings are now as follows
    File Name Scheme = . -> only a dot or something else, because this field is obligatory, even if it is not used in this case.
    Variable substitution (...)
        Enable -> unchecked
    Adapter-Specific Message Attributes
        Use Adapter-Specific Message Attributes -> checked
        Fail If Adapter-Specific Message Attributes Missing -> checked
        File Name -> checked
        Directory, File Type, Temporary Name Scheme for Target File Name -> unchecked
    When I send an IDoc to PI and view the Adapte-Engine Version of the message (the SOAP-document, not the payload) I can find the Filename:
    <SAP:DynamicConfiguration SOAP:mustUnderstand="1">
    <SAP:Record namespace="http://sap.com/xi/XI/System/File" name="FileName">Prefix_0000000000012345.txt</SAP:Record>
    </SAP:DynamicConfiguration>

  • How to extract the number from image using java

    Hello every one
    i want to develope a project which can extract the number from image
    that i can use as inter or String or char.
    Is there any API in java which provide this type of facility.
    right now i m using java 5
    thanks in Advance
    Jignesh

    In my project i have a image in that i have a
    co-ordinate (x,y) I am still puzzled as to what you seek. It sounds to me like you have a point (x, y) represented by p. in java it's just p.getX() p.getY()
    i want to convert that cordinate to numeric form,
    i mena i want to use that cordinate in somewhere else
    in project.point.getX() point.getY()
    So need to convert it into numeric form u can called
    it OCR also.OCR is optical character recognition. If I want out and took a picture of the US Declaration of Independence and then wanted the words on the parchement in the picture in text form, then I would run the picture through a software program and it would try to optically recognise what lettering and number were present in the picture. In the end, I would have a text of what is written on the US Declaration of Independence.
    Is that what you want?

  • I want to convert number to hours in oracle 10 like this.

    Dear All
    Some can help me
    I want to convert below MS-SQL query in oracle 10g. please help me.
    for eg:
    Select numasdate,
    Cast(numasdate / 60 as Varchar) + ' hours ' +
    Cast(numasdate % 60 as Varchar) + ' minutes'
    as [TotalHoursAndMinutes]
    From
    #SampleTable
    Output:
    9436 157 hours 16 minutes
    537 8 hours 57 minutes
    9323 155 hours 23 minutes
    12525 208 hours 45 minutes
    Edited by: Parwez on Jan 1, 2013 5:33 AM

    I want to convert number to hours in oracle 10g like this.
    537 8 hours 57 minutes
    9436 157 hours 16 minutes
    12525 208 hours 45 minutesTry this...
    Ranit>> with xx as(
      2      SELECT 537 num from dual UNION ALL
      3       SELECT 9436 num from dual UNION ALL
      4       SELECT 12525 num from dual
      5  )
      6  select
      7       num,
      8       FLOOR(num/60)||' hrs' as "hrs",
      9       MOD(num,60)||' minutes' as "minutes",
    10       FLOOR(num/60)||' hrs  '||MOD(num,60)||' minutes' as "Hours.Mins"
    11  from xx;
           NUM hrs                                          minutes                                          Hours.Mins                                                                                                        
           537 8 hrs                                        57 minutes                                       8 hrs  57 minutes                                                                                                 
          9436 157 hrs                                      16 minutes                                       157 hrs  16 minutes                                                                                               
         12525 208 hrs                                      45 minutes                                       208 hrs  45 minutes                                                                                                Edited by: ranit B on Jan 1, 2013 6:51 PM
    --- Hey John... I just did it and saw your hint now !!!

  • Convert number of dayes per year to data

    Please i need help in Convert number of dayes to date
    I have ID's like id
    FT*09025*0000000001 date=20090125
    FT*01171*0000000002 date=20100620
    so should convert first five number after FT to date
    example *09025*
    09 map to 2009
    025 number of dayes per year map to 25 jan
    example *01171*
    01 map to 2010
    171 number of dayes per year map to 20 jun
    (jan+feb+mar+apr+may)=(31+28+31+30+31)=151
    171-151=20 for the next month
    Please need help so will added filter to informatica map with date
    Edited by: user8929623 on Jul 4, 2010 7:04 PM

    Well, I do not follow why when 09 maps into 2009, 01 maps into 2010, not into 2001. Assuming it should be 2001, use YYDDD format:
    SQL> with t as (
      2             select 'FT*09025*0000000001' id from dual union all
      3             select 'FT*01171*0000000002' from dual
      4            )
      5  select  to_date(substr(id,4,5),'yyddd') dt
      6    from  t
      7  /
    DT
    20090125
    20010620
    SQL> SY.

  • Warehouse number from "Decentralized WMS" to "Centralized"

    Hi all
    We have implemented a warehouse number with Decentralized WMS.
    ERP and WM are SAP systems.
    Now, weu2019d like to integrate WM into the same ERP SAP system (convert a warehouse number from "Decentralized WMS" to "Centralized").
    So, what shall we do?
    Can we maintain the same warehouse number and do the customizing on it (deactivate Decentralized WMS and so on)? Or we must define a new one?
    In both cases, (maintain the same warehouse number or define a new one) how can we transfer WM stock from decentralized to centralized?
    Any suggest?
    Thanks a lot
    Michele

    Hi Funky Tech.
    Thank you for your answer, but my question is another.
    We have already implemented a warehouse number as decentralized WMS.
    Now we want to integrate it into ERP (centralized WMS).
    So the questions are:
    Can we maintain the same warehouse number and do the customizing on it (deactivate Decentralized WMS and so on)? Or we must define a new one?
    In both cases, (maintain the same warehouse number or define a new one) how can we transfer WM stock from decentralized to centralized?
    Thanks
    Michele

  • How to convert number to string in java

    hi how can i convert number to string in java
    something like
    public void Discription(Number ownerName){
    String.valueOf(ownerName);Edited by: adf009 on 2013/04/08 7:14 PM

    Yet another way of doing it is: ownerName.toString().
    If you are working in and IDE such as Netbeans or Eclipse, type a period after the object name. Wait a second or so. Eclipse/Netbeans Intellisense will show you a list of functions that object provides that you can choose from. toString() is one of them.

  • Assign batch number from sale order to production order automatic

    Dear all, I have a question for all. Please help me in this case
    My scenario is make to order
    I have a sale order, when i create sale order, i have assigned batch number at each line item.
    When i run MRP for sale order (MD50), the system generate a planned order for it and I've converted to production order.
    So when I view production order, I think that batch number what I've assigned to sale order will be assign to production order but that is not happen.
    So, can you help me solve this problem. I think that sap can assign batch number from sale order to production order automatic but i don't know how to configure that
    Thanks all

    Hi,
    To the best of my knowledge, when system is generating planned order / production order from sales order system doesnt copy batch number from sales order.
    In fact , you are following wrong practice for generating batch no.
    Follow procedure like this :
    Create sales order without any batch assigning there. Run MRP with MD50 and then convert planned order to Production Order.
    While creation / releasing of Production order, you have option to generate batch automatically by following way :
    Go to OPKP (Production Scheduling Profile) -> Take your plant & give suitable name to Production scheduling profile-> Batch Management tab -
    > Automatic Batch creation in the order maintain this field as
    1     Automatic batch creation at order creation
    or
    2     Autom. batch creation at order release
    This will generate batch number automatically at the time of creation or release of order.
    Then follow same process i.e. Goods Issue, Confirmation & GR for production order.
    So you will get sales order stock in the form of batch managed.
    Check & revert if any issue in above flow.
    Regards,
    Tejas

  • Hyperion Brio: Computed Item Extract Number From String

    I would like to extract a number from a string in a computer item.  For example if I had a string such as "The customer purchased $5.00 of footballs", I would like to remove only the 5.00 from the string.  I would have to use the java functions in the results.  Any suggestions on how to do this?

    you can do this in the Results section with a computed column using the native string functions.  to break it down i have split it up a bit.
    strval is you string "The customer purchased $5.00 of footballs"
    position of $ = 25
         Instr ( strval, '$', 1, 1 )
    the starting position of the amount would then be 26
         Instr ( strval, '$', 1, 1 ) + 1
    position of decimal after $ = 26
         Instr ( strval, '.', Instr ( strval, '$', 1, 1 ), 1 )
    using Substr function you need to pick the string, the start value and the number of characters.
    string
         = strval
    start position
         = Instr ( strval, '$', 1, 1 ) + 1
    number of characters - location of decimal minus the start position plus 3 to get the cents
         = Instr ( strval, '.', Instr ( strval, '$', 1, 1 ), 1 ) - Instr ( strval, '$', 1, 1 )  + 3
    put all together
    Substr( strval, Instr ( strval, '$', 1, 1 ) + 1,  Instr ( strval, '.', Instr ( strval, '$', 1, 1 ), 1 ) - Instr ( strval, '$', 1, 1 )  + 3 ) * 1
    the multiply by 1 converts the string to number

  • Convert number to letter of alphabet?

    Hi,
    Is there a LabWindows function for converting a number to an alphabet equivalent?
    I was trying something like this...
    char getLetterOfAlphabetByNum(int number){
        //test if alpha
        if(isalpha (number)==0)
            DebugPrintf ("Error converting number to letter. Non-alphabetic.");
        else{
            //take decimal and convert to ascii
            statusReturned=Fmt (&letter, "%s<%d", number);
            if(statusReturned<0)
                DebugPrintf ("Error converting number to letter!\n");
            DebugPrintf ("tempString = %s\n", letter);
        DebugPrintf ("%d --> %s\n",number,letter);
    return letter;
    Thanks!
    Solved!
    Go to Solution.

    It seems to me that you could simplify your code this way:
    //number of alphabet to letter
    char getLetterOfAlphabetByNum (int number)
        number += 64;
        //test if alpha
        if (!isalpha (number)) {              
            DebugPrintf ("Non-alphabetic.\n");
            return 0;
        return (char)number;
    I excluded the test for printable characters as is it overcome by test for alphabetic.
    Also, be warned that passing numbers from 33 to 58 returns lowercase letters.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • FM to convert amount  from one currency to another currency?

    HI Experts
    is thier any Fucnction module to convert amount  from one currency to another currency?
    please help me.
    Thanks

    Hi,
    data: lv_foramt TYPE vbap-netpr VALUE 40,
          lv_forcurr TYPE string VALUE 'USD',
          lv_loccurr TYPE string VALUE 'INR',
          lv_locamt TYPE vbap-netpr.
    CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
           EXPORTING
            CLIENT                  = SY-MANDT
             DATE                    = sy-datum
             FOREIGN_AMOUNT          = lv_foramt
             FOREIGN_CURRENCY        = lv_forcurr
             LOCAL_CURRENCY          = lv_loccurr
            RATE                    = 0
           TYPE_OF_RATE            = 'M'
            READ_TCURR              = 'X'
          IMPORTING
    *        EXCHANGE_RATE           =
    *        FOREIGN_FACTOR          =
            LOCAL_AMOUNT            = lv_locamt
    *        LOCAL_FACTOR            =
    *        EXCHANGE_RATEX          =
    *        FIXED_RATE              =
    *        DERIVED_RATE_TYPE       =
          EXCEPTIONS
            NO_RATE_FOUND           = 1
            OVERFLOW                = 2
            NO_FACTORS_FOUND        = 3
            NO_SPREAD_FOUND         = 4
            DERIVED_2_TIMES         = 5
            OTHERS                  = 6
         IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
         ENDIF.
         write:/ lv_locamt.
    P.S. Please test your FM in SE37. When I tested, it worked only between USD and INR.

  • Robohelp 8 crashes while opening a converted project from RH7 to RH8

    case number: 181233117
    when customer when  opens a converted project from version 7 to 8, a busy hour glass is dispalyed all the time and robohelp funtionality is unavai
    lable most of the time.
    Browser: Microsoft IE
    Operating System: Windows XP Professional
    Application server: WBSPHRV60
    have asked the customer to upload the file/project.

    What are you expecting from this post?
    See www.grainge.org for RoboHelp and Authoring tips

  • How to add date with month after convert number to month?

    How to add date with month after convert number to month?
    Month Date Result
    24 21/11/09 24*(21/11/09)
    I want to add both the column and result should be 21/11/11
    Thanks
    Nihar

    Hmm,
    Because, you are using YYYY for '09'.
    SQL> ed
    Wrote file afiedt.buf
      1* select to_char(to_date('10/01/09','DD/MM/RRRR'),'DD/MM/YYYY') from dual
    SQL> /
    TO_CHAR(TO
    10/01/2009
    SQL> ed
    Wrote file afiedt.buf
      1* select to_char(to_date('10/01/09','DD/MM/YYYY'),'DD/MM/YYYY') from dual
    SQL> /
    TO_CHAR(TO
    10/01/0009Or with Add_months
    SQL> ed
    Wrote file afiedt.buf
      1* select to_char(add_months(to_date('10/01/09','DD/MM/YYYY'),36),'DD/MM/YYYY') from dual
    SQL> /
    TO_CHAR(AD
    10/01/0012
    SQL> ed
    Wrote file afiedt.buf
      1* select to_char(add_months(to_date('10/01/09','DD/MM/RRRR'),36),'DD/MM/YYYY') from dual
    SQL> /
    TO_CHAR(AD
    10/01/2012-Arun

  • Parsing HEX number from JTextField

    Is there any way that I can parse hex number from JTextField?
    I would like to input 0x1A or similar on JTextField and parse that with
    int parsedInt = Integer.parseInt(JTextField.getText());
    when I type numbers such as 1,2...and etc on the JTextField, the parseInt method works. But if I put 0x2A format, I will get errors.
    Thanks

    Thanks bbritta,
    That is not exactly what I was looking for. The return output from that would be in decimal format. I am just looking to pass on the text including 0x so that I can pass it on to JNI. There, I will use that value with C++. Do you happened to know how to obtain entire text and then converting it to an integer? Thanks again.

Maybe you are looking for

  • Can't activate iCloud for iWorks on iPad 1

    I've trouble to get the usage of iCloud activated within the iWorks Suite on my iPad 1. In comparison to other devices (e.g. the iPad of a coworker) I'm missing the Documents & Data section within the iCloud settings on the iPad. Settings of Keynote,

  • Sine wave on startup

    I searched for this all over and can only find references to start up sounds like 5 beeps or breaking glass. A couple of times I have started up my PowerBook G4 to have it make a single mid-ranged sine wave sound for a second or so. Then it waits for

  • Incoming Payment Settlement

    Dear Expert I know it is possible to partially settle invoices by making incoming payment. However, we can not enter amount of 0 for incoming payment. Due to client's special requirements, I would like to know would it be possible to make a incoming

  • How to find iPhoto files

    Hello, I am new to Mac, so I am getting accustomed to Lion and everything else, but iPhoto has me a little confused. First I transferred years of photos from my old PC to the Mac, and they all went into the pictures folder, and are still there, arran

  • Green Screen with Adobe Flash

    I suddenly have a green screen whenever I try to watch a video.  I have seen the suggestion to disable hardware acceleration.   However, when I right click to access that setting, I don't even have a display tab at all and therefore can't disable the