Oracle Training in Hyderabad
Oracle Training in Hyderabad
Overview
Presented By
Kelly Technologies
www.kellytechno.com
ORACLE TERMS
Schema logical collection of users objects
Tablespace logical space used for storage
Datafile physical file used for storage
Extent group of contiguous blocks
Block unit of physical storage
www.kellytechno.com
ORACLE
ARCHITECTURE
Database
Instance
Parameter files*
Control files**
Data files
Redo Log files
Disk
Memory
MySQL
Three
Oracle
Many
files
Many roles/permissions possible
www.kellytechno.com
by SYS
created by catalog.sql script at db creation
contain DDL info
dynamic
also
referred to as V$ views
based on virtual tables (X$ tables)
provide info about the instance
www.kellytechno.com
Dual table
SELECT 1+1*400 FROM DUAL;
inserting apostrophes
SYSDATE
Sysdate
www.kellytechno.com
ROWID
ROWID
7: BBBBBBB.RRRR.FFFFF
Oracle 8: OOOOOO.FFF.BBBBBB.RRR
Called
SELECT *
FROM emp, dept
WHERE emp.deptno(+)=dept.id;
www.kellytechno.com
lower()
Substr(), replace(), rtrim(), concat()
Length()
Floor(),
Add_months(),
last_day()
To_date(),
months_between(),
to_char(), to_lob()
www.kellytechno.com
MORE FUNCTIONS
nvl()
If
Nvl(lastname,Anonymous)
decode()
Sort
Decode(gender,0,Male,1,Female,Unknown)
www.kellytechno.com
oerr facility
www.kellytechno.com
CONSTRAINTS
Primary key
Foreign key
Unique, not null
Check
Name your constraints
User constraints, user_cons_columns
SELECT
user_constraints.constraint_name name,
constraint_type type,
user_constraints.search_condition
FROM user_constraints, user_cons_columns
WHERE
user_constraints.table_name=user_cons_columns.table_name
AND user_constraints.constraint_name=user_cons_columns.constraint_name
AND user_constraints.owner=user_cons_columns.owner
AND user_constraints.table_name=TEST;
NAME
T SEARCH_CONDITION
--------------- - ------------------------COL3_CK
C col3 IN ('yes','no')
TEST_PK
P
www.kellytechno.com
CONSTRAINTS
Oracle
enabling
and disabling
EXCEPTIONS table
run
www.kellytechno.com
MORE OBJECTS
Sequences
creating
the sequence
selecting
Synonyms
provide
PL/SQL TRIGGERS
Executed
Referencing
www.kellytechno.com
TRIGGER EXAMPLE
SQL> desc all_triggers;
Name
Null?
------------------------------- -------OWNER
TRIGGER_NAME
TRIGGER_TYPE
TRIGGERING_EVENT
TABLE_OWNER
BASE_OBJECT_TYPE
TABLE_NAME
COLUMN_NAME
REFERENCING_NAMES
WHEN_CLAUSE
STATUS
DESCRIPTION
ACTION_TYPE
TRIGGER_BODY
Type
---VARCHAR2(30)
VARCHAR2(30)
VARCHAR2(16)
VARCHAR2(75)
VARCHAR2(30)
VARCHAR2(16)
VARCHAR2(30)
VARCHAR2(4000)
VARCHAR2(128)
VARCHAR2(4000)
VARCHAR2(8)
VARCHAR2(4000)
VARCHAR2(11)
LONG
www.kellytechno.com
www.kellytechno.com
www.kellytechno.com
REMEMBER THOSE
VIEWS?
Query
Query
UNDERSTANDING INDEXES
Index
overhead
impact
Use
Examples:
yes/no
true/false
male/female
www.kellytechno.com
THANK
YOU
www.kellytechno.com