摘要: 1、全角转半角函数 TO_SINGLE_BYTE 2、数字转英文,利用to_char、to_date 3、sys_guid()1、全角转半角函数 TO_SINGLE_BYTESQL> select TO_SINGLE_BYTE('oracle') from dual;TO_SINGLE_BYTE('ORACLE')------------------------------oracle2、数字转英文,利用to_char、to_dateSQL> select to_char(to_date('12345','J'),&# 阅读全文
posted @ 2011-07-21 19:29 jex 阅读(719) 评论(0) 推荐(0) 编辑
摘要: create sequence seq2start with 0 --起始值increment by 1 --步长maxvalue 4999 --最大值minvalue 0 --最小值cycle --循环cache 4 --缓存4个数create table testa(ins number(4) primary key,nm varchar2(20));-- Created on 2007-10-17 by YCZ declare -- Local variables herei integer;begin-- Test statements herefor i in 1..5000 loo 阅读全文
posted @ 2011-07-21 19:29 jex 阅读(215) 评论(0) 推荐(0) 编辑
摘要: 数据字典dict总是属于Oracle用户sys的。 1、用户: select username from dba_users; 改口令 alter user spgroup identified by spgtest; 2、表空间: select * from dba_data_files; select * from dba_tablespaces;//表空间 select tablespace_name,sum(bytes), sum(blocks) from dba_free_space group by tablespace_name;//空闲表空间 select * from dba 阅读全文
posted @ 2011-07-21 19:22 jex 阅读(221) 评论(0) 推荐(0) 编辑
摘要: --列转行CREATE TABLE t_col_row(ID INT,c1 VARCHAR2(10),c2 VARCHAR2(10),c3 VARCHAR2(10));INSERT INTO t_col_row VALUES (1, 'v11', 'v21', 'v31');INSERT INTO t_col_row VALUES (2, 'v12', 'v22', NULL);INSERT INTO t_col_row VALUES (3, 'v13', NULL, 'v33'); 阅读全文
posted @ 2011-07-21 19:22 jex 阅读(210) 评论(0) 推荐(0) 编辑
摘要: 用法if ... then ... elsif ... then ... else ... end if; if ... then ... else ... end if; if ... then ... end if; 阅读全文
posted @ 2011-07-21 19:00 jex 阅读(3562) 评论(0) 推荐(0) 编辑
摘要: The table below shows the ADO Data Type mapping between Access, SQL Server, and Oracle:DataType EnumValueAccessSQLServerOracleadBigInt20BigInt (SQL Server 2000 +)adBinary128BinaryTimeStampRaw *adBoolean11YesNoBitadChar129CharCharadCurrency6CurrencyMoneySmallMoneyadDate7DateDateTimeadDBTimeStamp135Da 阅读全文
posted @ 2011-07-21 15:08 jex 阅读(423) 评论(0) 推荐(0) 编辑
摘要: 存储过程创建语法:(1)无参create or replace procedure 存储过程名as变量1 类型(值范围);变量2 类型(值范围);Begin........................Exception ........................End;(2)带参create or replace procedure 存储过程名(param1 in type,param2 out type)as变量1 类型(值范围);变量2 类型(值范围);Begin Select count(*) into 变量1 from 表A where列名=param1; If (判断条件) 阅读全文
posted @ 2011-07-20 15:20 jex 阅读(2368) 评论(0) 推荐(0) 编辑
摘要: Oracle 更改列名1. alter table tableName rename column original_Col to dest_Col ; eg. (把lrpo 中的列baNo 改为 pNo) alter table lrpo rename column baNo to pNo ; 2. alter table original_tableName rename to dest_tableName ; eg. (把 lrpo 表重命名为 lrDom 表) alter table lrpo rename to lrDom ; 1.删除一列: alter table rig drop 阅读全文
posted @ 2011-07-19 22:01 jex 阅读(4577) 评论(0) 推荐(0) 编辑
摘要: oracle 10+g不支持对类型为CLOB的列进行distinct,也不支持union,所以在遇到此问题,需要对SQL语句进行重新,从另一思想去实现同样的效果的。union没仔细思考过,具体还要看union里面的条件如何,最简单的方法是利用to_char将clob字段转换成char型,但存在一个问题,如clob中的字符长度超过4000时会报错。在此主要对distinct的转换方法进行列举:表结构如下:Table1:id(varchar)title(varchar)content(clob)1title1<CLOB>2title2<CLOB>Table2:id(varc 阅读全文
posted @ 2011-07-16 09:40 jex 阅读(3557) 评论(0) 推荐(0) 编辑
摘要: 1.按姓氏笔画排序:Select * From TableName Order By CustomerName Collate Chinese_PRC_Stroke_ci_as 2.数据库加密:select encrypt('原始密码')select pwdencrypt('原始密码')select pwdcompare('原始密码','加密后密码') = 1--相同;否则不相同 encrypt('原始密码')select pwdencrypt('原始密码')select pwdcompare(&# 阅读全文
posted @ 2011-07-16 09:32 jex 阅读(224) 评论(0) 推荐(0) 编辑