Oracle ´æ´¢¹ý³Ì
create or replace procedure p //ÓоÍÌæ»»£¬Ã»Óоʹ´½¨
is
cursor c is
select * from emp for update;
begin
for v_emp in c loop
if (v_emp.deptno =10) then
update emp2 set sal*2 where current of c;
elsif () then
update emp2 set sal*2 where current of c;
else
update emp2 set sal*2 where current of c;;
end if;
end loop;
commit;
end;
2¡¢Ö´ÐÐ
exec p;
--------
begin
p;
end;
3¡¢´ø²ÎÊýµÄ´æ´¢¹ý³Ì
create or replace procedure p
(v_a in number,v_b number,v_ret out number,v_temp in out number) //in ´«µÄ²ÎÊý,out´«³ö²ÎÊý
is
begin
if(v_a>v_b) then
v_ret:=v_a;
else
v_ret :=v_b;
end if;
v_temp:=v_temp+1;
end;
ʹÓÃ:
declare:
v_a number :=3;
v_b number :=4;
v_ret number;
v_temp number :=5;
begin
p(v_a,v_b,v_ret,v_temp);
dbms......(v_ret);
dbmmm.....(v_temp);
end;
Èç¹ûÓдíÎó £¬¿ÉÒÔÖ´ÐÐshow error ÃüÁîÏÔʾ´íÎóÐÅÏ¢
4¡¢functionº¯Êý
create or replace function sal_tax
(v_sal number)
return number;
is
begin
if (v_sal<2000) then
return 0.10;
elsif (v_sal<2750) then
return 0.15;
 
Ïà¹ØÎĵµ£º
INSERT /*+APPEND */ INTO employee (empno,ename,sal,deptno)
SELECT empno,ename,sal,deptno from emp
WHERE deptno=20;
µÚ¶þÌõÓï¾äʹÓÃ/*+APPEND */À´±íʾ²ÉÓÃÖ±½Ó×°ÔØ·½Ê½£¬µ±Òª×°ÔØ´óÅúÁ¿Êý¾Ýʱ£¬²ÉÓõڶþÖÖ·½·¨×°ÔØÊý¾ÝµÄËÙ¶ÈÒªÔ¶Ô¶ÓÅÓÚµÚÒ»ÖÖ·½·¨¡£
ʹÓöà±í²åÈëÊý¾Ý
ʹÓÃALL²Ù×÷·ûÖ´Ðжà±í²åÈëʱ£¬ÔÚÿ¸öÌõ¼þ× ......
½ñÌìÖØÐÂÕûÀíµçÄÔ£¬ÕÒµ½Ò»¸öÎļþ£¬¿´ÁËÏÂÈÕÆÚ£¨2006.11.3£© £¬Å²»Ð¡ÐÄÔÙ¶ªÁË£¬´æµ½ÍøÉÏÀ´É¹É¹¡£
SQL ÓïÑÔ·ÖÀࣺ
1 DDL£¨Êý¾Ý¶¨Òå £©ÓÃÓÚ´´½¨ºÍ¶¨ÒåÊý¾Ý¿â¶ÔÏ󣬲¢ÇÒ½«¶ÔÕâЩ¶ÔÏóµÄ¶¨Òå±£´æÔÚÊý¾Ý×ÖµäÖС£
creat table ´´½¨±í
alter table ÐÞ¸ ......
1¡¢²éÕÒ±íµÄËùÓÐË÷Òý£¨°üÀ¨Ë÷ÒýÃû£¬ÀàÐÍ£¬¹¹³ÉÁУ©£º
select t.*,i.index_type from user_ind_columns t,user_indexes i where t.index_name = i.index_name and t.table_name = i.table_name and t.table_name = Òª²éѯµÄ±í
2¡¢²éÕÒ±íµÄÖ÷¼ü£¨°üÀ¨Ãû³Æ£¬¹¹³ÉÁУ©£º
select cu.* from user_cons_columns cu, user_con ......
OracleÈëÃÅÊé¼®ÍÆ¼ö
Á´½Ó£ºhttp://www.eygle.com/archives/2006/08/oracle_fundbook_recommand.html
ºÜ¶àÅóÓÑÒªÎÒ°ïÃ¦ÍÆ¼öÒ»ÏÂOracleµÄÈëÃÅÊé¼®£¬Äܹ»Á˽âOracleµÄ»ù±¾¸ÅÄî¡¢»ù±¾ÖªÊ¶µÄÄÇÖÖ¡£
ÎÒ¾ÍÃâΪÆäÄÑ£¬ÍƼö¼¸±¾¡£
Ê×ÏÈÎÒÏëÇ¿µ÷µÄÒ»µãÊÇ£¬ÈκÎÒ»±¾ÏµÍ³µÄOracleÊé¼®Ö»ÒªÈÏÕæ¶ÁÏÂÀ´£¬¶¼»áÓв»´íµÄÊÕ»ñ£¬¶ÁÊé×î¼É»äµÄ ......