varchar2

Impact of defining VARCHAR2 column with greater length

时间秒杀一切 提交于 2019-11-26 20:23:07
问题 What are the effects of defining a column with VARCHAR2(1000) instead of VARCHAR2(10) in Oracle, when the values are not longer than 10 Byte? Does the column only take the space really necessary to store the values, or would that have any negative impacts on the size/performance of tablespaces/indexes? 回答1: The answer depends on whether you're talking about a column in a database table, or a variable in a PL/SQL program. Database column The amount of storage used is proportionate to the size

What is the major difference between Varchar2 and char

六月ゝ 毕业季﹏ 提交于 2019-11-26 00:29:13
问题 Creating Table: CREATE TABLE test ( charcol CHAR(10), varcharcol VARCHAR2(10)); SELECT LENGTH(charcol), LENGTH(varcharcol) FROM test; Result: LENGTH(CHARCOL) LENGTH(VARCHARCOL) --------------- ------------------ 10 1 Please Let me know what is the difference between Varchar2 and char? At what times we use both? 回答1: Simple example to show the difference: SELECT '"'||CAST('abc' AS VARCHAR2(10))||'"', '"'||CAST('abc' AS CHAR(10))||'"' FROM dual; '"'||CAST('ABC'ASVARCHAR2(10))||'"' '"'||CAST(