Oracle SQL, PLSQL, APEX How To's by Dr. S. Raghunathan - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.

Let us create one small test table as follows with the following scripts

 

create table staff-master ( name varchar2(100), date-ob-birth date, pay number(16,2));

How to insert I add I write records into a table I file

 

-- column values are in default order of creation

 

Now, we shall give the data in the same column order with which table created'

SYNTAx : INSERT INT staff-master VALUES ( 'ABILASH' , '01- JUL-1990', 40000'00)

RESULT: One row successfully inserted:

 

-- column values are in jumbled order

 

We like to give data in Jumbled order like date-of-birth, pay and name

 

 

 

SYNTAx: insert into staff-master (date-of-birth, pay, name ) values ('17- sep-1983', 37000, 'loreta chandy')

-- lesser number of column values given

 

We may like to give name and pay alone'

 

SYNTAx : INSERT INTO STAFF-MASTER (NAME,PAY ) VALUES ('KAVERY SINDIYA',17000)

-- column values fed, based on system prompt

 

Here we have to use bind variables' SQL-command window accepts : colon as bind variable operator and DOS SQL prompt will treat & ampersand symbol as bind variable'

SYNTAx:INSERT INTO STAFF-MASTER (NAME,PAY,DATE-OF-BIRTH ) VALUES (:NAME-PLEASE,:PAY-PLEASE,:DOB-PLEASE)

-- creation of another table along with existing data