oracle的時序書的使用

2021-03-31 15:45:46 字數 745 閱讀 3069

create sequence student_sequence

start with 10000

increment by 1

--建立時序數

create table students(

id number(5) primary key,

first_name varchar2(20),      

last_name varchar2(20),

major varchar2(30),

current_credits number(3)

);--相應的**

insert into students(id,first_name,last_name,major,current_credits)

values(student_sequence.nextval,'jessica','niu','medicine',0);

insert into students(id,first_name,last_name,major,current_credits)

values(student_sequence.nextval,'jessica','niu','medicine',0);

student_sequence.nextval相應的呼叫

select * from students;

1 10000 jessica niu medicine 0

2 10001 jessica niu medicine 0

ORACLE 物件的使用

建立物件型別 create or replace type emp typ as object id number,name varchar2 30 sal number,comm number,member procedure change comm new comm number member ...

oracle 遞迴的使用

oracle資料庫提供給了一個強大的功能 遞迴。這功能目前在db2中是沒有的。1.語法 select from table name t start with t.child id connect by prior t.child id t.parent id 注意 不能寫成 connect by ...

Oracle索引的使用

最近做資料整合,把其他伺服器上的資料抽取到統一資料庫中,為提高速度,考慮採用索引。1.索引分類 a 唯一索引,作用是資料約束,保證資料唯一,還有就是資料索引,提高查詢效率 b 一般索引,只有資料索引的作用,2.唯一索引的建立 create unique index 索引名 on 表名 欄位名 ok,...

Oracle陣列的使用

下面這組資訊比較有用,列出來以備參考 除了建構函式外,集合還有很多內建函式,這些函式稱為方法。呼叫方法的語法如下 collection.method 下表中列出oracle中集合的方法 方法 描述 使用限制 count 返回集合中元素的個數 delete 刪除集合中所有元素 delete 刪除元素下...

oracle的入門使用

客戶端工具 pl sql developer 與 sql plus命令列 sql plus命令列 cmd sqlplus conn 使用者名稱 密碼 連線字串 as 連線身份 連線身份分為三種 一是sysdba,即資料庫管理員,主要許可權有,開啟或關閉資料庫伺服器 備份或恢復資料庫 日誌歸檔 會話限...