在asp.net+oracle添加數(shù)據(jù)記錄并讓id自動增量需要在oracle中設(shè)序列和觸發(fā)器即可,切記不是索引,asp.net中不管id,具體如下:
1、建立序列:
create sequence seq_emergency_id
nocycle
maxvalue 9999999999
start with 2;
2、建立觸發(fā)器:
create or replace trigger set_emergency_id
before insert on "emergency"
for each row
declare
next_emergency_id number;
begin
--get the next emergency id from the sequence
select seq_emergency_id.nextval
into next_emergency_id
from dual;
--use the sequence number as the primary key
--for the record being inserted
:new.id := next_emergency_id;
end;
如果在企業(yè)管理器中創(chuàng)建,在觸發(fā)器說明中填:
declare
next_emergencycb_id number;
begin
--get the next id number from the sequence
select seq_emergencycb_id.nextval
into next_emergencycb_id
from dual;
--use the sequence number as the primary key
--for the record being inserted
:new.id := next_emergencycb_id;
end;
自己總結(jié)的常用oracle text 文本檢索
oracle text 文本檢索:(先要建立context或ctxcat索引,然后如下)(還可以在from前加,score(10)來觀察檢索到的項目的得分)
1.單詞的精確匹配檢索
select cbid,title(列名) from emergency(表名) where contains(title,'關(guān)于')>0; 是從title中檢索含詞“關(guān)于”的cbid和title字段。
2.多個單詞精確匹配
select cbid,title form emergency where contains(title,'關(guān)于 and 請示')>0;是從title中檢索含詞“關(guān)于”和“請示”的上述字段。
也可select cbid,title form emergency where contains(title,'關(guān)于 and 請示',null)>0;意思同上,不是檢索短語而是兩個單詞,注意!
3.短語精確匹配
select cbid,title(列名) from emergency(表名) where contains(title,'doctor visits',null)>0;將精確匹配doctor visits短語
如果要用and,or,minus等保留字,應(yīng)該使用轉(zhuǎn)義符{},如doctor {and} visits
4.搜索互相接近的詞語
select cbid,title(列名) from emergency(表名) where contains(title,'關(guān)于 near 請示')>0;
select cbid,title(列名) from emergency(表名) where contains(title,'near((關(guān)于,請示),10)')>0; 是指指定的兩個詞在10個詞之內(nèi)
5.在搜索中使用通配符(多字符通配符是%,單字符通配符是-)
select cbid,title(列名) from emergency(表名) where contains(title,'worker%')>0;是檢索worker開頭的單詞,單字通配最多擴展3字符
6.模糊匹配搜索
select cbid,title(列名) from emergency(表名) where contains(title,'?關(guān)于')>0; (前面得加一個問號)
7.使用about運算符來搜索文檔的主題
select cbid,title form emergency where contains(title,'about(住房)',null)>0;
注意以上如果是用context索引時,基表更新時文本索引并不更新,為了使索引同步,應(yīng)該執(zhí)行ctx_dll程序包的sync_index過程如下:
execute ctx_dll.sync_index('review_index');
新聞熱點
疑難解答
圖片精選