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
相关文档:
用Java连接SQL Server2000数据库有多种方法,下面介绍其中最常用的两种(通过JDBC驱动连接数据库)。
1. 通过Microsoft的JDBC驱动连接。此JDBC驱动共有三个文件,分别是mssqlserver.jar、msutil.jar和msbase.jar,可以到微软的网站去下载(http://www.microsoft.com/downloads/details.aspx?FamilyId=07287B11-0502-461A- ......
----start
通常SQL PL只能使用在存储过程、触发器、用户自定义函数中,但是有一部分SQL PL也可以直接在命令行编辑器或脚本中使用,它们是:
DECLARE <variable>
SET
CASE
FOR
GET DIAGNOSTICS
GOTO
IF
RETURN
SIGNAL
WHILE
ITERATE
LEAVE
以下SQL PL不能直接在命令行编辑器或 ......
count语句支持*、列名、常量、变量,并且可以用distinct关键字修饰, 并且count(列名)不会累计null的记录。下面随便用一些例子示范一下count的规则:比如对如下表做统计,所有列这里都用sql_variant类型来表示。
if (object_id ('t_test' )> 0 )
drop table t_test
go
create table t_test (a ......
如果按照powerdesigner的默认选项,生成的sql不能在mysql中正确运行.]
经过本人研究发现要做如下修改:
1.aftercreate选项改为
.foreach_item(OutReferences)
.ifnot (%hasFKIndex%)
/*==============================================================*/
/* Index: ......