Merve Olamlı

Archive for September, 2007

SPOOL COMMAND

Posted by merveolamli on September 12, 2007

‘spool … ’ command is used to send queries and their results to a file. This can be said, it is like a screen shot format of the commands to the file. You have to spool on and spool off between which executions to store. But there are two different output files when spooling in different editors, for sqlplus command line and for pl/sql developer. After connecting to the database:

* In sqlplus command line:

SQL> spool on
SQL> spool c:\spool_here.txt
SQL> select count(*) from user_objects;
COUNT(*)
———-
71

SQL> spool off

–The output in the spool_here.txt file is:

SQL> select count(*) from user_objects;
COUNT(*)
———-
71

SQL> spool off


* In pl/sql developer command window:

SQL> spool c:\spool_here.txt
Started spooling to c:\spool_here.txt

SQL> select count(*) from user_objects;
COUNT(*)
———-
71

SQL> spool off
Stopped spooling to c:\spool_here.txt

–The output in the spool_here.txt file is:

COUNT(*)
———-
71

According to this test situation, it can be said that, pl/sql developer only takes the outputs of the queries while sqlplus command window takes all the written queries and their outputs.
In addition to this, you cannot see any output in the output files until ‘spool off ’ command executes.

Posted in Oracle | Leave a Comment »

LOGIC QUESTION

Posted by merveolamli on September 12, 2007

Today, I read an advertising with a title ‘Do You Want To Work in Google ?’ and under this topic, there were many logic questions asked in its interviews. At first sight, one of them seemed to be solvable:

There are four people who have to pass beyond a rope bridge at night. But they have only one torch and its battery will be exhausted in 17 minutes. On the other hand, the bridge is not hardy to allow more than two persons to pass and also without torch. The people have different speeds. One passes in 1 minute, other one in 2 minutes, the third one in 5 minutes and the slowest one in 10 minutes. How can it be?

This one is not hard to solve, I tried and was successful ;)

Posted in Daily Topic | 1 Comment »

DATA INTEGRITY

Posted by merveolamli on September 3, 2007

In the applications, we want to prevent insertion, manipulation or deletion of invalid data to satisfy data integrity. So, to provide acceptable information, we have to apply some rules.

Data integrity is helpful for enforcing types of rules associated with the database. For instance, validity of data, manipulation and navigation of data in the tables correctly. Let’s explain the rules applied to table columns for data integrity.

First one is Null Rule, which is defined on a single column and controls if the value in this column can contain null values while insertion or deletion. Second one is Unique Column Rule, it can be defined on one or more columns. It controls if the column (s) contain unique values. According to this rule, values of these columns can contain null values. The Third one is Primary Key Rule, that is defined as a key value on a column or set of columns. It satisfies each row in the table can be uniquely defined. The difference to the Unique Column Rule is, none of the values can contain null values in Primary Key Rule. The other one is Referential Integrity Rules which are used frequently. The definition for this rule is the necessity of existence of a column or set of columns also in the referenced table. It controls the data manipulations on the referential values. The last one is Complex Integrity Checking. This is a user defined rule that checks insertion, deletion and update operations on a column or more than one columns.

Oracle enforces data integrity by definitions. Integrity constraints and triggers help these rules to be applied to the database.

Posted in Oracle | Leave a Comment »