24 September, 2017

Casting Data Type in Oracle Database

CAST function 
The CAST function converts a value from one data type to another data type.

Syntax
CAST ( [ Expression | NULL | ? ] AS Datatype)

Note : CAST conversions among SQL-92 data types.
The flowing are SQL-92 data types
  1. BOOLEAN
  2. SMALLINT
  3. INTEGER
  4. BIGINT
  5. DECIMAL
  6. REAL
  7. DOUBLE
  8. FLOAT
  9. CHAR
  10. VARCHAR
  11. LONG VARCHAR
  12. CHAR
  13. VARCHAR
  14. LONG VARCHAR
  15. CLOB
  16. BLOB
  17. DATE
  18. TIME
  19. TIMESTAMP
  20. XML
Examples
SELECT CAST (SYSDATE AS VARCHAR2 (12)) DATE_TO_VARCHAR FROM DUAL;
SELECT CAST ('12' AS INTEGER)  STRING_TO_NUMBERIC FROM DUAL;
SELECT CAST (NULL AS VARCHAR2 (2)) NULL_TO_STRING FROM DUAL;

As CAST only convert among SQL-92 data types, we can not use for example RAW data type.
But there are some packages casts to RAW like utl_raw.cast_to_raw

SELECT UTL_RAW.CAST_TO_RAW('Mahmoud') FROM DUAL;
output is : "4D61686D6F7564"

17 comments:

  1. Such an amazing blog! Thanks for sharing this useful information... please keep posting.
    Web Development Company in Delhi

    ReplyDelete
  2. Nice Article..!
    Those who come to read your Information will find lots of helpful and informative tips.
    Website Development Company in Pune,Bangalore,Delhi
    Web Development Company in Pune,Bangalore,Delhi

    ReplyDelete
  3. Excellent and decent post. I found this much informative, as to what I was exactly searching for. Thanks for such post and please keep it up.
    Weblife Infotech Pvt. Ltd.

    ReplyDelete
  4. I read your blog it is very good and you are doing a great job for helping others. I really appreciate what content you are giving to your viewers.
    Website Design Delhi

    ReplyDelete
  5. FiveRivers has been at the cutting edge of technology since 2003, pioneering Virtualization and Systems Management technology for Enterprise and Embedded systems, developing globally top ranked mobile applications downloaded tens of millions of times and winning international awards for our work. But for all the trails we’ve blazed, we’ve never been as excited about the future as we are now.

    ReplyDelete
  6. Thank you for very Useful informative blog this is helpful for beginner web designer

    ReplyDelete
  7. It’s very straightforward to find out any matter on net as compared
    to textbooks, as I found this paragraph at this site.
    social media marketing
    digital marketing

    ReplyDelete
  8. THIS is very informative blog.Visit our sitefor more information

    ReplyDelete
  9. Good post.latest technology news
    This site provided informative information.

    ReplyDelete
  10. SS-WEBSOLUTION is a digital marketing company in Pakistan that offers various services to its clients. We are passionate about what we do and it reflects in our work.We are a professional online marketing company. We provide best Digital Marketing Services in Pakistan and also around the globe.

    ReplyDelete
  11. This is an excellent blog.Thanks for sharing.For Best applestockprice Visit Us.

    ReplyDelete
  12. IIS India, a leading web designing company in Delhi, specializes in crafting stunning and functional websites. Our expert team combines creativity and technical expertise to deliver custom web solutions.

    ReplyDelete
  13. Transform your future with our Oracle Training In Chennai at Infycle Technologies. Dive into the world of databases and master Oracle's powerful tools and technologies. You will be guided by our knowledgeable professors via practical training, ensuring that you acquire the skills required for in-demand professions. Join us to unlock opportunities and excel in data management with our Oracle course. Enrol today for a brighter tomorrow! For details, call us at +91-750263363 or +91-7504633633.

    ReplyDelete

ADF : Scope Variables

Oracle ADF uses many variables and each variable has a scope. There are five scopes in ADF (Application, Request, Session, View and PageFl...