Results 1 to 3 of 3

Thread: Data type in SQL

  1. #1
    Contributing Member
    Join Date
    May 2006
    Answers
    75

    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?


  2. #2
    Junior Member
    Join Date
    Apr 2006
    Answers
    24

    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.


  3. #3
    Contributing Member
    Join Date
    May 2006
    Answers
    85

    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
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact