我找到了两个存储过程,能自动生成对一个数据表的插入和更新的存储过程,现在奉献给大家! CodeCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->插入: Create procedure sp_GenInsert@TableName varchar(1... Read More
posted @ 2009-04-28 23:54 温景良(Jason) Views(541) Comments(1) Diggs(0)
SQL2000 和 SQL2005下行列转换示例 /* --创建 学生成绩表 CREATE TABLE [StuSources] ( [StuID] [char] (10) COLLATE Chinese_PRC_CI_AS NOT NULL , [StuName] [char] (10) COLLATE Chinese_PRC_CI_AS NOT NULL , [KeCheng... Read More
posted @ 2009-04-28 23:52 温景良(Jason) Views(247) Comments(1) Diggs(0)
NUM NAME TYPE VALUE ISDEFAULT ISSES_MODIFIABLE ISSYS_MODIFIABLE ISMODIFIED ISADJUSTED ... Read More
posted @ 2009-04-28 23:51 温景良(Jason) Views(661) Comments(0) Diggs(0)
The following are number examples for the to_char function. to_char(1210.73, '9999.9') would return '1210.7' to_char(1210.73, '9,999.99') would return '1,210.73' to_char(1210.73, '$9,999.00') wou... Read More
posted @ 2009-04-28 23:50 温景良(Jason) Views(706) Comments(0) Diggs(0)
在oracle表中怎么获得第5行到第7行的记录 在oracle中表test, 记录如下: A --- 1 2 3 4 5 6 7 8 请问怎么获得第5行到第7行的记录呢? /************************************答案***********************************/ select * from can_jsk whe... Read More
posted @ 2009-04-28 23:49 温景良(Jason) Views(2826) Comments(0) Diggs(0)
B+树查询上下级(sql实现) use pubs --drop table employee create table employee ( empId char(32) primary key, empName varchar(20), higherUpId char(32) ) insert into employee values('0001','aa'... Read More
posted @ 2009-04-28 23:49 温景良(Jason) Views(2126) Comments(0) Diggs(0)
一.数据控制语句 (DML) 部分 1.INSERT (往数据表里插入记录的语句) INSERT INTO 表名(字段名1, 字段名2, ……) VALUES ( 值1, 值2, ……); INSERT INTO 表名(字段名1, 字段名2, ……) SELECT 字段名1, 字段名2, …… FROM 另外的表名; 字符串类型的字段值必须用单引号括起来, 例如... Read More
posted @ 2009-04-28 23:48 温景良(Jason) Views(5200) Comments(0) Diggs(0)
首先,Oracle的字典表和视图基本上可以分为三个层次。 1.1 X$表 这一部分表是Oracle数据库的运行基础,在数据库启动时由Oracle应用程序动态创建。 这部分表对数据库来说至关重要,所以Oracle不允许SYSDBA之外的用户直接访问,显示授权不被允许。 如果显示授权你会收到如下错误: SQL> grant select on x$ksppi to eyg... Read More
posted @ 2009-04-28 23:47 温景良(Jason) Views(1021) Comments(1) Diggs(0)
O_DATE格式 Day: dd number 12 dy abbreviated fri day spelled out friday ddspth spelled out, ordinal twelfth ... Read More
posted @ 2009-04-28 23:46 温景良(Jason) Views(602) Comments(0) Diggs(0)
-- 查看ORACLE 数据库中本用户下的所有表 SELECT table_name FROM user_tables; -- 查看ORACLE 数据库中所有用户下的所有表 select user,table_name from all_tables; -- 查看ORACLE 数据库中本用户下的所有列 select table_name,column_name from user... Read More
posted @ 2009-04-28 23:45 温景良(Jason) Views(2871) Comments(0) Diggs(0)
PL/SQL语言基础 /********************************数据类型*************************************/ %rowtype (行对象类型使用) 变量名 表名%rowtype %type 变量名 表名.列名%TYPE=默认值 在使用dbms_output.put_line()... Read More
posted @ 2009-04-28 23:44 温景良(Jason) Views(612) Comments(0) Diggs(0)
创建游标.存储过程及包 /*********************************游标********************************/ /*单向游标: declare cursor 游标名 is select 语句 带参游标: declare cursor 游标名 (参数1 类型,.....)is select 语句(可以带参数) 游标属性: ... Read More
posted @ 2009-04-28 23:44 温景良(Jason) Views(2422) Comments(0) Diggs(0)
索引.序列及同义词创建和管理 /*********************创建B+树索引**********************/ create unique index 索引名 on 表 (字段) tablespace ts 名 storage (参数) 其他配置参数 /*注: 默认的索引创建方法. 特点:1.不可标志NULL值2... Read More
posted @ 2009-04-28 23:43 温景良(Jason) Views(453) Comments(0) Diggs(0)
CREATE TABLE SCOTT.S1_Score ( ID NUMBER(10), Score NUMBER(3), Name VARCHAR2(10) ) CREATE TABLE SCOTT.S2_Score ( ID NUMBER(10), Score NUMBER(3), Name VARCHAR2(10) ) CREATE TABLE SCOTT.Y2_Sc... Read More
posted @ 2009-04-28 23:43 温景良(Jason) Views(290) Comments(0) Diggs(0)
/*******************************创建用户***********************************/ create user admin identified by admin default tablespace users quota 10m on users quota 10m on temp... Read More
posted @ 2009-04-28 23:43 温景良(Jason) Views(244) Comments(0) Diggs(0)
/*************创建表*****************/ create table student ( stu_code varchar2(10) constraint pk_stu_code primary key using index tables... Read More
posted @ 2009-04-28 23:42 温景良(Jason) Views(262) Comments(0) Diggs(0)
/******************创建字典管理方式表空间**************/ create tablespace T607 dataFile'd:\ts\t607_d1.dbf' size 1M autoExtend on next 2M maxSize 10M Default Storage ( Initial 40K Ne... Read More
posted @ 2009-04-28 23:42 温景良(Jason) Views(486) Comments(0) Diggs(0)
SQL*PLUS命令的使用大全 Oracle的sql*plus是与oracle进行交互的客户端工具。在sql*plus中,可以运行sql*plus命令与sql*plus语句。 我们通常所说的DML、DDL、DCL语句都是sql*plus语句,它们执行完后,都可以保存在一个被称为sql buffe... Read More
posted @ 2009-04-28 23:41 温景良(Jason) Views(1415) Comments(0) Diggs(0)