HomeНаука и техникаRelated VideosMore From: Caleb Curry

Oracle SQL Tutorial 32 - VARCHAR2 and NVARCHAR2

93 ratings | 5399 views
This video we are going to discuss the VARCHAR2 and the NVARCHAR2 data types. The previous videos are a good foundation to this video. I've actually discussed so much stuff in those videos that I don’t have a whole lot to say. Good for you, right? I discussed over the previous videos that you should prefer to use VARCHAR2 over CHAR. That's because there is not a difference in performance or storage for a VARCHAR2 column. The only difference is that an CHAR column forces each value to take up a certain length even if it's not. There is one difference between the variable length and fixed length data types here that you need to know about, and that is storage limits. CHAR has a limit of 2000 bytes, while VARCHAR2 has a limit of 4000 bytes. That means you can store twice as much junk in a VARCHAR2 column! Other than that, these data types work exactly the same. I recommend you always use the VARCHAR2 data types instead of the CHAR data types, and only use NVARCHAR2 if you have a non-Unicode database. This will allow you to store Unicode characters in a column. Now, the amount of storage you can put in a VARCHAR2 column is twice what you can put in a CHAR column, but 4000 characters is still not very many characters. This is where the LOB data types come in, which we will discuss in the next video! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Support me! http://www.patreon.com/calebcurry Subscribe to my newsletter: http://bit.ly/JoinCCNewsletter Donate!: http://bit.ly/DonateCTVM2. ~~~~~~~~~~~~~~~Additional Links~~~~~~~~~~~~~~~ More content: http://CalebCurry.com Facebook: http://www.facebook.com/CalebTheVideoMaker Google+: https://plus.google.com/+CalebTheVideoMaker2 Twitter: http://twitter.com/calebCurry Amazing Web Hosting - http://bit.ly/ccbluehost (The best web hosting for a cheap price!)
Html code for embedding videos on your blog
Text Comments (7)
Akz Nu (3 months ago)
I believe varchar2 in oracle can store upto 32767 bytes of data. Correct me if I am wrong.
surya bhusal (6 months ago)
Sometimes while checking user is offline or online 1/0. That case i think char might be useful. Please correct me.
stride7860 (1 year ago)
Hey Caleb, you mentioned at about 1:30 that you should never really use char and that if we had any feedback on this you would like to hear it. Char is great for columns that contain data that can be expected to always hold the same amount of characters when entered appropriately. For example, Zip codes, area codes (in the event of atomic data in columns), state abbreviations, and middle initials. You could use varchar2 in that case as well and just limit to the same max length, but when processing large amounts of data varchar2 columns have a little bit more processing overhead so it's totally unnecessary. There is debate about how much of an issue that processing overhead is, but it really depends on your data and expected growth.
Miko BeowulfXD (1 year ago)
CAN u plz make more videos?
David Zaberca (1 year ago)
Thanks for the videos. It's a shame you stopped before Selects.
Armon McCord (2 years ago)
Caleb how can I get in touch with you???
Hazem Fntp (2 years ago)
I really want to thank you for all your videos, I encourage you to continue :) ...

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.