************************************************************************ How to generate a sequence of numbers within Oracle, Example of Sequences in SQL: Assume we have executed the following create table statement. create table employees ( eno number(4) primary key, ename varchar(30), zip number(5), hdate date); Now we create a sequence object. We can create numerous sequence objects with different names, starting values and increments. The default increment is 1. As an example, we could create sequence EnumberSeq start with 1000; Now execute the following insert statements: insert into employees values (EnumberSeq.nextval, 'Tom Jones', 67226,'12-DEC-00'); Jones will be assigned a value of 1000 for column eno. insert into employees values (EnumberSeq.nextval, 'Ruth Brown',67226,'12-DEC-00'); Brown will be assigned a value of 1001 for column eno. If we want to insert the current value of the sequence EnumberSeq into a column of a row we can do that by using the reference: EnumberSeq.currval ************************************************************************ Example of Dates in SQL: Default format is 'DD-MON-YY" where DD is 2 digit day of month MON is 3 letter abbreviation for month YY is last 2 digits of year Other formats include MM 2 digit month DY 3 letter abbreviation for day YYYY 4 digit year Finding the current date: Select sysdate from dual; dual is a system defined dummy table with one column and one row. The to_char function allows us to reformat a date Select to_char(sysdate, 'DD-MON') from dual; ************************************************************************ Some useful tables that are part of the Oracle database catalog: user_catalog contains info about table name and table type user_tab_columns contains information about the columns in the tables user_tables contains much detailed information about the tables user_views contains information about views ************************************************************************