国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

在ASP.NET+ORACLE添加數(shù)據(jù)記錄并讓ID自動增量

2024-07-10 13:12:31
字體:
供稿:網(wǎng)友

  在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');

  • 本文來源于網(wǎng)頁設(shè)計愛好者web開發(fā)社區(qū)http://www.html.org.cn收集整理,歡迎訪問。
  • 發(fā)表評論 共有條評論
    用戶名: 密碼:
    驗證碼: 匿名發(fā)表
    主站蜘蛛池模板: 惠来县| 黔南| 台州市| 水城县| 茶陵县| 乌鲁木齐市| 观塘区| 常山县| 安庆市| 思南县| 和平区| 许昌市| 内丘县| 大连市| 广昌县| 建湖县| 建阳市| 常山县| 安多县| 乌拉特中旗| 天台县| 雅江县| 云梦县| 曲阳县| 铁岭市| 凯里市| 崇义县| 元谋县| 阿瓦提县| 龙里县| 高邑县| 台南县| 津南区| 宜兰市| 喀喇| 江津市| 凤阳县| 武宣县| 奇台县| 桐庐县| 成武县|