oracle ´æ´¢¹ý³ÌµÄ»ù±¾Óï·¨
1.»ù±¾½á¹¹
CREATE OR REPLACE PROCEDURE ´æ´¢¹ý³ÌÃû×Ö
(
²ÎÊý1 IN NUMBER,
²ÎÊý2 IN NUMBER
) IS
±äÁ¿1 INTEGER :=0;
±äÁ¿2 DATE;
BEGIN
END ´æ´¢¹ý³ÌÃû×Ö
2.SELECT INTO STATEMENT
½«select²éѯµÄ½á¹û´æÈëµ½±äÁ¿ÖУ¬¿ÉÒÔͬʱ½«¶à¸öÁд洢¶à¸ö±äÁ¿ÖУ¬±ØÐëÓÐÒ»Ìõ
¼Ç¼£¬·ñÔòÅ׳öÒì³£(Èç¹ûûÓмǼÅ׳öNO_DATA_FOUND)
Àý×Ó£º
BEGIN
SELECT col1,col2 into ±äÁ¿1,±äÁ¿2 from typestruct where xxx;
EXCEPTION
WHEN NO_DATA_FOUND THEN
xxxx;
END;
...
3.IF ÅжÏ
IF V_TEST=1 THEN
BEGIN
do something
END;
END IF;
4.while Ñ»·
WHILE V_TEST=1 LOOP
BEGIN
XXXX
END;
END LOOP;
5.±äÁ¿¸³Öµ
V_TEST := 123;
6.ÓÃfor in ʹÓÃcursor
...
IS
CURSOR cur IS SELECT * from xxx;
BEGIN
FOR cur_result in cur LOOP
BEGIN
V_SUM :=cur_result.ÁÐÃû1+cur_result.ÁÐÃû2
END;
END LOOP;
END;
7.´ø²ÎÊýµÄcursor
CURSOR C_USER(C_ID NUMBER) IS SELECT NAME from USER WHERE TYPEID=C_ID;
OPEN C_USER(±äÁ¿Öµ);
LOOP
FETCH C_USER INTO V_NAME;
EXIT FETCH C_USER%NOTFOUND;
do something
END LOOP;
CLOSE C_USER;
8.ÓÃpl/sql developer debug
Á¬½ÓÊý¾Ý¿âºó½¨Á¢Ò»¸öTest WINDOW
ÔÚ´°¿ÚÊäÈëµ÷ÓÃSPµÄ´úÂë,F9¿ªÊ¼debug,CTRL+Nµ¥²½µ÷ÊÔ
Ïà¹ØÎĵµ£º
½ñÌì¸Õ×°ÁË oracle
¼Ç¼һ²¿·Ö´úÂë ÒÔ±¸Ê¹ÓÃ
cmd²Ù×÷
Á¬½ÓÊý¾Ý¿â sqlplus "Óû§Ãû/ÃÜÂë"
²»Çø·Ö´óСд
c/Ô´Ê/Ð޸ĺó ÐÞ¸ÄsqlÓï¾ä
lÊý×Ö Êý×Ö ÏÔʾ¼¸Ðе½¼¸ºÅµÄsqlÓï¾ä
/Ö´ÐÐ
shutdown ¹Ø±Õ·þÎñ
startup Æô¶¯·þÎñ
save ·¾¶/ÎļþÃû.ºó׺ ±£´æ»º³åÇøsqlÓï¾ä
get Îļþ ......
¡¡¡¡alter any cluster ÐÞ¸ÄÈÎÒâ´ØµÄȨÏÞ
¡¡¡¡alter any index ÐÞ¸ÄÈÎÒâË÷ÒýµÄȨÏÞ
¡¡¡¡alter any role ÐÞ¸ÄÈÎÒâ½ÇÉ«µÄȨÏÞ
¡¡¡¡alter any sequence ÐÞ¸ÄÈÎÒâÐòÁеÄȨÏÞ
¡¡¡¡alter any snapshot ÐÞ¸ÄÈÎÒâ¿ìÕÕµÄȨÏÞ
¡¡¡¡alter any table ÐÞ¸ÄÈÎÒâ±íµÄȨÏÞ
¡¡¡¡alter any trigger ÐÞ¸ÄÈÎÒâ´¥·¢Æ÷µÄȨÏÞ
¡¡¡¡alter clu ......
1£®Ê²Ã´½Ð×öÂãÉ豸£¿
¡¡¡¡ÂãÉ豸£¬Ò²½ÐÂã·ÖÇø£¨Ôʼ·ÖÇø£©£¬ÊÇÒ»ÖÖûÓо¹ý¸ñʽ»¯£¬²»±»Unixͨ¹ýÎļþϵͳÀ´¶ÁÈ¡µÄÌØÊâ×Ö·ûÉ豸¡£ËüÓÉÓ¦ÓóÌÐò¸ºÔð¶ÔËü½øÐжÁд²Ù×÷¡£²»¾¹ýÎļþϵͳµÄ»º³å¡£
2£®ÈçºÎ±æ±ðÂãÉ豸£¿
¡¡¡¡ÔÚUnixµÄ/dev Ŀ¼Ï£¬ÓÐÐí¶àÎļþ£¬ÆäÖÐÓÐÁ½¸ö´óÀࣺ×Ö·ûÉ豸ÎļþºÍ¿éÉ豸Îļþ¡£
¡¡¡¡×Ö·ûÉè±¸Ì ......
ÔÚÆô¶¯oracle·þÎñʱ,Ê×ÏÈ»áÔÚ·þÎñ¶ËÕÒ
1.spfile<sid>.ora
ÓÃÓÚÆô¶¯Àý³Ì,Èç¹ûÕÒ²»µ½spfile<sid>.ora,ÔòʹÓ÷þÎñ¶ËȱʡµÄ
2.spfile
À´Æô¶¯,Èç¹ûȱʡµÄspfileÒ²ÕÒ²»µ½,ÔòʹÓÃ
3.init<sid>.ora
À´Æô¶¯Àý³Ì,×îºóÔòÊÇʹÓÃȱʡµÄ
4.pfile
.µ±È»ÄãÒ²¿ÉÒÔÖ¸¶¨pfileÀ´¸²¸ÇȱʡspfileÆô¶¯Àý³Ì,»òͨ¹ýspfile= ......
--ËøµÄ¸ÅÄî
Ëø³öÏÖÔÚÊý¾Ý¹²ÏíµÄ³¡ºÏ£¬ÓÃÀ´±£Ö¤Êý¾ÝµÄÒ»ÖÂÐÔ¡£µ±¶à¸ö»á»°Í¬Ê±ÐÞ¸ÄÒ»¸ö±íʱ£¬ÐèÒª¶ÔÊý¾Ý½øÐÐÏàÓ¦µÄËø¶¨¡£
-- ËøµÄģʽ£¬ÓÐÒÔϼ¸ÖÖģʽ
0£ºnone
1£ºnull ¿Õ
2£ºRow-S Ðй²Ïí(RS)£º¹²Ïí±íËø£¬sub share
3£ºRow-X ÐжÀÕ¼(RX)£ºÓÃÓÚÐеÄÐ޸ģ¬sub ex ......