Character types, PL-SQL Programming

Assignment Help:

ROWID and UROWID

Internally, every database table has a ROWID pseudo column that stores binary values known as rowids. Each rowid shows the storage address of a row. A physical rowid identify a row in an ordinary table. A logical rowid identify a row in an index-organized table. The ROWID datatype can store only physical rowids. Thgough, the UROWID (the universal rowid) datatype can store logical,physical, or foreign (non-Oracle) rowids.

Physical Rowids

The Physical rowids provide a fast access to the particular rows. As long as the row exists, its physical rowid does not change. The Efficient & stable, physical rowids are very useful for selecting a set of rows, operating on the entire set, and then updating a subset. For e.g. , you can compare a UROWID variable with the ROWID pseudocolumn in the WHERE clause of an UPDATE or DELETE statement to identify the newest row fetched from a cursor.

Logical Rowids

The Logical rowids provide the fastest access to the particular rows. The Oracle uses them to construct the secondary indexes on index-organized tables. Having no permanent physical address, a logical rowid can move across the data blocks when new rows are inserted. Though, if the physical location of a row changes, its logical rowid remain valid.

VARCHAR2

You use the VARCHAR2 datatype to store the variable-length character data. How the data is represented internally is totally depend on the database character set. The VARCHAR2 datatype takes a required parameter that specifies the maximum length of up to 32767 bytes. The syntax is as shown below:

VARCHAR2(maximum_length)

You cannot use a constant or variable to specify the highest length; you should use an integer literal in the range 1 to 32767.

The VARCHAR2 datatype includes a trade-off between efficiency and memory use. For a VARCHAR2(>= 2000) variable, the PL/SQL dynamically allocates only enough memory to hold the actual value. Though, for a VARCHAR2 (< 2000) variable, the PL/SQL pre allocates enough memory to hold a maximum-size value.

VARCHAR2 Subtypes

The VARCHAR2 subtypes shown below have the same range of values as their base type. For illustration, the VARCHAR is just another name for VARCHAR2.

STRING

VARCHAR

NLS Character Types

Though the widely used 7- or 8-bit ASCII and EBCDIC character sets are sufficient to represent the Roman alphabet, some Asian languages, like Japanese, contain many characters. These languages need 16 bits (two bytes) to represent each character. How does Oracle deal with such unlike languages?

The Oracle provides National Language Support (NLS) that process single-byte & multi-byte character data and convert between the character sets. It also lets your applications run in various language environments.

NCHAR

You use the NCHAR datatype to store the fixed-length NLS character data. How the data is represented internally, totally depends on the national character set, which might use a fixed-width encoding like US7ASCII or a variable-width encoding like JA16SJIS. The NCHAR datatype takes an optional parameter that specifies the highest length of up to 32767 bytes. The syntax is as shown below:

NCHAR[(maximum_length)]

You cannot use a variable or constant to specify the maximum length; you must use an integer literal in the range 1 to 32767.

NVARCHAR2

You use the NVARCHAR2 datatype to store the variable-length NLS character data. How the data is represented internally totally depends on the national character set, that might use a fixed-width encoding like WE8EBCDIC37C or a variable-width encoding like JA16DBCS. The NVARCHAR2 datatype takes a required parameter which specifies a maximum length of up to 32767 bytes. The syntax is as shown below:

NVARCHAR2(maximum_length)

You cannot use a variable or constant to specify the maximum length; you must use an integer literal in the range 1 to 32767.


Related Discussions:- Character types

Grouping and ungrouping in sql, Grouping and Ungrouping in SQL Example...

Grouping and Ungrouping in SQL Example specifying EXAM_MARK in place of COURSE in the main FROM clause. Example: Obtaining C_ER2 from EXAM_MARK SELECT CourseId, CAST

What is a collection, What Is a Collection The collection is an ordered...

What Is a Collection The collection is an ordered group of elements, all of similar type (for e.g. the grades for a class of students). Each element has a unique subscript whic

Control structure, Control Structures The Control structures are the mo...

Control Structures The Control structures are the most important PL/SQL extension to the SQL. Not only does PL/SQL let you manipulate Oracle data, it lets you process the data

Assignments in pl/sql, Assignments in pl/sql The Variables and constants...

Assignments in pl/sql The Variables and constants are initialized every time a block or subprogram is entered. By default, the variables are initialized to NULL. Therefore, unle

Manipulating collections-nested table examples, Manipulating Collections ...

Manipulating Collections Within PL/SQL, the collections add procedural power and flexibility. The biggest benefit is that your program can compute subscripts to process the spec

Deleting objects in pl sql, Deleting Objects You can use the DELETE st...

Deleting Objects You can use the DELETE statement to eradicate objects from an object table. To eradicate objects selectively, you use the WHERE clause, as shown below: BEG

Providing results of queries, Providing Results of Queries Expressing ...

Providing Results of Queries Expressing queries in SQL is the (big) subject. Here I present just a simple example to give you the flavour of things to come in those chapters.

Parameter and keyword description - select into statement, Parameter and Ke...

Parameter and Keyword Description: select_item: This select_item is a value returned by the SELECT statement, and then assigned to the equivalent variable or field in the

Updating variables, Updating Variables For assignment, SQL uses the ke...

Updating Variables For assignment, SQL uses the key word SET, as in SET X = X + 1 (read as "set X equal to X+1") rather than X: = X + 1 as found in many computer languages.

Calculating a Shopper''s Total Spending, Many of the reports generated from...

Many of the reports generated from the system calculate the total dollars in a shopper''s purchases. Follow these steps to create a function named TOT_PURCH_SF that accepts a shopp

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd