ITeye博客

Yamazaki

hojor · 共 72 篇文章

oracle数据库中序列的用法

序列 (SEQUENCE)是序列号生成器,可以为表中的行自动生成序列号,产生一组等间隔的数值(类型为数字)。其主要的用途是生成表的主键值,可以在插入语句中引用,也可以通过查询检查当前值,或使序列增至下一个值。 创建序列需要CREATE SEQUENCE系统权限。序列的创建语法如下: CREATE SEQUENCE 序列名 [INCREMENT BY n] [START WITH n] [{MAXVALUE/ MINVALUE n|NOMAXVALUE}] [{CYCLE|NOCYCLE}] [{CACHE n|NOCACHE}]; INCREMENT BY 用于定义序列的步长,如果省略,则默…

2010-08-30 17:12 · 数据库 · 评论(0)

oracle - merge用法(转)

Oracle9i引入了MERGE命令,你能够在一个SQL语句中对一个表同时执行inserts和u pda tes操作. MERGE命令从一个或多个数据源中选择行来upd ati ng或inserting到一个或多个表.在Oracle 10g中MERGE有如下一些改进: 1、UPDATE或INSERT子句是可选的 2、UPDATE和INSERT子句可以加WHERE子句 3、在ON条件中使用常量过滤谓词来insert所有的行到目标表中,不需要连接源表和目标表 4、UPDATE子句后面可以跟DELETE子句来去除一些不需要的行 首先创建示例表: create table PRODUCTS ( PR…

2010-08-23 10:20 · 数据库 · 评论(0)

sql - over()的用法

oracle over函数 详解(转) SQL> select deptno,ename,sal 2 from emp 3 order by deptno; DEPTNO ENAME SAL ---------- ---------- ---------- 10 CLARK 2450 KING 5000 MILLER 1300 20 SMITH 800 ADAMS 1100 FORD 3000 SCOTT 3000 JONES 2975 30 ALLEN 1600 BLAKE 2850 MARTIN 1250 JAMES 950 TURNER 1500 WARD 1250 已选择14行。 2…

2010-08-04 17:06 · 数据库 · 评论(0)

oracle 函数集

-------------------- --| 字符函数 | -------------------- --字符串连接 asssbsss Select concat('asss','bsss') from dual; select 'a'||'b' from dual; --单词首字母大写 Red Hat select initcap('red hat') from dual; --字符串截取 结果为 def Select substr('abcdef',length('abcdef')-2) from dual; Select substr('abcdef',-3,3) from dua…

2010-08-04 16:37 · 数据库 · 评论(0)

Search link!!

1.http://download.chinaunix.net china unix webset many os or gzip can be download! 2.http://www.filewatcher.com : File search engine which features FTP search. Monitors more than half a billion files worldwide. :evil: :evil: :evil: :evil: :evil: :evil: :evil: :evil: :evil: some other: 1、http://scho…

2010-07-31 22:35 · 碎碎 · 评论(0)

二叉堆(优先对列)

/*===========*\ | binheap.h | \*===========*/ #ifndef _BINHEAP_H_ #define _BINHEAP_H_ #define ElementType int #define MinPQSize 2 #define MinData -10000 typedef struct HeapStruct { int Capacity; int Size; ElementType * Elements; } * PriorityQueue; //function list PriorityQueue Initialize(int MaxEle…

2010-06-25 13:02 · 个人练习--算法&数据结构 in C · 评论(0)

B树实现

/*====================*\ | BTree.h | \*====================*/ #ifndef _BTREE_H_ #define _BTREE_H_ #define NUM 3 #define KeyType int #define Status int typedef struct BTNode { int keynum; struct BTNode * parent; KeyType key[NUM+1]; struct BTNode * ptr[NUM+1]; }BTNode,*BTree; typedef struct { BTNode …

2010-06-22 14:13 · 个人练习--算法&数据结构 in C · 评论(0)

AVL树实现

avl树是其每个节点的左子树和右子树的高度最多差1的二叉查找树。当在一棵avl树中插入节点的时候,很可能把avl树的平衡给破坏掉,在不平衡的情况下,可以通过对树做单次旋转或者复杂些的双旋转来处理。具体的旋转方法Google去 O(∩_∩)O,这里就不做详细介绍啦。下面仅给已实现的avl树的代码。 /*====================*\ | AvlTree.h | \*====================*/ #ifndef _AVL_TREE_H_ #define _AVL_TREE_H_ #define ElementType int #define Max(a,b) (a)…

2010-06-17 17:08 · 个人练习--算法&数据结构 in C · 评论(0)

查找树ADT-二叉查找树

/////////////////////////////// tree.h ///////////////////////////////// #ifndef _TREE_H_ #define _TREE_H_ #define ElementType int struct TreeNode; typedef struct TreeNode * Position; typedef struct TreeNode * SearchTree; SearchTree MakeEmpty(SearchTree t); Position Find(ElementType x,SearchTree t)…

2010-06-13 09:59 · 个人练习--算法&数据结构 in C · 评论(0)

生成表达式树

栈及中缀表达式转后缀表达式的实现看之前的日志 //>>>>>>mocro.h #ifndef _MACRO_H_ #define _MACRO_H_ #define EmptyTOS (-1) #define MinStackSize (5) #define ElementType int #endif //>>>>>>struct.h #ifndef _STRUCT_H_ #define _STRUCT_H_ #include "macro.h" /*< stack struct */ typedef struct StackRecord { int Capacity; int TopOf…

2010-06-12 14:06 · 个人练习--算法&数据结构 in C · 评论(0)

中缀表达式转后缀表达式的栈实现

/* Name:infixSuffixConv.c Copyright: personal Author: hojor Date: 10-06-10 21:24 Description: infix convert to suffix */ #include<stdio.h> #include<stdlib.h> #define STACK_SIZE 20 ////~stack start //stack struct typedef struct stack{ int top; int a[STACK_SIZE]; }stack; //create stack stack * create…

2010-06-10 21:08 · 个人练习--算法&数据结构 in C · 评论(0)

栈(stack)

/* Name: stack.c Copyright: personal Author: hojor Date: 07-06-10 10:22 Description: stack */ #include <stdio.h> #include <stdlib.h> #include "stack.h" #define EmptyTOS (-1) #define MinStackSize (5) #define ElementType int struct StackRecord { int Capacity; int TopOfStack; ElementType * Array; }; t…

2010-06-08 13:49 · 个人练习--算法&数据结构 in C · 评论(0)

最长公共子序列

用动态规划实现的最长公共子序列 #include<stdio.h> #include<stdlib.h> /*==============*\ |最长公共子序列 \*==============*/ /*!<打印最长公共子序列*/ void printLCS(char ** a,int m,int n,const char *s1, const char *s2) { int i,j; if( m==1||n==1 ) { if( a[m][n] == 1 ) printf("%c",s1[m-1]); } else if( a[m][n] == a[m][n-1] ) printLCS( …

2010-06-04 17:10 · 个人练习--算法&数据结构 in C · 评论(0)

基数排序

/*********************\ * 基数排序(桶排序)* \*********************/ #include<stdio.h> #include<stdlib.h> #include<string.h> #include<math.h> //struct of node typedef struct node{ int num; struct node * next; }NODE; /*!<链表尾部添加节点*/ void addnode(NODE * head,int num) { NODE * temp = head; while(temp->next)tem…

2010-06-04 10:35 · 个人练习--算法&数据结构 in C · 评论(0)

螺旋矩阵算法

自己写的一个螺旋矩阵的算法,感觉好笨,呵呵,还没想出好办法来,感觉肯定有个很简洁的算法来实现。 #include<stdio.h> #include<stdlib.h> void SpiralMatrix(int start,int n) { int sm[n][n],i,j; i=j=0; memset(sm,0,sizeof(sm)); int m = n -1 ; for(i=0;i<(n+1)/2;i++) { for(j=i;j<=m;j++) { sm[i][j]=start; start++; } for(j=i+1;j<=m;j++) { sm[j][m]=start; st…

2010-06-02 16:24 · 个人练习--算法&数据结构 in C · 评论(0)