Oracleѧϰ±Ê¼Çժ¼5
Êý¾Ý¿â¶ÔÏó
<1>±í(Ô¼Êø)
<2>ÈçºÎ×Ô¶¯±àºÅ
SQLserver
--IDENTITYÊôÐÔ
create table test(
xh int identity(1,2) primary key,
name varchar(20)
);
insert into test(name) values ('mike');
ORACLE
Ò»¸ö¶ÔÏó(ÐòÁÐsequence)
--×î¼òµ¥µÄÒ»¸öÐòÁÐ,´Ó1¿ªÊ¼Ã¿´ÎÔö¼Ó1,×î´óÖµ38λ¾«¶È10µÄ38´Î·½
ºÍSQLSERVErÖеÄIDENTITY(1,1)ÀàËÆ
create sequence seq1;
·ÃÎÊÆäÖеÄÖµ
ʹÓÃ2¸öαÁÐ nextval,currval
select seq1.nextval from dual;--ÐÂÖµ
select seq1.currval from dual; --µ±Ç°Öµ
´Ó3¿ªÊ¼Ã¿´ÎÔö¼Ó2
3,5,7,9
create sequence seq2
start with 3
increment by 2;
´Ó5¿ªÊ¼Ã¿´ÎÔö¼Ó5,×î´óÖµ30,×îСֵÊÇ1
Ñ»·ÐòÁÐ(µ½×î´óÖµºó»Øµ½×îСֵ)
5,10,15,20,25,30,1,6,11,......
create sequence seq3
start with 5 --Æðʼֵ
increment by 5 --²½³¤
maxvalue 30 --×î´óÖµ
minvalue 1 --×îСֵ
cycle --Ñ»·
cache 4 --»º´æ4¸öÊý
ĬÈÏÖµcacheÊÇ20¸ö
È¡5µÄʱºò,ÄÚ´æÖÐÒѾËã³öÁË10,15,20,25
È¡10µÄʱºò,Ö±½ÓÈ¡ÄÚ´æÖеÄÊý
ÈçºÎÓõ½±íÖÐ
create table testa(
xh number(4) primary key,
nm varchar2(20));
xh×Ö¶ÎҪʵÏÖ×Ô¶¯±àºÅ
insert into testa values (seq3.nextval,'MIKE');
insert into testa values (seq3.nextval,'JOHN');
×Ô¶¯±àºÅ ±£Ö¤Î¨Ò»ÐÔ Êµ¼ÊÖÐÒ»°ãÓÃËü×öÖ÷¼ü
a) ¶ÔempмÓÈëµÄÔ±¹¤µÄ±àºÅÊÇ794
Ïà¹ØÎĵµ£º
¡¶1¡·DDLÓï¾ä(Êý¾Ý¶¨ÒåÓïÑÔ) Data Define Language
create
alter
drop
truncate ¿ªÍ·µÄÓï¾ä truncate table <±íÃû>
Ìصã:<1>½¨Á¢ºÍÐÞ¸ÄÊý¾Ý¶ÔÏó
&nb ......
×î½üÏîÄ¿½ø¶È±È½Ï»ºÂý£¬³õ²½Ñо¿ÁËÒ»ÏÂOracleµÄ´æ´¢¹ý³Ì£¬½«´úÂëÌù³öÀ´¡£
Ê×ÏÈÏÈÌù³öÀ´OracleµÄ·ÖÒ³·ÖÒ³´æ´¢¹ý³Ì´úÂë°É¡£
1.ÕâÊÇ°üµÄ´úÂë
create or replace package DB_Oper is
-- Author : LIUBING
-- Created : 2009-10-28 15:01:30
-- Purpose : ²âÊÔOracleµ ......
Ò»¡£Oracle·þÎñÆ÷µÄ³£ÓÃÃüÁîÐÐÏêϸ½²½â
1.Êý¾Ý¿â¹ÜÀíÏà¹Ø
¡¡¡¡bbed.exe¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Êý¾Ý¿éä¯ÀÀºÍ±à¼¹¤¾ß
¡¡¡¡dbv.exe¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Êý¾ÝÎļþÂß¼¼ì²â¹¤¾ß
¡¡¡¡exp.exe¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Êý¾Ýµ¼³ö¹¤¾ß
¡¡¡¡imp.exe¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Êý¾Ýµ¼È빤¾ß
¡¡¡¡mig.exe¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Êý¾Ý¿âÒÆÖ²¹¤¾ß
¡¡¡ ......
oracleÖÐconnect by priorʵÏֵݹé²éѯ
ÊÕ¼¯µÄ¼¸ÌõÔÚoracleÖÐͨ¹ýconnect by priorÀ´ÊµÏֵݹé²éѯ
Start with...Connect By×Ó¾äµÝ¹é²éѯһ°ãÓÃÓÚÒ»¸ö±íά»¤Ê÷ÐνṹµÄÓ¦Óá£
´´½¨Ê¾Àý±í£º
CREATE TABLE TBL_TEST
(
ID NUMBER,
NAME VARCHAR2(100 BYTE),
PID NUMBER &nbs ......
ÎÒÏÖÔÚÔÚ×öÒ»¸öOracleÊý¾Ýµ¼È룬Ҫ½«EXCELÊý¾Ýµ¼Èëµ½OracleÊý¾Ý¿âÖУ¬ÏȶÁÈ¡Êý¾Ý£¬½«Êý¾Ý±£´æÔÚÒ»ÕÅÁÙʱ±íÖУ¬È»ºóµ¼Èë֮ǰ¶ÔÁÙʱ±íÖÐÊý¾ÝµÄÿ¸ö×Ö¶Î×öУÑ飬±ÈÈçÊý¾ÝÊÇ·ñΪÕûÊý£¬ÕûÊýµÄ×î´óλÊý£¬¼°µ¼ÈëµÄÊý¾ÝÔÚÔÊý¾Ý¿âÖÐÊÇ·ñÒѾ´æÔڵȣ¬ÎÒдÁËÒ»¸ö´æ´¢¹ý³Ì£¬¶ÔÒì³£µÄÊý¾Ý£¬½«×ֶΓis_checked”ÉèΪÒì³ ......