The STR() function converts a numeric value to a character value.
STR(float_expression [, length [, decimal]])
Parameter : This method accepts three parameters as mentioned above and described below :
- float_expression : It is a numeric expression that evaluates to an approximate number with a decimal point.
- length : It is the total length of the returned string.
- decimal : It is the number of places to the right of the decimal point.
Returns : It returns a number as a string.
SELECT STR(246.573, 6, 2);
SELECT STR(246.573, 3, 3);
SELECT STR(246.573, 2, 2);
SELECT STR(246.573, 8, 4);
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.