Wednesday 8 February 2017

        
 Difference between CHAR and VARCHAR2
     CHAR should be used for storing fix length character strings. String values will  be space/blank padded before stored on disk. If this type is used to store  varibale length strings, it will waste a lot of disk space.VARCHAR2 is used to  store variable length character strings. Max.Size of both is 32767 bytes
      Do you have create table column's with Boolean datatype?
        No there doesn't exist type boolean,but instead of this you can you 1/0(type number),or 'Y'/'N'(type char),or 'true'/'false' (type varchar2). There is a boolean type for use in pl/sql, but none that can be used as the data type of a column
          Do you know any character data type without char,varchar2 ?
            Nvarchar stores UNICODE data. If you have requirements to store UNICODE or multilingual data, nvarchar is the choice. 
              Varchar stores ASCII data and should be your data type of choice for normal use. Regarding memory usage, nvarchar uses 2 bytes per character, whereas varchar uses 1
                Do you know any number datatype without number & integer?
                  REAL - Approximate numerical, mantissa precision 7
                    FLOAT - Approximate numerical, mantissa precision 16
                      BIGINT - Integer numerical (no decimal). Precision 19


                          How to create a BLOB, syntax of blob.
                            { BLOB | BINARY LARGE OBJECT } [ ( length [{K |M |G }] ) ]
                              create table pictures(name varchar(32) not null primary key, pic blob(16M));


                                What is the structure of varchar.
                                  VARCHAR data type is also used for storing variable strings and maximum allowed characters are 2000. It is subset of VARCHAR2 data type and it is currently synonymous with VARCHAR2. 
                                    What is fundamental difference between VARCHAR2 and VARCHAR?
                                      VARCHAR follows ANSI standard, however VARCHAR2 does not. ANSI standard differentiate between NULL and empty string. 
                                        In other words, for VARCHAR data type - NULL and "" is different thing, while for VARCHAR2 both NULL and "" is same.
                                          Note:Oracle recommends to use VARCHAR2 over VARCHAR, since VARCHAR is reserved for future and VARCHAR's meaning might change in a new version of the ANSI SQL standards.  

                                            What are the char datatypes?
                                              CHAR Datatype. The CHAR datatype specifies a fixed-length character string. ...
                                                NCHAR Datatype. The NCHAR datatype is a Unicode-only datatype. ...
                                                  NVARCHAR2 
                                                    VARCHAR2 
                                                      VARCHAR 


                                                          What is blob/bfile?

                                                            The built-in LOB data types BLOB, CLOB and NCLOB (stored internally), and BFILE (stored externally), 
                                                              can store large and unstructured data such as text, images and spatial data up to 4 gigabytes in size. BLOB.The BLOB data type stores binary large objects. BLOB can store up to 4 gigabytes of binary data.

                                                                What is clob?
                                                                  A CLOB is a data type used by various database management systems, including Oracle and DB2.It stores large amounts of character data, up to 4 GB in size. The CLOB data type is similar to a BLOB, but includes character encoding,which defines a character set and the way each character is represented
                                                                    Why boolean datatype is not possible to create a table column?
                                                                      Oracle does not support the boolean data type at schema level, though it is supported in PL/SQL blocks. By schema level,I mean you cannot create table columns with type as boolean, nor nested table types of records with one of the columns as boolean. You have that freedom in PL/SQL though, where you can create a record type collection with a boolean column.

                                                                        As a workaround I would suggest use CHAR(1 byte) type, as it will take just one byte to store your value, as opposed to two bytes for NUMBER format. Read more about data types and sizes here on Oracle Docs.

                                                                        No comments:

                                                                        Post a Comment