Comparison of characters as dates

HI all,
10.2.0
I have a table tbl as
code, amt1,amt2,yearmon
1 10 10 2007MAR
1 20 10 2007FEB
2 10 30 2007FEB
3 10 20 2008FEB
That is the amt1 and amt2 are amounts for every month belonging to different years.
BUt if i want to get the amt1 and amt2 upto a range then since yearon is character,it is not doing the comparison.
select code,sum(amt1+amt2) from tbl where yearmon between '2007APR' and 2008FEB' group by code;
then it is not giving the desired result because yearmon is a charcter.
How can i calculate sum upto a given range in this case.
Regards

I believe this is what, you need
create table tbl as (
select 1 code, 10 amt1, 10 amt2, '2007MAR' yearmon from dual union all
select 1, 20, 10 , '2007FEB' from dual union all
select 2 , 10 , 30 , '2007FEB' from dual union all
select 3 , 10 , 20 , '2008FEB' from dual )
SQL> select code , sum(amt1+amt2) from tbl
where to_date(yearmon, 'YYYYMON') between to_date('2007APR', 'YYYYMON') and to_date('2008FEB' , 'YYYYMON')
group by code;
2 3
CODE SUM(AMT1+AMT2)
3 30Regards,
Ritesh
Edited by: Ritesh S Kumar on Jan 1, 2009 4:42 AM

