Interviewer And Interviewee Guide

MySQL Programming Interview Question:

How To Convert Numeric Values to Character Strings?

Submitted by: Administrator
You can convert numeric values to character strings by using the CAST(value AS CHAR) function as shown in the following examples:

SELECT CAST(4123.45700 AS CHAR) FROM DUAL;
4123.45700
-- How to get rid of the last 2 '0's?

SELECT CAST(4.12345700E+3 AS CHAR) FROM DUAL;
4123.457

SELECT CAST(1/3 AS CHAR);
0.3333
-- Very poor conversion
Submitted by: Administrator

Read Online MySQL Programming Job Interview Questions And Answers
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.