Monday, January 17, 2011

Database Link

When you wanted to have tables of different database server then go for creating a database link. The syntax for creating the link is

Create database link <linkname>
connect to <user> identified by <pwd>
using 'service name';

The above is for creating a private fixed link. The service name is the alias name given in the TNS entry file. If in case it is not able to read the host properly then copy the description part of the TNS instead of service name.

Thursday, January 13, 2011

About PLS_INTEGER Data Type

  • When declaring an integer variable, PLS_INTEGER is the most efficient numeric datatype because its values require less storage than INTEGER or NUMBER values, which are represented internally as 22-byte Oracle numbers.
  • PLS_INTEGER operations use machine arithmetic, so they are faster than BINARY_INTEGER, INTEGER, or NUMBER operations, which use library arithmetic.
  • Use of the PLS_INTEGER data type in PL/SQL involves less internal instructions to process, thus increasing performance. The PLS_INTEGER is useful for counters and integer operations

Tuesday, January 11, 2011

View Procedure Definition in SQL Plus

To view the procedure definition in SQL* Plus, do the following

1) If ownere of the procedure then execute
      Select text from user_source where name = <proc_name>;

2) If your are not the owner of the procdure then execute
      Select text from all_source where name = <proc_name>;