Character wise count of a word

Hi
I want a query to find to find the character wise count of a word.
Ex..if the word is Marium Thomas
I just want to get the output as---
M ------- 2
A -------- 2
PLease help me to solve this out.

Hi,
Hope this helps for you.
declare
a varchar2(1000):='ABBCCCDDDDEEEEE';
b number;
c varchar2(100);
d varchar2(100);
l number:=1;
k number:=1;
count1 NUMBER:=0;
begin
select length(a) into b from dual;
for z in 1..b loop
dbms_output.put_line('--------------------------------');
c:= substr(a,l,1);
if c IS NOT NUll then
     count1 := 0;
k :=1;
     for j in 1..b loop
     d:= substr(a,k,1);
     if d IS NOT NULL THEN
if(c=d) then
count1 := count1+1;
End if;
ELSE
k :=0;
     END IF;
     k :=k+1;
     end loop;
ELSE
l :=0;
END IF;
l := l+1;
dbms_output.put_line('Character : '||c||' count : '||count1);
dbms_output.put_line('--------------------------------');
end loop;
end;
Thanks,
Vinoth

Similar Messages

  • How to Count number of words in a file....

    Hi Experts,
    I have uploaded the text file, from the application server, like this: 
    call function 'GUI_UPLOAD'
      exporting
        filename = LV_ip_FILENAME
      tables
        data_tab = LT_FILETABLE.
    The text file contains some number character words....  like "sap labs india..... "
    Now, I wanted to count number of words in an internal table  LT_FILETABLE....  can anybody help me?

    Hi,
    Special Characters in Regular Expressions
    The following tables summarize the special characters in regular expressions:
    Escape character
    Special character Meaning
    Escape character for special characters
    Special character for single character strings
    Special character Meaning
    . Placeholder for any single character
    C Placeholder for any single character
    d Placeholder for any single digit
    D Placeholder for any character other than a digit
    l Placeholder for any lower-case letter
    L Placeholder for any character other than a lower-case letter
    s Placeholder for a blank character
    S Placeholder for any character other than a blank character
    u Placeholder for any upper-case letter
    U Placeholder for any character other than an upper-case letter
    w Placeholder for any alphanumeric character including _
    W Placeholder for any non-alphanumeric character except for _
    [ ] Definition of a value set for single characters
    [^ ] Negation of a value set for single characters
    [ - ] Definition of a range in a value set for single characters
    [ [:alnum:] ] Description of all alphanumeric characters in a value set
    [ [:alpha:] ] Description of all letters in a value set
    [ [:blank:] ] Description for blank characters and horizontal tabulators in a value set
    [ [:cntrl:] ] Description of all control characters in a value set
    [ [:digit:] ] Description of all digits in a value set
    [ [:graph:] ] Description of all graphic special characters in a value set
    [ [:lower:] ] Description of all lower-case letters in a value set
    [ [:print:] ] Description of all displayable characters in a value set
    [ [:punct:] ] Description of all punctuation characters in a value set
    [ [:space:] ] Description of all blank characters, tabulators, and carriage feeds in a value set
    [ [:unicode:] ] Description of all Unicode characters in a value set with a code larger than 255
    [ [:upper:] ] Description of all upper-case letters in a value set
    [ [:word:] ] Description of all alphanumeric characters in a value set, including _
    [ [:xdigit:] ] Description of all hexadecimal digits in a value set
    a f
          v Diverse platform-specific control characters
    [..] Reserved for later enhancements
    [==] Reserved for later enhancements
    u2192 More
    Special characters for character string patterns
    Special character Meaning
    Concatenation of n single characters
    {n,m} Concatenation of at least n and a maximum of m single characters
    {n,m}? Reserved for later enhancements
    ? One or no single characters
    Concatenation of any number of single characters including 'no characters'
    *? Reserved for later enhancements
    + Concatenation of any number of single characters excluding 'no characters'
    +? Reserved for later enhancements
    | Linking of two alternative expressions
    ( ) Definition of subgroups with registration
    (?: ) Definition of subgroups without registration
    1, 2, 3 ... Placeholder for the register of subgroups
    Q ... E Definition of a string of literal characters
    (? ... ) Reserved for later enhancements
    for more details please refer the following,
    [http://help.sap.com/abapdocu_70/en/ABENREGEX_SYNTAX_SIGNS.htm]
    [http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/902ce392-dfce-2d10-4ba9-b4f777843182?QuickLink=index&overridelayout=true]
    Thanks,
    Renuka S.

  • Count characters in Word for Mac

    Hi Guys, does sb know how can I count characters in Word for Mac? Pls help me... THX a lot!

    If you select the text you want a count of (or if you want the entire document, you can just leave nothing selected) and then go to the Tools menu and select Word Count you will get a dialog that includes the character count.
    I am using Word 2011, other versions may vary.

  • TextEdit Applescript help counter of certain words

    I have tried to modify a script that finds and replaces text. My goal is to count the instances the script finds a word, say "love", and spit out the number of instances that the word "love" appears in the document so I can use it for another subroutine. Any help is appreciated.
    I have this as guideline but it seems it does not work.
    tell application "TextEdit"
    set myCountSign to text of document 1
    set myCount to count myCountSign
    repeat with this_word in myCountSign
    if (this_word as string) is "love" then
    set myCount to myCount + 1
    end if
    end repeat
    myCount
    end tell

    The most obvious problem with your script is the line:
    repeat with this_word in myCountSign
    This looks at myCountSign (a block of text) and iterates through it assigning each text object to this_word.
    The problem is that by default each 'text object' is each character therefore you're comparing each character in the text to the string 'love' which will never, ever match. Even if the word exists you'd be performing a character-by-character comparison.
    The simplest fix is to tell AppleScript to look at the words in the text, which is done simply by:
    repeat with this_word in (words of myCountSign)
    (note you might also need to do this for 'set myCount to count myCountSign' since this will return the character count, not the word count)
    There are other, more efficient ways (such as via text item delimiters):
    tell application "TextEdit"
      set myCountSign to text of document 1
      set wordCount to (count words of myCountSign)
      set {oldtids, my text item delimiters} to {my text item delimiters, "love"}
      log set keywordCount to (count text items of myCountSign) -1
      set my text item delimiters to oldtids
      display dialog "The document has " & wordCount & " words and " & keywordCount & " occurrences of the word 'love'"
    end tell
    The text item delimiters approach works by breaking the text into chunks at each occurrence of the delimiter (in this case, the string 'love'). Then all you have to do is count the number of chunks (minus 1) which is a lot quicker than counting all the words, especially for large documents.

  • Page Wise Count of rows

    Hi ,
    How to get page wise count of rows of the inner repeating group?
    Thanks in advance.
    --Basava.S                                                                                                                                                                                                                       

    Hi Dimant,
    I used countrows. If the dataset set contains 12 rows I am getting the o/p as shown below. I just need one row. Can please help me out.
    Thanks
    sush

  • After installing lion and updating to pages 4.1 cannot view my document content after I open the document.  Shows how many pages I have and how many words in word count, but no words...

    after installing lion and updating to pages 4.1 cannot view my document content after I open the document.  Shows how many pages I have and how many words in word count, but no words...

    Same problem. Tried reinstalling Pages. Didn't help. The behavior is like I am typing with a white font on a white background, but I am not.

  • Month wise count

    Hi all,
    i am using oracle 11.2.0.3.0 version. i need to calculate month wise count. see below table, the date
    like 'MM-DD-YYYY'.
    claims from_date end_date member
    C1 11/06/2012 11/20/2012 M1
    C1 11/02/2012 11/20/2012 M1
    C1 11/04/2012 11/15/2012 M1
    C1 10/07/2012 10/15/2012 M1
    C1 09/08/2012 09/09/2012 M1
    C2 05/07/2012 05/08/2012 M1
    C2 06/09/2012 06/15/2012 M1
    I need the output like below
    claims from_date end_date member count(claims) count(member)
    C1 11/06/2012 11/20/2012 M1 3 3
    C1 11/02/2012 11/20/2012 M1 3 3
    C1 11/04/2012 11/15/2012 M1 3 3
    C1 10/07/2012 10/15/2012 M1 1 1
    C1 09/08/2012 09/09/2012 M1 1 1
    C2 05/07/2012 05/08/2012 M1 1 1
    C2 06/09/2012 06/15/2012 M1 1 1
    Thanks.
    Edited by: 980659 on Jan 8, 2013 8:07 PM

    980659 wrote:
    I need the output like below
    claims from_date end_date member count(claims) count(member)
    C1 11/06/2012 11/20/2012 M1 3 3
    C1 11/02/2012 11/20/2012 M1 3 3
    C1 11/04/2012 11/15/2012 M1 3 3
    C1 10/07/2012 10/15/2012 M1 1 1
    C1 09/08/2012 09/09/2012 M1 1 1
    C2 05/07/2012 05/08/2012 M1 1 1
    C2 06/09/2012 06/15/2012 M1 1 1
    Thanks.
    Edited by: 980659 on Jan 8, 2013 8:07 PMWith your changed output, you could use
    select claims, from_date, end_date, member,
            count(*) over(partition by  to_char(from_date,'yyyymm') order by null) claim_count,
            count(*)  over(partition by  to_char(from_date,'yyyymm') order by null) member_count
    from your_table;FROM_DATE and TO_DATE are expected in the same month

  • Product wise count

    Oracle 11.2.0.1
    Windows 7
    I have two tables:
    1.Product_master
    (prod_id, prod_name)
    2.Sales_master
    (billno,prd1,prd2,prd3,prd4,prd5)
    Prd(n) columns says that bill's sold product ids, i.e. in one bill there can be max 5 products exists, may also be less than 5 but at least one, no repitation of id.
    Now, I have a select query by which i may get the total counts of a prod id with its name, i.e. Suppose prod id 10 exists in bill no. 100,200,205 and prod id in bill no. 100,103,205 then output should be:
    10 prod1 3
    20 prod2 3
    3 means these products has been sold 3 times/3 different bills were generated.
    Kindly help me.
    Thanks.

    create table sales_master(billno varchar2(10),prd1 varchar2(2),prd2 varchar2(2),prd3 varchar2(2),prd4 varchar2(2),prd5 varchar2(2));
    insert into sales_master values ('123456','40','25','14',null,null);
    insert into sales_master values ('123457','10',null,null,null,null);
    insert into sales_master values ('123458','15','03','42','18','23');
    insert into sales_master values ('123459','15',null,null,null,null);
    insert into sales_master values ('123460','03','10','40',null,null);
    insert into sales_master values ('123461','14','42',null,null,null);
    --Another Table :
    create table prod_master(product_id varchar2(2),product_name varchar2(30));
    insert into prod_master values ('01','COLD-II STRIPS');
    insert into prod_master values ('02','IRON RINGS');
    insert into prod_master values ('10','METAL RINGS');
    insert into prod_master values ('03','SOLID PIPES-I');
    insert into prod_master values ('14','COPPER ROD-2CM');
    insert into prod_master values ('40','H.P.C.F.');
    insert into prod_master values ('42','KRD-CMT');
    insert into prod_master values ('25','BROON TOUGH');
    insert into prod_master values ('15','ROUND CHIPS-KP');
    insert into prod_master values ('23','ZERO WIRE-2P');
    insert into prod_master values ('18','FLAT CHIPS-KP');
    commit;
    SQL> select * from sales_master;
    BILLNO     PR PR PR PR PR
    123456     40 25 14
    123457     10
    123458     15 03 42 18 23
    123459     15
    123460     03 10 40
    123461     14 42
    6 rows selected.
    SQL> select * from prod_master;
    PR PRODUCT_NAME
    01 COLD-II STRIPS
    02 IRON RINGS
    10 METAL RINGS
    03 SOLID PIPES-I
    14 COPPER ROD-2CM
    40 H.P.C.F.
    42 KRD-CMT
    25 BROON TOUGH
    15 ROUND CHIPS-KP
    23 ZERO WIRE-2P
    18 FLAT CHIPS-KP
    11 rows selected.Required Output : Product wise count of bills, suppose I want to get whole products count then :
    SELECT       p.product_id, p.product_name
    ,    COUNT (DISTINCT s.billno)     AS cnt
    FROM         prod_master  p
    JOIN         sales_master    s  ON  p.product_id  IN ( s.prd1
                                              , s.prd2
                                              , s.prd3
                                              , s.prd4
                                              , s.prd5
    GROUP BY  p.product_id, p.product_name
    ORDER BY 1
    PR PRODUCT_NAME    COUNT [This is only comment part please]
    03 SOLID PIPES-I       2 (Because It has been sold under 2 bills i.e. 123458,123460)
    10 METAL RINGS         2 (Because It has been sold under 2 bills i.e. 123457,123460)
    14 COPPER ROD-2CM      2 (Because It has been sold under 2 bills i.e. 123456,123461)
    15 ROUND CHIPS-KP      2 (Because It has been sold under 2 bills i.e. 123458,123459)
    18 FLAT CHIPS-KP       1 (Because It has been sold under 1 bill i.e. 123458)
    23 ZERO WIRE-2P        1 (Because It has been sold under 1 bill i.e. 123458)
    25 BROON TOUGH         1 (Because It has been sold under 1 bill i.e. 123456)
    40 H.P.C.F.            2 (Because It has been sold under 2 bills i.e. 123456,123460)
    42 KRD-CMT             2 (Because It has been sold under 2 bills i.e. 123458,123461)
    Which your above worked perfectly.Now, if suppose I wish to get count of only for product_id in('15,'23','42') then output should be :
    PR PRODUCT_NAME    COUNT
    15 ROUND CHIPS-KP      2 (Because It has been sold under 1 bills i.e. 123458,123459)
    23 ZERO WIRE-2P        1 (Because It has been sold under 1 bills i.e. 123458)
    42 KRD-CMT             2 (Because It has been sold under 2 bills i.e. 123458,123461)
    SELECT       p.product_id, p.product_name
    ,    COUNT (DISTINCT s.billno)     AS cnt
    FROM         prod_master  p
    JOIN         sales_master    s  ON  p.product_id  IN ( s.prd1
                                              , s.prd2
                                              , s.prd3
                                              , s.prd4
                                              , s.prd5
    where p.product_id in('15','42','23')
    GROUP BY  p.product_id, p.product_name
    ORDER BY 1
    It also worked perfectly.Ok, now suppose if I says :
    insert into sales_master values ('123462','22',null,null,null,null);
    --i.e. product id which is is not in product master table and I says :
    SELECT       p.product_id, p.product_name
    ,    COUNT (DISTINCT s.billno)     AS cnt
    FROM         prod_master  p
    full JOIN         sales_master    s  ON  p.product_id  IN ( s.prd1
                                              , s.prd2
                                              , s.prd3
                                              , s.prd4
                                              , s.prd5
    GROUP BY  p.product_id, p.product_name
    ORDER BY 1
    PR PRODUCT_NAME                          CNT
    01 COLD-II STRIPS                          0
    02 IRON RINGS                              0
    03 SOLID PIPES-I                           2
    10 METAL RINGS                             2
    14 COPPER ROD-2CM                          2
    15 ROUND CHIPS-KP                          2
    18 FLAT CHIPS-KP                           1
    23 ZERO WIRE-2P                            1
    25 BROON TOUGH                             1
    40 H.P.C.F.                                2
    42 KRD-CMT                                 2
    PR PRODUCT_NAME                          CNT
                                               1
    12 rows selected.while I need :
    03 SOLID PIPES-I                           2
    10 METAL RINGS                             2
    14 COPPER ROD-2CM                          2
    15 ROUND CHIPS-KP                          2
    18 FLAT CHIPS-KP                           1
    22 [New Product]                           1  <<----
    23 ZERO WIRE-2P                            1
    25 BROON TOUGH                             1
    40 H.P.C.F.                                2
    42 KRD-CMT                                 2In addition to above, I need output as below also (new requirement told by admin after posting the question, I am sorry)
    Final required output (by adding new requirement after question posting)
    PR PRODUCT_NAME                          CNT    BILL1      BILL2     BILL3    BILL4
    03 SOLID PIPES-I                           2   123458     123460
    10 METAL RINGS                             2   123457     123460
    14 COPPER ROD-2CM                          2   123456     123461
    15 ROUND CHIPS-KP                          2   123458     123459
    18 FLAT CHIPS-KP                           1   123458    
    22 [New Product]                           1   123462                                   
    23 ZERO WIRE-2P                            1   123458    
    25 BROON TOUGH                             1   123456     
    40 H.P.C.F.                                2   123456     123460
    42 KRD-CMT                                 2   123458     123461i.e. if count of product is less than 4 bills then those bill numbers should also be there, because those products are rarely sold and we wish to know who purchased those products by looking into that bill number.
    I am again thankful to you for your support.
    Thanks.
    Edited by: user12050217 on Dec 10, 2012 8:57 PM

  • Count space in word

    hi how can i count alphabet in a letter for example if i have word simple how can i write query to show that simple got 5 alphabat and count the space if its there

    It would help if you were clear in what you want. Please read: {message:id=9360002}
    Here's an example of the sort of thing you could do if you wanted...
    SQL> drop table t
      2  /
    Table dropped.
    SQL>
    SQL> create table t as
      2    select 'SUPERCALAFRAJALISTICEXPIALIDOCIOUS' as txt from dual union all
      3    select 'THISISMYVERYLONGNAME' from dual union all
      4    select 'SIMPLE 123' from dual
      5  /
    Table created.
    SQL> with chrpos as (select t.txt, SUBSTR(t.txt,x.rn,1) as chr, x.rn as pos
      2                  from   (select rownum rn from dual,t connect by rownum <= length(t.txt)) x, t)
      3  select txt, chr, cnt, ltrim(sys_connect_by_path(pos,','),',') as positions
      4  from (
      5        select c.txt, c.chr, c.cnt, c2.pos, row_number() over (partition by c.txt, c.chr order by c2.pos) as rn
      6        from (
      7              select c1.txt, c1.chr, count(*) cnt
      8              from chrpos c1
      9              group by txt, chr
    10             ) c,
    11             chrpos c2
    12        where c2.txt = c.txt
    13        and   c2.chr = c.chr
    14       )
    15  where connect_by_isleaf = 1
    16  connect by txt = prior txt and chr = prior chr and rn = prior rn+1
    17  start with rn = 1
    18  order by txt, chr
    19  /
    TXT                                C        CNT POSITIONS
    SIMPLE 123                                    1 7
    SIMPLE 123                         1          1 8
    SIMPLE 123                         2          1 9
    SIMPLE 123                         3          1 10
    SIMPLE 123                         E          1 6
    SIMPLE 123                         I          1 2
    SIMPLE 123                         L          1 5
    SIMPLE 123                         M          1 3
    SIMPLE 123                         P          1 4
    SIMPLE 123                         S          1 1
    SUPERCALAFRAJALISTICEXPIALIDOCIOUS A          5 7,9,12,14,25
    SUPERCALAFRAJALISTICEXPIALIDOCIOUS C          3 6,20,30
    SUPERCALAFRAJALISTICEXPIALIDOCIOUS D          1 28
    SUPERCALAFRAJALISTICEXPIALIDOCIOUS E          2 4,21
    SUPERCALAFRAJALISTICEXPIALIDOCIOUS F          1 10
    SUPERCALAFRAJALISTICEXPIALIDOCIOUS I          5 16,19,24,27,31
    SUPERCALAFRAJALISTICEXPIALIDOCIOUS J          1 13
    SUPERCALAFRAJALISTICEXPIALIDOCIOUS L          3 8,15,26
    SUPERCALAFRAJALISTICEXPIALIDOCIOUS O          2 29,32
    SUPERCALAFRAJALISTICEXPIALIDOCIOUS P          2 3,23
    SUPERCALAFRAJALISTICEXPIALIDOCIOUS R          2 5,11
    SUPERCALAFRAJALISTICEXPIALIDOCIOUS S          3 1,17,34
    SUPERCALAFRAJALISTICEXPIALIDOCIOUS T          1 18
    SUPERCALAFRAJALISTICEXPIALIDOCIOUS U          2 2,33
    SUPERCALAFRAJALISTICEXPIALIDOCIOUS X          1 22
    THISISMYVERYLONGNAME               A          1 18
    THISISMYVERYLONGNAME               E          2 10,20
    THISISMYVERYLONGNAME               G          1 16
    THISISMYVERYLONGNAME               H          1 2
    THISISMYVERYLONGNAME               I          2 3,5
    THISISMYVERYLONGNAME               L          1 13
    THISISMYVERYLONGNAME               M          2 7,19
    THISISMYVERYLONGNAME               N          2 15,17
    THISISMYVERYLONGNAME               O          1 14
    THISISMYVERYLONGNAME               R          1 11
    THISISMYVERYLONGNAME               S          2 4,6
    THISISMYVERYLONGNAME               T          1 1
    THISISMYVERYLONGNAME               V          1 9
    THISISMYVERYLONGNAME               Y          2 8,12
    39 rows selected.Which details each individual character of the string, indicating a count of how many times that character appears in the string, and lists all the positions of that character in the string.

  • Help to count number of words and time it

    Hi,
    I need help in inputting a text file using a file browser into a JTextArea and then count the number of occurance of each words in the file and display the time it takes in a JTextField.
    Right now I am able to come up with the idea of creating an Array to list all the words but I am still unable to count them. And by extending an abstract class to create the array class. Below is attached my abstract class.
    import java.io.*;
    import java.util.Observable;
    import java.util.StringTokenizer;
    public abstract class AbstractWordCounter extends Observable
         /** Amount of time required to count words in the most recently read file. */
         protected long readTime;
         /** DELIMETERS used in this WordCounter */
         protected String DELIMETERS;
         /** By default, any AbstractWordCounter will have is delimeters set to any non-letter ASCII character */
         public AbstractWordCounter()
              this.readTime = -1;
              DELIMETERS = "";
              // Add any non-letter ASCII character to the list of tokens.
              for(int i = 0; i < 256; i++)
                   if( !Character.isLetter( (char)i  ) )
                        DELIMETERS += Character.toString( (char)i);
         /** Get the delimeters used in this WordCounter */
         public String getDelimeters()
              return DELIMETERS;
         /** Change the delimeters used in this WordCounter
          * @param newDelimeters the new delimeters to be used
         public void setDelimeters(String newDelimeters)
              DELIMETERS = newDelimeters;
          *@return    The number of unique words in this WordCountItem object
         public abstract int getSize();
         /** @return  The total number of words counted by this WordCounter */
         public abstract int getTotalNumWords();
         /** Add a String to this WordCounter
          * @param s the String s is converted to lower-case.  If the lower-case String is already in the list, it's count is
          *        incremented.  Otherwise it is added to the list and its count is set to 1.
         public abstract void add(String s);
          * Get the ith WordCountItem
          *@param  i  must be between 0 and size - 1 (inclusive)
          *@return    The WordCountItem stored at the ith location
         public abstract WordCountItem getWordCountItem(int i);
          *  Clear this WordCounter.  After this method runs, this.size == 0.
         public abstract void clearCount();
         /** @return The amount of time (in milliseconds) that was required to read the most recent file */
         public long getReadTime()
              return this.readTime;
          *  Reads the file.  Converts each word in the file to lower case and adds it to this
          *  AbstractWordCounter.  The AbstractWordCounter is cleared before reading the new file.
          *  The time required to read the file and count the words is recorded.
          *@param  fileName  file to be opened.
          *@throws FileNotFoundException
         public final void readFile(String fileName) throws FileNotFoundException
              // Clear this AbstractWordCounter.  Open the file and count the words in the file.
    }Then the time I have come up so far is in the class that extends the abstract class above and the code is as:
    public long getReadTime()
              return this.readTime;
         }and I have a hard time to actually display this in a JTextField as it says non-static cannot be applied to a static content and if I change the method into static, another error of overiding the abstract occurs...
    I am totally lost for these errors. And I am still unable to create a file browser to find a file. For now I just write a complete path to open the file.
    would someone could point me the right direction for this problem... Thanks in advance

    Crosspost: http://forum.java.sun.com/thread.jsp?forum=31&thread=521763&tstart=0&trange=15

  • How to count number of words in a string?

    Is it only possible by counting the number of white spaces appearing in the string?

    Of course that also depends upon how accurate you need to be and what the string contains. It is completely possible that there might be a line break which doesn't have a trailing or leading space.
    Like that.
    In that case Flash's representation of the string is likely "...space.\n\nLike that.." In chich case "space.\n\nLike" will be a word.
    Also if you split on space and there are places where there are two spaces in a row you could inflate your number. So somthing that changes newlines (and returns) to spaces, then removes any multiple spaces in a row, and finally does the split/count thing would be more accurate.
    But it all depends upon what you need.

  • Oracle 11g special character(á) length count

    Hi Experts,
    I'm facing an issue while inserting the special character (á) in Oracle 11g. The database table length for the column 'descr' declared as varchar2(30). I'm inserting a string ('Aabbccee/ddffggh Ffrán y Plaos') in column descr which is having the length 30. Please note the character 'a' in Ffrán is not letter 'a' but special character *'á'*. It gives the below error,
    java.sql.SQLException: ORA-12899: value too large for column ""DESCR" (actual: 31, maximum: 30)
    The strange is the same query works/insert in Oracle 9i without any issue. I suspect the special character *'á'* will take/count as 2 character in Oracle 11g but single character in Oracle 9i.
    Please provide the insight views and solution for this issue with out altering the column length.
    I hope the solution at the earliest, since this is an urgent requirement.
    Thanks.

    Your 9i database has character set WE8ISO8859P1 which is a single byte characterset.
    But on 11g, you're using AL32UTF8 - a multi-byte unicode characterset.
    Obviously with a multi-byte characterset, characters which took up a single byte might now need multiple bytes.
    So the default meaning of VARCHAR2(30) which is VARCHAR2(30 BYTE) may not be sufficient to hold 30 characters.
    Assuming that you want to use the different characterset - (and if not then you might as well rebuild your 11g database with the 9i characterset), then you need to do is to change your LENGTH SEMANTICS to CHAR not BYTE.
    This means two things.
    1. Changing NLS_LENGTH_SEMANTICS to CHAR via ALTER SYSTEM. I believe this needs a restart to take effect. This will affect newly created column definitions so that VARCHAR2(30) means VARCHAR2(30 CHAR) not VARCHAR2(30 BYTE) - so for changes going forward.
    2. Changing existing column definisition via ALTER TABLE xyz MODIFY colname VARCHAR2(30 CHAR) etc.

  • Counting Lines/Char/Words in a txt file

    I created this method that counts the mount of lines/words/ and char in a file. But for somereason, its not working correctly. Its giving me numbers that are a little off.
         // Method countLineWordChar counts the number of lines, words, and chars, in
         // a file given as a parameter. This method returns an array of intergers. In
         // the array, the first position is the amount of lines, the second posistion
         // is the amount of words, and the third is the amount of chars.
         public static int[] countLineWordChar(File f)
              int[] countInfo = new int[3];
              int lineCount = 0;
              int wordCount = 0;
              int charCount = 0;
              try
                   FileReader fr = new FileReader(f);
                   StreamTokenizer st = new StreamTokenizer(fr);
                   st.eolIsSignificant(true);
                   while(st.nextToken() != StreamTokenizer.TT_EOF)
                        switch(st.ttype)
                             case StreamTokenizer.TT_WORD:
                             wordCount++;
                             String wordRead = st.sval;
                             charCount += wordRead.length();
                             break;
                             case StreamTokenizer.TT_EOL:
                             lineCount++;
                             break;
                             default:
                             break;
              catch (FileNotFoundException fnfe)
                   UserInterface.showFileNotFoundError();
              catch (IOException ioe)
                   JOptionPane.showMessageDialog(null, ioe.toString(), "Error",
                   JOptionPane.ERROR_MESSAGE);
              countInfo[0] = lineCount;
              countInfo[1] = wordCount;
              countInfo[2] = charCount;
              return countInfo;
         // Based on the countLineWordChar method, returns the amount of lines.
         public static int getLineCount(int[] countInfo)
              return countInfo[0];
         // Based on the countLineWordChar method, returns the amount of words.
         public static int getWordCount(int[] countInfo)
              return countInfo[1];
         // Based on the countLineWordChar method, returns the amount of chars.
         public static int getCharCount(int[] countInfo)
              return countInfo[2];
         }

    Well, for one thing, you're adding the number of characters in words, not the number of characters overall. Are you sure it's not supposed to be the latter?
    Otherwise, how is it off?
    Basically the way you fix this kind of thing is to add debugging code, then give it a small data sample and watch the debugging messages.
    By the way, returning an array of different kinds of values like that isn't ideal. In this case it's not so bad, because the kinds of values are actually really similar -- they could be viewed as a tuple. But don't make a habit of it. An example of a bad application of this would be if you were returning an array that counted, say, the weight of a ship, the length of its hull, and the distance it travelled in the last year. The alternative is to create a class that encapsulates the data being returned, or to move functionality around so the data isn't being returned at all.

  • Counting times a word appears in document

    I am trying to read from a file and count how many times a word appears in that document.
    For example if i had a list of names
    Daniel Fowler
    Joe Mahogony
    Daniel Peterson
    Chris Sim
    How would you count the amount of people named Daniel and display it?
    I am currently using findInLine"Daniel" but when ran no luck.
    Any ideas?

    danieltnbaker wrote:
    deepak,
    the bufferedreader reads content from the file yes?
    but what method would i use to count the amount of a word in that file?
    finInLine finds the word but cannot turn that into an integer. any other methods?first of all the code I had posted in my previous post should work and it uses the Scanner to read the file.
    If you want to use the FileReader approach the within the code that actually reads the file line by line, you can use the String.indexOf method (as suggested by nclow) to check if a particular word is present in that line of the file. IF it is there you increment a counter.
    int counter = 0;
    // Read through the entire file
    String currentLineFromFile = bufferedReader.readLine(); // throws IOException
    while(currentLineFromFile != null)
        // Add a carriage return (line break) to preserve the file formatting.
        textFromFile.append(carriageReturn + currentLineFromFile);
        currentLineFromFile = bufferedReader.readLine(); // throws IOException
          if (currentLineFromFile.indexOf("Daniel") != -1)
                counter++
          System.out.println("No of occurances- " + counter);
    }hope this helps
    [email protected]
    Edited by: deepak_1your.com on 16-Apr-2008 14:18

  • Program to count number of words

    I need some help with writing a program that counts the number of words in a file. Can anyone help me?

    I would try:
    read line
    save line to a string
    use split(" ") method from String to get each word
    into a String[]
    then put each entry in the array into a list
    repeat for all lines
    get size of listThat will only work for small-ish files. I would recommend using indexOf() until EOF is reached. You would need logic to ignore consecutive spaces and the like, but it should be both significantly smaller in memory footprint and faster in execution speed.
    - Saish

Maybe you are looking for

  • Can I suppress formatting in getDate()?

    I'm getting a "Date" by using the getDate() method. That's fine. What's not fine is that when I display the date on a web page (using c:out) I get a date with dashes in it. So instead of 20070601, I see "2007-06-01". That's problem because you can't

  • Samba server cannot be accessed through Finder's 'Network'

    Hi, First off, I'm not sure that this is the right forum for me to post this topic, but all the Samba related questions seemed to be coming from here. I don't own a computer with Windows, so I'm not interested in Windows compatibility per se, but I a

  • Build and run Rules with Jdev Integrated Web Determination Server

    Hi I created the rule using Oracle Policy Modeling (OPM). Then built and deployed with Embedded Tomcat web determination server. Successfully done it. Now I have to run the same rule under Jdeveloper Integrated Server. As I know, current version of O

  • Mac/Win upgrade?

    Can someone please tell me how the Mac/Win upgrade works?  Can I install one copy on a Mac and one on Windows with the same $299 license? If so, would one get one serial number that works on both platforms? I heard that you get two seats.  If I insta

  • Batch CMD for migrating reports 6i to 9i

    We are converting Oracle reports 6i to 9i(Oracle 10g) (we have approx 1000 reports to be converted). Let me know the batch command for converting reports 6i to 9i. Appreciate your feedback. Raj