易截截图软件、单文件、免安装、纯绿色、仅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


相关文档:

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、要把日期从数据库中取出,执行如下语句:
     ......

【小小问题集锦13之 关于分组加顺序号的SQL写法】


/*
原表:  
thid      other  
a              1  
a              1  
b              0  
b              0  
......

三种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
//自己还可以加上一些查询 ......

让powerdesigner生成的sql在mysql下正确运行

如果按照powerdesigner的默认选项,生成的sql不能在mysql中正确运行.]
经过本人研究发现要做如下修改:
  1.aftercreate选项改为
.foreach_item(OutReferences)
   .ifnot (%hasFKIndex%)
/*==============================================================*/
/* Index: ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号