Oracle SQL*Plus
Posted Mon, 2011-01-10 14:19 by Kayode Odeyemi
Connecting
- To connect to sqlplus, Type, sqlplus
- Oracle automatically connects to a default database. To find out which database, Type echo %oracle_sid% or echo $oracle_sid on UNIX
- To find out who u logged in as, Type define
- To connect as another user to another database, you don't need to exit. Just connect as follow: connect sys as sysdba;
- Every table in db belongs to a particular schema
Oracle basic datatypes
- number: can hold an integer and decimal
- varchar2: for variable characters
- char
- date: stores year, day, month, hour, minute, seconds
- timestamp: stores milliseconds
- LOB - large objects
- BLOB- binary large objects
- CLOB - character large objects
Editor Shortcuts
- find out which table the current use owns: Type select table_name from user_tables;
- To control the pagesize (something like pagination) of the query you run on sqlplus: Type set pagesize [number]
- To rerun or re-execute a preceeding query type /
- To know what query is in ur buffer, type l or list or just type the line number of the query
- To change the column name of ur last query, type c/[column name to change]/[new column name]
Dynamic Scripts
- Set linesize [number] - Set linesize for your query output
- Set pagesize [number] - Set pagesize for your query output
- col ename format a32 - format the column "ename"
- col sal format $999,999.00
- set pause on
Post new comment