【正文】
創(chuàng)建位圖索引創(chuàng)建唯一索引創(chuàng)建一般索引,索引名為表名+列名 ID ACCOUNT什么的兩個(gè)唯一創(chuàng)建主鍵:alter table T add primary key (V)T是表名,V是列名觸發(fā)器 自動(dòng)遞增可以從oracle服務(wù)器拷貝一個(gè)過來(lái)。下載地址:解壓到一個(gè)目錄中即可,例如c:\oracleclient2. 配置操作系統(tǒng)環(huán)境變量NLS_LANG=SIMPLIFIED TNS_ADMIN=C:\oracleclient\NETWORK\ADMIN3. 配置連接Oracle的配置。, 9, 1, 3)。insert into article values (9, 39。大象進(jìn)醫(yī)院了39。, 6, 1, 2)。insert into article values (7, 39。怎么沒有可能39。, 1, 0, 1)。insert into article values (6, 39。沒有瞎說(shuō)39。, 2, 0, 2)。說(shuō)明他是最后一個(gè)了insert into article values (4, 39。螞蟻也不好過39。, 1, 0, 1)。insert into article values (2, 39。大象大戰(zhàn)螞蟻39。 id l這樣的話就可以修改emp2里面被參考的值了觸發(fā)器的另類使用create or replace trigger trigafter update on deptfor each rowbeginupdate emp2 set deptno = : where deptno = :。end if。d39。, sysdate)。USER關(guān)鍵字當(dāng)前的用戶elsif updating theninsert into emp2_log valuse(USER, 39。i39。創(chuàng)建一個(gè)觸發(fā)器create or replace trigger trigafter insert or delete or update on emp2 for each row或者把a(bǔ)fter改成俄海關(guān)beforeend。elsereturn 。show error。(v_temp)。beginp(v_a, v_b, v_ret, v_temp)。v_ret number。執(zhí)行declarev_a number := 3。end。end if。這樣的話可以方便的多次執(zhí)行帶參數(shù)的存儲(chǔ)過程create or replace procedure p(v_a in number, v_b number, v_ret out number, v_temp in out number) 傳入傳出,默認(rèn)是inis變量聲明 無(wú)beginif(v_a v_b) thenv_ret := v_a。2)beginp。end。22239。end。end loop。where current of c就是更新當(dāng)前這個(gè)游標(biāo)elsif ( = 5000) thendelete from emp where current of c。可更新的游標(biāo)declarecursor cisselect * from emp for update。end。) loop()。beginfor v_temp in c(30, 39。end。beginfor v_emp in c loop()。 找到就返回true。c%notfound最近的一次fetch如果沒有找到就返回true。end。endloop。loopfetch c into v_emp。v_emp c%rowtype。end。()。rowtype相當(dāng)與C這是一表的類型beginopen c。6游標(biāo)cursor,重點(diǎn) 相當(dāng)于迭代器declarecursor c isselect * from emp。end。error39。)。exceptionwhen too_many_rows then(39。5錯(cuò)誤處理declarev_temp number(4)。end loop。end loop。end。exit when(i = 10)。beginloop(i)。end。)。else(39。high39。)。 1200) then(39。beginselect sal into v_sal from emp where empno = 7369。39。end。39。39。必須有into,賦值....excute immediate 關(guān)鍵字beginexecute immediate 39。( || || )。 := 39。 := 39。v_test type_record_dept。下標(biāo)可以為負(fù),這個(gè)有點(diǎn)神(v_empnos(1))。beginv_empnos(0) := 4444。復(fù)合變量table 相當(dāng)于數(shù)組declaretype type_table_emp_empno is table of %type index by binary_integer。%type屬性declarev_empno %type??梢匀】罩?a varchar2(20) not null := 39。sysdate系統(tǒng)當(dāng)前時(shí)間a constant number(3,2) := 。主要用來(lái)計(jì)數(shù)a number(7,2) := 。3變量聲明每行只能聲明一個(gè),不能與數(shù)據(jù)庫(kù)或表重名變量類型簡(jiǎn)單變量a number(1)。)。exceptionwhen others then相當(dāng)于catch excption了(39。beginv_num := 2/v_num。end。name39。name39。默認(rèn)是關(guān)閉的2聲明變量declaredeclarev_name varchar2(20)。END。HELLO WORLD39。 列不可分2當(dāng)一張表里有多個(gè)主鍵存在時(shí),不能依賴于單獨(dú)的主鍵不能部分依賴,3不存在傳遞依賴一般設(shè)計(jì)良好的數(shù)據(jù)庫(kù)SQL語(yǔ)句寫起來(lái)就會(huì)麻煩一些會(huì)發(fā)現(xiàn)每次運(yùn)行都產(chǎn)生不一樣的數(shù)字,默認(rèn)已經(jīng)包含同步了SS37,sequence序列 orcle only創(chuàng)建一個(gè)獨(dú)一無(wú)二自動(dòng)遞增的數(shù)字create sequence seq。select index_name from user_indexes。select view_name from user_views。alter table stu add check(id0)。刪除添加表的約束條件刪除alter table stu drop constraint xxx。刪