-
Contributing Member
Data type in SQL
Can we insert an alphanumeric data into numeric data type. If not how can I achieve this by converting or by using some functions?
-
Junior Member
Re: Data type in SQL
No. you can't insert alphanumeric data in numeric column. there are some functions to convert the data type like to_number(), to_char(), to_date() in Oracle.
if your data is between 0-9 that is stored in a charactor column For Eg. your column is customer_id & is char as datatype, you can use it as number using to_number(customer_id). But this is possible ONLY when your data is pure numeric i.e.(0-9) if there is any charactor like A-Z a-z &/OR any special charactors, this function won't work.
You can turn the numeric data into charactor type using to_char(columnname) or to_char(value) but not vice versa.
-
Contributing Member
Re: Data type in SQL
The usage of the functions to_char, to_date and to_number is given below:
TO_CHAR - This transforms data type DATE or NUMBER into character string
TO_DATE - This transforms data type NUMBER, VARCHAR, CHAR into DATE
TO_NUMBER - This convert data type CHAR or VARCHAR into NUMBER
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules