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

My PL/SQL practice 8/2/10

SQLPlus  :http://www.orafaq.com/wiki/SQL*Plus_FAQ
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/sqloperations.htm
1. Transfer values from a sql scripts:
   CNT=`sqlplus -s username/password1@dbname @getUVQuery_NULLCNT`;
 
   Note : Remeber to use option "-s"  (-s or -silent      -- start sqlplus in silent mode. Not recommended for beginners!)
   if not use "-s" , will return something as below :
        SQL*Plus: Release 10.2.0.3.0 - Production on Tue Feb 9 11:03:08 2010
    Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    0
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
2.getUVQuery_NULLCNT.sql
        set term off
    column cnt noprint new_value total
    SELECT count(inquiry_id) cnt
      from inquire_all_current a
     WHERE FORM_COMPLETE_STATUS = 'Y'
      and ITEM_POPULATE_STATUS = 'N'
     and expand_type='uvall'
    and uv_query is null
     ORDER BY INQUIRY_ID ASC;
    set term on
    prompt &total
    exit
3. Define cursor and use cursor:
    DECLARE
    CURSOR cur IS
    SELECT inquiry_id
      from inquire_all_current a
     WHERE FORM_COMPLETE


相关文档:

ORACLE SQL优化 ORACLE执行计划

Last login: Mon Feb  8 14:13:19 2010 from 192.168.1.249
ipnet
-bash-3.00$
-bash-3.00$ ipnet
-bash: ipnet: command not found
-bash-3.00$ su - oracle
Password:
eastcsu: incorrect password
-bash-3.00$ eastcom
-bash: eastcom: command not found
-bash-3.00$ su - oracle
Password:
[oracl ......

Oracle数据库获取当前用户连接数的sql语句

具体实现如下:
SQL> select count(*) from v$session  #连接数
SQL> Select count(*) from v$session where status='ACTIVE' #并发连接数
SQL> show parameter processes  #最大连接
SQL> alter system set processes = value scope = spfile;重启数据库  #修改连接 ......

SQL常用分页的办法

SQL常用分页的办法:
表中主键必须为标识列,[ID] int IDENTITY (1,1)
1.分页方案一:(利用Not In和SELECT TOP分页)
语句形式: 
SELECT TOP 页记录数量 *
from 表名
WHERE (ID NOT IN
  (SELECT TOP (每页行数*(页数-1)) ID
  from 表名
  ORDER BY ID))
  ORDER BY ID
//自 ......

SQL Server 2000 Java开发中当前日期的处理

1、在数据库建表的时候字段直接设置为DATETIME类型;
2、执行插入的时候使用如下语句:
PreparedStatement pstmt = conn.prepareStatement("insert into guestbook(gst_user,gst_title,gst_content,gst_ip,gst_time) values(?,?,?,?,getdate())");
3、要把日期从数据库中取出,执行如下语句:
     ......

获取局域网SQL Server实例信息

由于代码过于简单,直接贴出:
SqlDataSourceEnumerator SseInstance = SqlDataSourceEnumerator.Instance;
//ServerName:服务器名;
//InstanceName:实例名;
//IsClustered:是否为群集服务器的一部分;
//Version:版本,8.*是SQL 2000,9.*是SQL 2005
DataTable DtSqlInstance = SseInstance.GetDataSources();

注: ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号