[תÔØ]Oracle´æ´¢¹ý³Ìѧϰ
´æ´¢¹ý³Ì´´½¨Óï·¨£º
create or replace procedure ´æ´¢¹ý³ÌÃû£¨param1 in type£¬param2 out type£©
as
±äÁ¿1 ÀàÐÍ£¨Öµ·¶Î§£©;
±äÁ¿2 ÀàÐÍ£¨Öµ·¶Î§£©;
Begin
Select count(*) into ±äÁ¿1 from ±íA whereÁÐÃû=param1£»
If (ÅжÏÌõ¼þ) then
Select ÁÐÃû into ±äÁ¿2 from ±íA whereÁÐÃû=param1£»
Dbms_output¡£Put_line(‘´òÓ¡ÐÅÏ¢’);
Elsif (ÅжÏÌõ¼þ) then
Dbms_output¡£Put_line(‘´òÓ¡ÐÅÏ¢’);
Else
Raise Òì³£Ãû£¨NO_DATA_FOUND£©;
End if;
Exception
When others then
Rollback;
End;
×¢ÒâÊÂÏ
1£¬ ´æ´¢¹ý³Ì²ÎÊý²»´øÈ¡Öµ·¶Î§£¬in±íʾ´«È룬out±íʾÊä³ö
2£¬ ±äÁ¿´øÈ¡Öµ·¶Î§£¬ºóÃæ½Ó·ÖºÅ
3£¬ ÔÚÅжÏÓï¾äÇ°×îºÃÏÈÓÃcount£¨*£©º¯ÊýÅжÏÊÇ·ñ´æÔÚ¸ÃÌõ²Ù×÷¼Ç¼
4£¬ ÓÃselect ¡£¡£¡£into¡£¡£¡£¸ø±äÁ¿¸³Öµ
5£¬ ÔÚ´úÂëÖÐÅ×Òì³£Óà raise+Òì³£Ãû
ÒÔÃüÃûµÄÒì³£
ÃüÃûµÄϵͳÒì³£ ²úÉúÔÒò
ACCESS_INTO_NULL 䶨Òå¶ÔÏó
CASE_NOT_FOUND CASE ÖÐÈôδ°üº¬ÏàÓ¦µÄ WHEN £¬²¢ÇÒûÓÐÉèÖÃ
ELSE ʱ
COLLECTION_IS_NULL ¼¯ºÏÔªËØδ³õʼ»¯
CURSER_ALREADY_OPEN ÓαêÒѾ´ò¿ª
DUP_VAL_ON_INDEX ΨһË÷Òý¶ÔÓ¦µÄÁÐÉÏÓÐÖظ´µÄÖµ
INVALID_CURSOR
Ïà¹ØÎĵµ£º
DBMS_CHANGE_NOTIFICATION
¶ÔÏó£¨±í£©Êý¾Ý¸üÐÂ֪ͨ
DBMS_APPLICATION_INFO
ÉèÖÃ/¶ÁÈ¡SESSION APPLICATIONÐÅÏ¢£¬²Ù×÷V$SESSION_LONGOPS
DBMS_ALERT
¸æ¾¯
DBMS_DATAPUMP
Êý¾ÝǨÒÆ
DBMS_DB_VERSION
Êý¾Ý¿â°æ±¾¶¨Òå
DBMS_DDL
Compiles¡¢wrapped¡¢Reorganizes ¶ÔÏó
DBMS_DEBUG
ORACLE DEPL/SQL debugger ¹¤¾ß
DB ......
Oracle ´æ´¢¹ý³Ì·µ»Ø½á¹û¼¯Óà ref cursor ʵÏÖ¡£
ÊÔÑé²½ÖèÈçÏ£º
1. ½¨Á¢ ref cursor ÀàÐͺ͹ý³Ì
CREATE OR REPLACE PACKAGE types
AS
TYPE ref_cursor IS REF CURSOR;
END;
/
CREATE TABLE STOCK_PRICES(
RIC VARCHAR(6) PRIMARY KEY,
PRICE NUMBER(7 ......
1.oralceɾ³ýÃüÁî
1.1.ɾ³ýÓû§
drop user username cascade;
1.2.ɾ³ý±í¿Õ¼ä
DROP TABLESPACE dataspace INCLUDING CONTENTS AND DATAFILES;
2.´´½¨±í¿Õ¼ä
2.1.½¨Á¢±í¿Õ¼ä
CREATE TABLESPACE dataspace
DATAFILE '/Ŀ¼/dataspace.dbf' SIZE 500M
UNIFORM SIZE 128k; //Ö¸¶¨Çø³ß´çΪ128k,Èç²»Ö¸¶¨£¬Çø³ß´çĬÈÏÎ ......
ÐÇÆÚÒ» ·¢ÏÖÒ»¸ö±íÓкܶàÖظ´Êý¾Ý Ëæ»úʹÓÃɾ³ýÖظ´Êý¾ÝµÄÓï¾ä¡£
ÐÇÆÚ¶þ ·¢ÏÖ ÕâÓï¾äÅÜÁ˺ܾö¼Ã»ÅÜÍ꣬13¸öСʱÁË£¡Ö»²»¹ýɾ³ý10¸öÔµÄÊý¾Ý¶øÒÑ
ÒÀÈ»¶ÏÁËËü£¬¿ÉËü»Ø¹ö»¨ÁË4¸öСʱ£¬ÉÏÎçÓ°ÏìÁËÊý¾Ý¿âµÄ·þÎñËÙ¶ÈÁË¡£
È»ºóÒ»¸öÔÂÒ»¸öÔ¼ì²éÖظ´Êý¾ÝµÄ·¶Î§£¬×îºó¶¨Î»µ½9Ôµ½10Ô¡£É¾³ýËü£¬ÓÃÄÇÌõÓï¾äºÜÂý£¬Ò»¸öСʱºó ......