Tuesday, June 28, 2011

What are the Collections or Composite Datatypes in PL/SQL?

A Composite Datatypes are internal components that can be manipulated individually in PL/SQL are also called as PL/SQL Collections.

A PL/SQL collection is an ordered group of elements of the same type. It is a general concept that encompasses lists, arrays, and other familiar data types. Each element has a unique subscript that determines its position in the collection.

Three types of PL/SQL collections are in Oracle.

Index-by tables :

It is also known as associative arrays, let you look up elements using arbitrary numbers and strings for subscript values. They are similar to hash tables in other programming languages.Index-by tables is a non -persistent collection and it can’t store in the database.

Nested tables:

It can hold an arbitrary number of elements. They use sequential numbers as subscripts. You can define equivalent SQL types, allowing nested tables to be stored in database tables and manipulated through SQL.

Varrays :

Variable-Size Arrays (Varrays) can hold a fixed number of elements (although you can change the number of elements at runtime). They use sequential numbers as subscripts. You can define equivalent SQL types, allowing varrays to be stored in database tables. They can be stored and retrieved through SQL, but with less flexibility than nested tables.

Nested tables and Varrays are persistent collections and it is stored in database.

Tuesday, March 15, 2011

What are the process states in Unix?

As a process executes it changes state according to its circumstances. Unix processes have the following states:

Running : The process is either running or it is ready to run .

Waiting  : The process is waiting for an event or for a resource.

Stopped : The process has been stopped, usually by receiving a signal.

Zombie   : The process is dead but have not been removed from the process table.

When a program forks and the child finishes before the parent, the kernel still keeps some of its information about the child in case the parent might need it - for example, the parent may need to check the child's exit status.

To be able to get this information, the parent calls wait() In the interval between the child terminating and the parent calling wait() , the child is said to be a “zombie” state.
while using ps command, the child will have status  Z for Zombie.