oracle´ø²ÎÊýÓαêµÄʹÓÃ
¡¡¡¡´ÓÓαêÌáÈ¡Êý¾Ý
¡¡¡¡´ÓÓαêµÃµ½Ò»ÐÐÊý¾ÝʹÓÃFETCHÃüÁÿһ´ÎÌáÈ¡Êý¾Ýºó£¬Óα궼ָÏò½á¹û¼¯µÄÏÂÒ»ÐС£Óï·¨ÈçÏ£º
FETCH cursor_name INTO variable[,variable,...]
¡¡¡¡¶ÔÓÚSELECT¶¨ÒåµÄÓαêµÄÿһÁУ¬FETCH±äÁ¿ÁÐ±í¶¼Ó¦¸ÃÓÐÒ»¸ö±äÁ¿ÓëÖ®Ïà¶ÔÓ¦£¬±äÁ¿µÄÀàÐÍÒ²ÒªÏàͬ¡£
¡¡¡¡Àý£º
SET SERVERIUTPUT ON
DECLARE
v_ename EMP.ENAME%TYPE;
v_salary EMP.SALARY%TYPE;
CURSOR c_emp IS SELECT ename,salary from emp;
BEGIN
OPEN c_emp;
FETCH c_emp INTO v_ename,v_salary;
DBMS_OUTPUT.PUT_LINE('Salary of Employee'|| v_ename
||'is'|| v_salary);
FETCH c_emp INTO v_ename,v_salary;
DBMS_OUTPUT.PUT_LINE('Salary of Employee'|| v_ename
||'is'|| v_salary);
FETCH c_emp INTO v_ename,v_salary;
DBMS_OUTPUT.PUT_LINE('Salary of Employee'|| v_ename
||'is'|| v_salary);
CLOSE c_emp;
END
¡¡¡¡Õâ¶Î´úÂëÎÞÒÉÊǷdz£Âé·³µÄ£¬Èç¹ûÓжàÐзµ»Ø½á¹û£¬¿ÉÒÔʹÓÃÑ»·²¢ÓÃÓαêÊôÐÔΪ½áÊøÑ»·µÄÌõ¼þ£¬ÒÔÕâÖÖ·½Ê½ÌáÈ¡Êý¾Ý£¬³ÌÐòµÄ¿É¶ÁÐԺͼò½àÐÔ¶¼´óΪÌá¸ß£¬ÏÂÃæÎÒÃÇʹÓÃÑ»·ÖØÐÂдÉÏÃæµÄ³ÌÐò£º
SET SERVERIUTPUT ON
DECLARE
v_ename EMP.ENAME%TYPE;
v_salary EMP.SALARY%TYPE;
CURSOR c_emp IS SELECT ename,salary from emp;
BEGIN
OPEN c_emp;
LOOP
FETCH c_emp INTO v_ename,v_salary;
EXIT WHEN c_emp%NOTFOUND;
DBMS_OUTPUT.PUT_LINE('Salary of Employee'|| v_ename
||'is'|| v_salary);
END
¡¡¡¡¼Ç¼±äÁ¿
¡¡¡¡¶¨ÒåÒ»¸ö¼Ç¼±äÁ¿Ê¹ÓÃTYPEÃüÁîºÍ%ROWTYPE£¬¹ØÓÚ%ROWsTYPEµÄ¸ü¶àÐÅÏ¢Çë²ÎÔÄÏà¹Ø×ÊÁÏ¡£
¡¡¡¡¼Ç¼±äÁ¿ÓÃÓÚ´ÓÓαêÖÐÌáÈ¡Êý¾ÝÐУ¬µ±ÓαêÑ¡ÔñºÜ¶àÁеÄʱºò£¬ÄÇôʹÓüǼ±ÈΪÿÁÐÉùÃ÷Ò»¸ö±äÁ¿Òª·½±ãµÃ¶à¡£
¡¡¡¡µ±ÔÚ±íÉÏʹÓÃ%ROWTYPE²¢½«´ÓÓαêÖÐÈ¡³öµÄÖµ·ÅÈë¼Ç¼ÖÐʱ£¬Èç¹ûҪѡÔñ±íÖÐËùÓÐÁУ¬ÄÇôÔÚSELECT×Ó¾äÖÐʹÓÃ*±È½«ËùÓÐÁÐÃûÁгöÀ´Òª°²È«µÃ¶à¡£
¡¡¡¡Àý£º
SET SERVERIUTPUT ON
DECLARE
R_emp EMP%ROWTYPE;
CURSOR c_emp IS SELECT * from emp;
BEGIN
OPEN c_emp;
LOOP
FETCH c_emp INTO r_emp;
EXIT WHEN c_emp%NOTFOUND;
DBMS_OUT.PUT.PUT_LINE('Salary of Employee'||r_emp.ename||'is'|| r_emp.salary);
END LOOP;
CLOSE c_emp;
END;
¡¡¡¡%ROWTYPEÒ²¿ÉÒÔÓÃÓαêÃûÀ´¶¨Ò壬ÕâÑùµÄ»°¾Í±ØÐëÒªÊ×ÏÈÉùÃ÷Óα꣺
SET SERVERIUTPUT ON
DECLARE
CURSOR c_emp IS SELECT ename,sala
Ïà¹ØÎĵµ£º
OracleÊý¾Ý¿âµ¼Èë±ÃºÍµ¼³ö±ÃimpdpºÍexpdp£¨1£©
Oracleµ¼Èëµ¼³ö¹Ù·½¶¨Òå
ÈçºÎ²é¿´ImpdpºÍExpdpÃüÁ
Ç°Ì᣺°²×°OracleÊý¾Ý¿â£¨µ¼Èë±ÃºÍµ¼³ö±ÃÖ»ÄÜÔÚOracleÊý¾Ý¿â·þÎñÆ÷¶ËʹÓã©¡£
Ò»¡¢ IMPDPÃüÁî
1.   ......
Êý¾Ý¿âѹÁ¦²âÊÔ
Ò»¡¢ÓÃorabm²âÊÔÊý¾Ý¿âCPU
Orabmͨ¹ýÔÚÓû§Ö¸¶¨µÄ²¢·¢ÏÂÔËÐÐÖ¸¶¨ÊýÁ¿µÄÊÂÎñÀ´²âÊÔϵͳÐÔÄÜ.ËüÖ÷Òª²âÊÔÊý¾Ý¿â·þÎñÆ÷µÄCPUÐÔÄܺÍÄÚ´æ¡£
orabmʵ¼ÊÉÏÊÇÒ»¶ÑsqlµÄ¼¯ºÏ¡£
orabm¿ÉÒÔÓÃÔÚlinux/windows/solarisÏÂʹÓá£
orabm²»Ò»¶¨ÐèÒªÔËÐÐÔÚÊý¾Ý¿âËùÔÚ·þÎñÆ÷ÉÏ£¬Ëü¿ÉÒÔÔËÐÐÔÚÈκΰ²×°ÁË9i¿Í»§¶ËµÄÖÕ¶ËÉÏ¡£Äã ......
ÔÚÏàͬ²Ù×÷ϵͳ»·¾³Ï£¬Ïàͬ°æ±¾OracleÊý¾Ý¿âµÄǨÒƱȽϼòµ¥¡£
´óÖ²½Ö裺
1¡¢È·¶¨Ô´»úµÄ²Ù×÷ϵͳÀàÐͺͰ汾£¬Ô´»úÖ÷»úÃû£»Oracle°æ±¾£¬°²×°Ä¿Â¼£¬SID¡£
±¾ÀýÖУ¬Ô´»úΪ£º Win2k Adv£¬ ywxt£¬Oracle v8.17, d:\oracle, orcl
Ä¿±ê»úΪ£ºWin2003£¬ywxt£¬Oracle v8.17, d:\oracle, orcl
......
1£¬oracle tools£ºOUI¡¢DBCA¡¢OEM¡¢SQL*PLUS¡¢NETCA¡¢µÚÈý·½¹¤¾ß£¨toad¡¢PL\SQL developer£©
2£¬¿ÉʹÓÃresponsefile¿ìËÙȥͼÐΰ²×°oracle£¬ÔÚÔ´°²×°Îļþ/responseÀïÃæÓÐһЩģ°åÅäÖÃrpsÎļþ
3£¬Ô¤ÖÃÓû§ÊÇsysÓû§ÓësystemÓû§£ºsysÊÇoracleÊý¾Ý¿â
ÖÐȨÏÞ×î¸ßµÄÕʺţ¬¾ßÓÐcreate
databaseµÄȨÏÞ£¬¶øsystemûÓÐÕâ¸öȨÏÞ£ ......
¸Õ¸Õ½Ó´¥ORACLEµÄÈËÀ´Ëµ,´ÓÄÇÀïѧ,ÈçºÎѧ,ÓÐÄÇЩ¹¤¾ß¿ÉÒÔʹÓÃ,Ó¦¸ÃÖ´ÐÐʲô²Ù×÷,Ò»¶¨»Ø¸Ðµ½ÎÞÖú¡£ËùÒÔÔÚѧϰʹÓÃORACLE֮ǰ£¬Ê×ÏÈÀ´°²×°Ò»ÏÂORACLE 10g£¬ÔÚÀ´ÕÆÎÕÆä»ù±¾¹¤¾ß¡£Ë×»°ËµµÄºÃ£º¹¤ÓûÉÆÆäÊ£¬±ØÏÈÀûÆäÆ÷¡£ÎÒÃÇ¿ªÊ¼°É£¡
Ê×ÏȽ«ORACLE 10gµÄ°²×°¹âÅÌ ......