易截截图软件、单文件、免安装、纯绿色、仅160KB

SQL*Plus FAQ

 What is SQL*Plus and where does it come from?
SQL*Plus is a command line SQL and PL/SQL language interface and reporting tool that ships with the Oracle Database Client and Server software. It can be used interactively or driven from scripts. SQL*Plus is frequently used by DBAs and Developers to interact with the Oracle database.
If you are familiar with other databases, sqlplus is equivalent to:
"sql" in Ingres,
"isql" in Sybase and SQL Server,
"sqlcmd" in Microsoft SQL Server,
"db2" in IBM DB2,
"psql" in PostgreSQL, and
"mysql" in MySQL.
SQL*Plus's predecessor was called UFI (User Friendly Interface). UFI was included in the first Oracle releases up to Oracle 4. The UFI interface was extremely primitive and, in today's terms, anything but user friendly. If a statement was entered incorrectly, UFI issued an error and rolled back the entire transaction (ugggh).
 How does one use the SQL*Plus utility?
Start using SQL*Plus by executing the "sqlplus" command-line utility from the $ORACLE_HOME/bin directory. Some of the command line options:
userid/password@db -- Connection details
/nolog             -- Do not login to Oracle. You will need to do it yourself.
-s or -silent      -- start sqlplus in silent mode. Not recommended for beginners!
@myscript          -- Start executing script called "myscript.sql"
Look at this example session:
sqlplus /nolog
SQL> connect scott/tiger
SQL> select * from tab;
SQL> disconnect
SQL> exit
Please note that one must prepare the environment before starting sqlplus.
Linux/ Unix example:
$ . oraenv
ORACLE_SID = [orcl] ? orcl
$ sqlplus scott/tiger
Windows Example:
Click on "Start" -> "Run" and enter "cmd"
C:> set ORACLE_SID=orcl
C:> sqlplus scott/tiger
or...
C:> sqlplus scott/tiger@orcl
 What commands can be executed from SQL*


相关文档:

Sql Server中如何判断表或者数据库的存在

sql server中如何判断表或者数据库的存在,但在实际使用中,需判断Status状态位:
其中某些状态位可由用户使用 sp_dboption(read only、dbo use only、single user 等)进行设置:
1 = autoclose;使用 sp_dboption 设置。 数据库完全关闭,其资源在最后一个用户注销后释放。
4 = select into/bulkcopy;使用 sp_dbopti ......

SQL时间转换格式

select Convert( varchar(20) , 时间字段 , 格式 ) from 表 如:select Convert(varchar(20),LOGIN_DATE,112) from dbo.C_PARTY_CLIENT 100:Jun 22 2009 12:00AM 101:06/22/2009 102:2009.06.22 103:22/06/2009 104:22.06.2009 105:22-06-2009 106:22
select Convert(varchar(20),<时间字段>,<格式>) f ......

解决SQL 死锁的语句

ALTER     procedure [dbo].[sp_lock_check]
@spid1 int = NULL,               
@spid2 int = NULL               
as
set nocount on
if @spid1 is not NULL
begin
        select ......

PL/SQL学习笔记五


游标是从数据库中提取出来的数据,以临时表的形式存放在内存中,在游标中有一个数据指针,在初始状态下指向首记录, 利用fetch语句移动该指针,从而对游标中的数据进行各种操作。
1.定义游标
cursor 游标名 is select语句;
2.打开游标
open 游标名;
3.提取游标数据
fetch 游标名 into 变量名1, 变量名2, ....;
或 ......

SQL触发器

一个简单的小实例就明白~!
 user表
在这张表中建立触发器  
 Create   trigger   tiggername  
 on   user     
 for   delete     
 as   
 begin ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号