Boolean Field in Oracle

I found this link useful. Here is the paragraph highlighting some of the pros/cons of each approach. The most commonly seen design is to imitate the many Boolean-like flags that Oracle’s data dictionary views use, selecting ‘Y’ for true and ‘N’ for false. However, to interact correctly with host environments, such as JDBC, OCCI, and … Read more

Auto Increment for Oracle

Create the table and the sequence SQL> create table staff ( 2 emp_id number primary key, 3 staff_name varchar2(100) 4 ); Table created. SQL> create sequence emp_id_seq; Sequence created. Now, you can create a trigger that uses the sequence to populate the primary key SQL> create trigger trg_emp_id 2 before insert on staff 3 for … Read more

When or Why to use a “SET DEFINE OFF” in Oracle Database

By default, SQL Plus treats ‘&’ as a special character that begins a substitution string. This can cause problems when running scripts that happen to include ‘&’ for other reasons: SQL> insert into customers (customer_name) values (‘Marks & Spencers Ltd’); Enter value for spencers: old 1: insert into customers (customer_name) values (‘Marks & Spencers Ltd’) … Read more