How do I store percent value in MySQL using BigDecimal?
I used the following code to do so:
chngePer=new BigDecimal(st.nextToken().trim().replace("%", "")).divide(BigDecimal.valueOf(100));
but it gives me numberFormatException.
I am using a CSV file and storing each of its values in stringTokenizer st. One of its values is like -0.45%. How do I store it in the database?
StringTokenizer st=new StringTokenizer(nextLine, ",");
chngePer=new BigDecimal(st.nextToken().trim().replace("%", "")).divide(BigDecimal.valueOf(100));
edit : contents of token
Perhaps you need to remove the quotes.