Similar Messages

  • How to Search for a Date in a string having both characters and date

    Hi ,
      I have a requirement to search DATE in the String having Both Characters and DATE . Please kindly let me know as early as possible.
    Regards
    Anil Kumar K

    Try to use SEARCH command with the pattern, making the pattern as fine as it can, like if you have your date in the format 02/23/2007, you can give
    SEARCH STRING FOR ' //'. (assuming the date has at least a single blank before it)
    WRITE:  SY-SUBRC UNDER 'SY-SUBRC',
    SY-FDPOS UNDER 'SY-FDPOS'.
    SY-FDPOS is set to offset of the string from which you can get the date value
    Refer here
    http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb33cc358411d1829f0000e829fbfe/frameset.htm
    It would have been better if there is something like UNIX "regular expression" matching in ABAP

  • Unable to do the (CCR in APO) comparison/reconciliation of transaction data PO and PR in APO

    Hi Gurus,
    Unable to do the (CCR in APO) comparison/reconciliation of transaction data PO and PR in APO Due to the error 181-Schedule line does not exist in APO ,Error code 182-Schedule line without external number does not exist in R/3.
    kindly suggest me ,what we need to do corrective action from ECC side and APO side.
    Regards,
    Babu

    Hi Babu,
    First make sure that order is not set with deletion flag, you can check some random orders for this.
    Steps to be followed:
    1) for all entries with error "181-Schedule line does not exist in APO" click on "Send to APO". similarly for entries with error "182-Schedule line without external number does not exist in R/3" click on "Send to R/3", most likely this type of issue get resolved with this step only, if not.
    2) Next you need to go to transaction code /n/sapapo/cq, check what all messages you are getting there. Correct the error if you are able to understand it from here i.e. rfc connection is not set, no active IM exists etc..
    3) In case you are not able to understand or correct the issue from CQ, then you need to go and check in transaction code CFG1 in ECC, and /n/sapapo/c3 in APO, check in ECC with object CIF and log class "only very important logs".
    In APO object "CIFSCM" and log class "only very important logs".
    Most probably you will be able to get exact or directional reason of the issue.
    Hope this helps.
    Rgds
    Sourabh

  • Expression to convert 8 characters to date

    Hi all,
    Is it possible to use SSRS expression to convert 8 characters to date?
    I have the date in the following format 20150402 and I would like to convert it to date dd/MM/yyyy format.
    I appreciate any help.
    Thanks in advance.

    Hi Matt_90,
    If you want to change the value from dd/MM/yyyy to ddMMyyyy, you could use the Split() function like below:
    =Split("16/04/2015","/")(0) & Split("16/04/2015","/")(1) & Split("16/04/2015","/")(2)
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu
    Qiuyun Yu
    TechNet Community Support

  • Removing non-English characters from data.

    Ours is global system with some data with non-English characters. We want to download file by removing this non-English characters.
    Any suggestions how we can remove these non-English characters from file..?

    The FM u said
         Replace non-standard characters with standard characters
       Functionality
         SCP_REPLACE_STRANGE_CHARS processes a text so that it only contains
         simple characters. Special characters and national characters are
         replaced in such a way that the text remains reasonably legible.
         The character set 1146 is used by default. In this case the following
         replacements are made, for example:
          Æ ==> AE        (AE)
          Â ==> A         (Acircumflex)
          Ä ==> Ae        (Adieresis)
          £ ==> L         (sterling)
         Note that the new text can be longer than the old.
    So i dont think it ll be useful for eliminating the sp. chars.
    U have to check each and every alphabet with std 26 alphabets
    Thanks & Regards
    vinsee

  • Problems with german characters in data migration

    Hello,
    I tried to migrate a Access 2002 mdb to Oracle 10g XE. In order to avoid errors I used Access 2000 exporter to generate xml and dat for table and data, imported the schema to Oracle database, generated data move scripts and imported the data with a batch-file.
    I did it according to the steps explained here:
    http://www.oracle.com/technology/tech/migration/workbench/viewlets/ofdm.html
    http://www.oracle.com/technology/obe/11gr1_db/appdev/msamigrate/msamigrate.htm
    All german characters in Table names were migrated correctly. But when I import the data, german characters are converted to weird signs like ü.
    If I open the dat-files with windows editor all german characters are displayed properly. If I open the same file with wordpad the german characters are displayed with the errors described above.
    Environment
    Win XP SP 3 German
    Ms Access 2002 sp3 german
    SQL Developer 1.5.0.53 german
    Access 2000 Exporter 10.2.0.2.5
    What am I doing wrong? I can't get it solved since two days.

    Check if database characterset supports these special characters
    check client's nls settings.
    check client machine's language settings (converts characters in driver level)

  • Chinese characters in date & time - how do I delete?

    Hi anybody - I have just bought a new iPad mini and am currently setting it up. What may be chinese characters are coming up in the date and time, how do I get rid of them? I have checked the keyboard and language are both English....

    Thank-you! From New Zealand

  • Characters in data field

    Hi,
    Is it possible to load characters in datafield. I want to load names in the data field and while generating report for members, i should be able to get names for these members.

    The attributes wouldn't be tied directly to the data, but rather to another dimension. So I don't see how that helps you.
    In the case of a Yes/No type field value, you could express Y as 1 in Essbase and No as 0 or #missing. Or assign specific numeric values to key words. You would then need your interface to the data to interpret the numeric values back into their string equivalents. Obviously aggregation would not make any sense in the latter scenario.
    More likely, your best bet is to consider a text mining solution. I would guess that discussion belongs in a different forum.
    Cheers,
    Bruce

  • Control Characters in Data

    I've created a simple table with 2 rows. When I query the table for an individual row (where id = 1), my return set has control characters in between 2 columns...sometimes.
    If I select * from the table, I get a core dump, then a Oracle sqlplus error message that wants to send a report to Microsoft. Once I decide to send/not send the message, sqlplus blows away.
    These 2 rows are actually 2 rows in a much larger table. I encountered this problem in the larger table, thought my data was corrupted, so I created the exact same table, in a totally different schema, and pasted the data in the new table. When I received the same error, I dropped the table, recreated it, and hand entered all the data, with the same results.
    Table structure:
    id NUMBER(9) PRIMARY KEY
    TABLE_ID NUMBER(9)
    FILTER_ONE VARCHAR2(800)
    FILTER_TWO VARCHAR2(100)
    CLASS_FILTER VARCHAR2(1)
    If I select* FROM test_table WHERE ID = 27, my result set looks like this:
    'blah blah (' ☻ '))' ☺ 'Y'
    The 1st open parenthesis is the end of the filter_one column, the double parenthesis is the entire filter_two, and the Y is the class filter. The control characters come from I know not where, but my app cannot function - this is a dynamically built query and the query of course fails because sqlplus can't interpret the control characters.
    Anyone ever heard of this? I should also mention that this query has worked for the past year, and has not been changed - it just suddenly stopped working.
    Thanks!
    Dave

    Sure -
    CREATE TABLE TEST (
    ID NUMBER(9) PRIMARY KEY,
    TABLE_ID NUMBER(9),
    FILTER_ONE VARCHAR2(800),
    FILTER_TWO VARCHAR2(100),
    CLASS_FILTER VARCHAR2(1) )
    INSERT INTO test VALUES(
    27,38,'where id in (select decode(pci.config_comp_int_id,null,decode(pci.component_id,null,pci.spirit_comp_id, pci.component_id),
    decode(cci.component_id,null,cci.component_id, cci.spirit_comp_id)) from c3net_units u
    join (select uc.*,connect_by_root(unit_id) top_unit_id
    from c3net_unit_config_int uc start with uc.unit_id is not null connect by prior uc.id = uc.parent_id) uci
    on (u.id = uci.top_unit_id)
    left join (c3net_unit_plat_int upi join c3net_plat_comp_int pci on
    ( upi.id = pci.unit_plat_int_id)) on ( uci.id = upi.unit_config_int_id)
    left join (c3net_config_plat_int cpi join c3net_config_comp_int cci on (cpi.id = cci.config_plat_int_id))
    on (uci.config_id = cpi.config_id) where u.version_id in (',
    '))','Y');
    INSERT INTO test VALUES(
    28,39,'where id in (select decode(upi.config_plat_int_id,null,decode(upi.platform_id,null,upi.spirit_plat_id,
    upi.platform_id),
    decode(cpi.platform_id,null,cpi.spirit_plat_id, cpi.platform_id)) from c3net_units u
    join (select uc.*,connect_by_root(unit_id) top_unit_id
    from c3net_unit_config_int uc start with uc.unit_id is not null connect by prior uc.id = uc.parent_id) uci
    on (u.id = uci.top_unit_id)
    left join c3net_unit_plat_int upi on ( uci.id = upi.unit_config_int_id)
    left join c3net_config_plat_int cpi on (uci.config_id = cpi.config_id) where u.version_id in (',
    '))','Y');
    When I then "select * from test where id = 27;" I get strange data - looks like control characters - in the filter_one and filter_two fields
    When I change the id to 28 and re-query, it gives me the core dump and sqlplus error.
    Thanks for your time guys

  • Xml string in Java - forbidden characters for data?

    Hi there,
    In my java class I am building a xml string and saving it as a xml file in the hard drive. Later when I open the file in the XML editor it gets errors "forbidden characters". I think the problem is that in the data there can be characters as & or <> and of course that would disturbe the xml structure. Is there any smart method in Java which convert all the forbidden characters for xml data?... many thanks for any hints.

    emailkia wrote:
    In my java class I am building a xml string and saving it as a xml file in the hard drive. I am guessing that you are building a string into which you are putting what you think is xml.
    And it isn't.
    So the real solution is to build it correctly in the first place.
    Is there any smart method in Java which convert all the forbidden characters for xml data?There are also libraries that will allow you to build xml which handle those sorts of issues for you.

  • Multibyte characters(Chinese Data)

    Hi,
    We have a table in oracle(10g) which stores Chinese data as well English characters.
    Production is designed in such a way that, we can' t increase size of the columns.
    Is there any way to handle multi-byte characters like Chinese with the same length?
    Pls help me out on this and my heartful thanks for any replies

    You need some basic understanding of how language and territory handled by database, read this article,
    NLS_LANG FAQ
    http://www.oracle.com/technology/tech/globalization/htdocs/nls_lang%20faq.htm

  • CTRL-M (^M) characters in data read from sockets

    Hi,
    We have developed a software applications which opens upto 300 TCP connections and 4000 UDP sockets. The data from the TCP application is multiplexed to UDP sockets and viceversa.
    We connect to the application using a TCP socket and send certain data to the application which in turns sends this data to all the 4000 UDP sockets. The data received from 4000 UDP sockets is in turn sent back to the TCP socket as responses.
    We used telnet to connecct to thespecific TCP port on our application, sent a request to be sent to all 4000 UDP sockets and noticed ctrl-M characters in the data received from TCP socket. However we are sure we are not appending or adding this ctrl-m character while sending the data on TCP socket.
    telnet host port >/tmp/abc
    send a request
    send next request
    (after 10 mins, close connection)
    cat -vet /tmp/abc >/tmp/xyz
    There are ctrl-m characters in /tmp/xyz.
    ^M is observed only at the end of few lines and not on all lines. Successive repeatition of this test generates ^M in different lines but at the end of the line always.
    Can anybody help me to know why these ^M characters are getting generated?
    Note: We are completely working on Solaris and do not move contents across Windows and Unix. Our application is completely written on C++
    Thanks.
    Message was edited by:
    shekhnam

    I think I've misunderstood something here. The problem you're having is with the response being filtered by Telnet or your client, not what telnet is sending to the server?
    In that case I think the explanation is clear. Telnet is trying to display what comes back on a screen, and it is deleting and inserting newlines every now and then according to its internal whim so as to make the data wrap. I don't know if you can control that, but I also don't know if it matters as long as you have your own client application. You just have to stop treating Telnet as a viable test client.

  • NonAscii Characters after data load

    Oracle 10g R2 and HPUX - Excell 2007.
    I am loading one table of data from Microsoft Excell to SQL Server 2008 and then to from SQL Server 2008 to Oracle 10g R2 database.
    I am accomplishing the above task using SSIS package(ETL tool).
    When I point SSIS package to the production database(Oracle database) the few data in few colums has non ascii characters.
    When the same SSIS package is pointed to the test Oracle database there is no data issue. Oracle test and production databases are on two different boxes. Why the same Excell data and SSIS package is not working on production box? Is there any initial parameters affects this data load? Or any code base I have to change?
    Thank you for your help.
    smith

    The OS on both boxes are the same.
    HP-UX B.11.11 U (64). When I look at the patch level there are more than 100 files to compare.
    select * from NLS_DATABASE_PARAMETERS;
    Running the above query resulted in 20 rows as output.
    NLS_NCHAR_CHARACTERSET     AL16UTF16
    NLS_LANGUAGE     AMERICAN
    NLS_TERRITORY     AMERICA
    NLS_CURRENCY     $
    NLS_ISO_CURRENCY     AMERICA
    NLS_NUMERIC_CHARACTERS     .,
    NLS_CHARACTERSET     WE8ISO8859P1
    NLS_CALENDAR     GREGORIAN
    NLS_DATE_FORMAT     DD-MON-RR
    NLS_DATE_LANGUAGE     AMERICAN
    NLS_SORT     BINARY
    NLS_TIME_FORMAT     HH.MI.SSXFF AM
    NLS_TIMESTAMP_FORMAT     DD-MON-RR HH.MI.SSXFF AM
    NLS_TIME_TZ_FORMAT     HH.MI.SSXFF AM TZR
    NLS_TIMESTAMP_TZ_FORMAT     DD-MON-RR HH.MI.SSXFF AM TZR
    NLS_DUAL_CURRENCY     $
    NLS_COMP     BINARY
    NLS_LENGTH_SEMANTICS     BYTE
    NLS_NCHAR_CONV_EXCP     FALSE
    NLS_RDBMS_VERSION     10.2.0.2.0
    The above query result is same bit by bit on production and test box.
    Is the load process exactly the same ?
    I just change the connection point in SSIS to point to production database. Also the table structure (data types, etc what I can see through SQL Developer) in production and test datasbe are same.
    What else be the reason for this?
    Smith

  • Unicode Characters in Data Field

    Hi,
    The client has requested us to print the chinese characters in the Data field.
    We are able to add chinese text to the designer, but when we map the data field to the chinese output we are unable to capture the chinese data and the output is showing some Junk characters while opening in PDF (PDF has all chinese font installed).
    Tried all the possible chinese available including the Arial Unicode fonts in Presentment Target.
    Has any body faced the issue with language or unicode while capturing the data??
    Since this is issue is critical..Prompt solution is appreciated.
    Thanks
    Dinesh

    Hi Rick,
    Here is the solution...
    Since all desktops which were used normally has US installed as their base language.
    So all data that you input from your keyboard or paste from others are English and they are single byte. So you don't face problem.
    But since many of the east Asian languages are double byte and if your desktop doesn't have Chinese language installed as your regional language.. you will not be able to see the Chinese characters whey they are input from your keyboard or paste it from other.
    So you need to have Chinese language installed as one of your regional language.
    It can be done this way...
    Go to Control Panel --> Regional Language and options --> Languages (TAB) --> check the check boxes..
    You need to have your operating system CD to install the East Asian languages.
    Hope this solve your problem...
    Please get back to me if you still have problem.
    Thanks
    Dinesh

  • Invalid Characters during data load

    Hi All,
    We are in BI7 and its unicode compliant with code page 4102.
    My setting in RSKC is ALL_CAPITAL. When i tried loading data from the source system, i got many error records in BW saying that it has invalid characters. On debugging, i found that hexadecimals 00-1F comes as part of the record. Why control characters like 00-1F are not allowed in BW by default? I changed the RSKC setting to ALL_CAPITAL_PLUS_HEX, but its of no use.
    when i checked in i18n transaction, i could see that code 4102 can accept all control characters.
    Is there any setting that has to be made in order to allow hexadecimals in BW [ without converting it in to space using a routine ]?
    Thanks and Regards
    Amith

    Hi Amith Anand,
    Please
    check
    Program
    RSKC_ALLOWED_CHAR_MAINTAIN
    Or
    RSKCCHECK
    Let me know.
    Regards
    Hari

Maybe you are looking for

  • How can ANYONE be happy with this piece of junk? Seriously?

    I started by importing my iPhoto library. It's 10k pictures, many if which I could probably delete if I had a good tool like Aperture to help me. In iPhoto I have about 50 or 60 keywords and I have applied at least some keywords to lots of my picture

  • I tried to install my adobe creative suite 6 design standard but it wont let me install. How can i install it?

    My mother purchased Adobe Creative Suite 6 Design Standard back in 2012. When she purchased it for me, i did not need it at the time. However I am now a second year architect major at Hampton University and i need the Adobe Suite to use for my repres

  • Sending multiple files

    in file to file. i am sending multiple file with different file name and in target side the same file names should be displayed.help me how to solve problem

  • Password for a folder?

    Hi, Is it possible to "encrypt" a folder by locking it with a password? Like if some random guy hacked my computer and he wanted to open this folder, I could lock it with a password so he couldn't open it. This didn't actually happen but.. : ) Thanks

  • XI login problem for Integration Builder..........

    Hi All, I have a Typical problem while logging in to Integration Builder Tool, I dont see any error log for IB ,but same time where as i am to login for other TOOLs IR&ID. The problem is when i am trying to login to IR it giving a shortcut menu of SA