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
相关文档:
1、在数据库建表的时候字段直接设置为DATETIME类型;
2、执行插入的时候使用如下语句:
PreparedStatement pstmt = conn.prepareStatement("insert into guestbook(gst_user,gst_title,gst_content,gst_ip,gst_time) values(?,?,?,?,getdate())");
3、要把日期从数据库中取出,执行如下语句:
......
用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- ......
create database test --建立test数据库
use test
create table BONUS --建立
(
ENAME NVARCHAR(10),
JOB NVARCHAR(9),
SAL FLOAT,
COMM FLOAT
)
create table DEPT --建立部门表
(
DEPTNO SMALLINT not null, --部门编号
DNAME NVARCHAR(14), --部门名
LOC NVARC ......
SQL Server 2005(适用于2000)的卸载是一个非常头疼的问题。我曾经尝试过直接使用【添加或删除程序】工具卸载、清除安装目录、删除注册表内容等等各种方式综合卸载,勉强成功。现在终于找到了一个事半功倍的方法,多次尝试,未有失败,具体如下:
1.下载卸载工具,有两种:
第一种是微软官方提供的工具(msicuu2.exe)
http ......