8/7/2019 ClientSoftware
1/24
Using Oracle SQLTips and TechniquesDatabase Management SystemsFundamentals
CSCI 2020
8/7/2019 ClientSoftware
2/24
Oracle's Structure
CORE
JDBCInterface
Pro-C
SQL
PL-SQL
SQLPlus
Data
HTTP Server
PHPInterface
ODBCInterface
8/7/2019 ClientSoftware
3/24
Oracle at ETSU
The dept. has an Oracle server
Server pythi
a.etsu.edu Database SID csdb.etsu.edu
You have an account:
User Name is the same as your campus account
Password is initially dbms
8/7/2019 ClientSoftware
4/24
Choices
SQL-Developer
Available f
or d
ownl
oad fr
om ORACLE
ECLIPSE add-on
Full package on course site
SQL-Plus Instant Client
Available for download from ORACLE Install Instructions on course site
.Visual Studio add-on
Available for download from ORACLE
8/7/2019 ClientSoftware
5/24
SQL Plus Instant Client
8/7/2019 ClientSoftware
6/24
SQL
Developer
8/7/2019 ClientSoftware
7/24
ECLIPSE in the labs
From Window chooseOpen Perspectivethen chooseOther
8/7/2019 ClientSoftware
8/24
ECLIPSE in the labs
Choose SQL Explorer
Then click OK
8/7/2019 ClientSoftware
9/24
ECLIPSE in the labs
If the Connection Window is not visiblego to Window then choose Show View andselect the Connections window
8/7/2019 ClientSoftware
10/24
ECLIPSE in the labs
In the Connection Windowright click ETSU_SERVER andselectConnect New User
8/7/2019 ClientSoftware
11/24
ECLIPSE in the labs
Fill in your User and
Password and thenuncheck theAutoCommit boxand press OK
You will connect
8/7/2019 ClientSoftware
12/24
ECLIPSE in the labs
The SQL Editor will appearhere you can enter yourcommands. When ready toexecute them click the
Running Man icon on thetoolbar
8/7/2019 ClientSoftware
13/24
ECLIPSE in the labs
Your output willappear in the paneright below . Toclear the SQLEditor Windowfor the next
command click theEraser Icon onthe tool bar.
8/7/2019 ClientSoftware
14/24
ECLIPSE in the labs
To load a file ofcommands clickon the FolderIcon on thetoolbar and
locate the file
8/7/2019 ClientSoftware
15/24
ECLIPSE in the labs Your can save thecontents of an SQLEditor Windowclick the Diskette
Icon on the toolbar.
Then choose no
to save the codeoutside of aproject.
8/7/2019 ClientSoftware
16/24
ECLIPSE in the labs
The Save as
dialog boxwill appear toallow you tosave the file
8/7/2019 ClientSoftware
17/24
ECLIPSE in the labs
All of your past commandsare accessible through theSQL History Window
8/7/2019 ClientSoftware
18/24
ECLIPSE in the labs
The Database Structure Windowallows you to browse the tables in youruser
8/7/2019 ClientSoftware
19/24
ECLIPSE in the labs
The Database Detail Window gives many type ofinformation on the tables from the Database
Structure Window the Columns Tab lists everycolumn in the table and their column types
8/7/2019 ClientSoftware
20/24
ECLIPSE in the labs
The Preview Tab shows you the content of the table
8/7/2019 ClientSoftware
21/24
ECLIPSE in the labs
When you are done goto the ConnectionWindow, highlight youruser name and close allof the connections for
your user
8/7/2019 ClientSoftware
22/24
Commit Protocol
COMMIT
Make ch
anges parto
f permanent DB ROLLBACK
Undo changes back to beginning or last orspecified SAVEPOINT
Auto-Commit SET AUTOCOMMIT ON Immediate
SET AUTOCOMMIT OFF Deferred
8/7/2019 ClientSoftware
23/24
Data Types Character VARCHAR2(n)VARCHAR2(n) CHAR (n)CHAR (n) LONG CLOB
Numeric NUMBER (p,s)NUMBER (p,s)
x INTEGER, INT s = 0x REAL, FLOAT, DECIMAL
Times
D
ATED
ATE TIMESTAMP Binary
RAW(N) LONGRAW BLOB XML
8/7/2019 ClientSoftware
24/24
Data Type Surprises
NULL anyother value Int NULL 0
Char NULL
Date NULL
Date Default Format dd-mon-yyyy
To get it to display correctly (sql+ only) add this toyour command filesx alter session set nls_date_format = 'dd-mon-yyyy';