PL/SQL Programming Minute
时间:2010-07-22 来源:robinkev
1. Basic operation
SQL>sqlplus /nolog
SQL>conn / as sysdba
SQL>alter user hr account unlock
SQL>alter user hr identified by hr
SQL>grant DBA to hr
SQL>conn hr/hr
Select * from user_tables
Select * from dba_tables
SQL>revoke dba from hr
SQL>host dir drop*
select first_name ||','|| last_name from employees;
NVL: Set the value for NULL
NVL (name,'no name')
NVL (base_salary, 2000)
Display the table structure:
DESC employees;
2. SQL Plus
sqlplus [username[/password][@database]]]
connect scott/tiger@ora92
DEFINE: Declare a variable,short :DEF
DEFINE _EDITOR=vi
DESCRIBE: Lists the attributes of tables and other objects. short:DESC
show all: Display environment variable
SET: Modify the SQLPlus environment variable
SET SERVEROUT ON|OFF
SET ECHO ON|OFF
SET PAGE
SET TIME ON|OFF
SAVE D:\sql_name.sql
get D:\sql_name.sql
ed[it] D:\sql_name.sql
@D\sql_name.sql
rem
set pagesize n
set linesize n
select sysdate from dual; Get the system date