Oracle Òì³£
OracleÒì³£·ÖΪ3ÖÖ:
(1)Ô¤¶¨ÒåÒì³£:no_data_foundµÈ,ÊÇOracleϵͳ¶¨ÒåµÄÒì³£.
declare
s_test varchar2
begin
select id into s_test from test; --´Ëʱtest±íÎÞÊý¾Ý
exception
when no_data_found then
raise_application_error(-20001, 'ûÓÐÊý¾Ý');
end;
(2)×Ô¶¨ÒåÒì³£:×Ô¼º¶¨ÒåµÄÒì³£,×Ô¼ºÅ×,×Ô¼º²¶»ñ.
declare
exp_test exception;
begin
if 1 = 1 then
raise exp_test;
end if;
exception
when exp_test then
raise_application_error(-20002, '×Ô¶¨ÒåÒì³£');
end;
(3)·ÇÔ¤¶¨ÒåÒì³£.
--Õâ¸öÀý×ӾͲ»ÐèÒª×Ô¼ºÅ×,ÒòΪÒѾ°ÑÖ÷¼ü³åÍ»µÄÒì³£¸ø¸²¸ÇÁË,ËùÒÔÖ»ÒªÊÇÖ÷¼ü³åÍ»,ÄÇô¾ÍÊÇexp_testÀ´´úÌæÒÔǰÄǸöÁË.
declare
exp_test exception;
progam exception_init(exp_test ,-1); --¸²¸Ç-1Õâ¸öÒì³£,-1´ú±íÖ÷¼ü³åÍ»
begin
insert into test values('1'); --test±íµÄÖ÷¼ü´æÔÚ1Õâ¸öÖµ.
exception
when exp_test then
raise_application_error(-20003, 'Ö÷¼ü³åÍ»');
end;
ÅжϲÎÊýµÄ.
create or replace procedure addContent_test
(
s_type in varchar2,
s_count in number,
s_language in varchar2
)
is
exp_type exception;
exp_count exception;
exp_language exception;
begin
if s_type <> 50
and s_type <> 51
and s_type <> 52
and s_type <> 53
and s_type <> 54
and s_type <> 55
and s_type <> 56
and s_type <> 57
and s_type <> 0
and s_type <> 2
and s_type <> 3
and s_type <> 99999999 then
raise exp_type;
end if;
if s_count < 1 or s_count > 100 then
raise exp_count;
end if;
dbms_output.put_line(to_number(instr(s_language, ',',1,2)));
if instr(s_language, ',',1,2) > 0 then
raise exp_language;
end if;
exception
Ïà¹ØÎĵµ£º
oracle±í¿Õ¼ä²Ù×÷Ïê½â
1
2
3×÷Õߣº À´Ô´£º ¸üÐÂÈÕÆÚ£º2006-01-04
5
6
7½¨Á¢±í¿Õ¼ä
8
9CREATE TABLESPACE data01
10DATAFILE '/ora ......
Êý¾Ý¿âÊÇÒ»¸ö¶àÓû§Ê¹ÓõĹ²Ïí×ÊÔ´¡£µ±¶à¸öÓû§²¢·¢µØ´æÈ¡Êý¾Ýʱ£¬ÔÚÊý¾Ý¿âÖоͻá²úÉú¶à¸öÊÂÎñͬʱ´æÈ¡Í¬Ò»Êý¾ÝµÄÇé¿ö¡£Èô¶Ô²¢·¢²Ù×÷²»¼Ó¿ØÖƾͿÉÄÜ»á¶ÁÈ¡ºÍ´æ´¢²»ÕýÈ·µÄÊý¾Ý£¬ÆÆ»µÊý¾Ý¿âµÄÒ»ÖÂÐÔ¡£
¼ÓËøÊÇʵÏÖÊý¾Ý¿â²¢·¢¿ØÖƵÄÒ»¸ö·Ç³£ÖØÒªµÄ¼¼Êõ¡£µ±ÊÂÎñÔÚ¶Ôij¸öÊý¾Ý¶ÔÏó½øÐвÙ×÷ǰ£¬ÏÈÏòϵͳ·¢³öÇëÇó£¬¶ÔÆä¼ÓËø¡£¼ÓËøº ......
Ëùν³öÓÚjob¶øÊ¤ÓÚjob£¬ËµµÄ¾ÍÊÇOracle 10gºóµÄÐÂÌØÐÔSchedulerÀ²¡£ÔÚ10g»·¾³ÖУ¬ORACLE½¨ÒéʹÓÃSchedulerÌæ»»ÆÕͨµÄjob£¬À´¹ÜÀíÈÎÎñµÄÖ´ÐС£Æäʵ£¬½«SchedulerÃèÊö³É¹ÜÀíjobµÄ¹¤¾ßÒѾ̫¹ýÆ¬ÃæÁË£¬10G°æ±¾ÖÐÐÂÔöµÄScheduler¾ø²»½ö½öÊÇ´´½¨ÈÎÎñÕâô¼òµ¥¡£¡£¡£¡£
Ìáʾ£ºORACLEÖйÜÀíSchedulerÊÇͨ¹ýDBMS_SCHEDULER°ü£¬ ......
1¡¢ ¿ªÊ¼££¾ÉèÖ㣾¿ØÖÆÃæ°å££¾¹ÜÀí¹¤¾ß££¾·þÎñ
Í£Ö¹ËùÓÐOracle·þÎñ¡£
2¡¢ ¿ªÊ¼££¾³ÌÐò££¾Oracle - OraHome81££¾Oracle Installation Products££¾   ......