ORACLE SAVE EXCEPTION ×Ó¾ä
½ñÌìÔÚÒ»¸öÌû×ÓÀï¿´µ½shiyiwanµÄ»ØÌûÖÐÌá¼°µ½ÁËÁ½¸ö×Ô¼ºÒÔǰû¼û¹ýµÄ¸ÅÄsave exceptionºÍdml error logging¡£ÉÏÍøËÑÁËËÑÏà¹ØÄÚÈÝ£¬¿´ÁË¿´´ó¸ÅÃ÷°×Òâ˼£¬²»¹ýÔÚʵ¼ÊÔËÓÃÖл¹ÊÇûÔõôÓùý¡£±£´æÏÂÀ´£¬ÒÔºóÓõĵ½µÄ»°·½±ã²éÔÄ¡£
ÕâһƪÊǹØÓÚsave exceptionµÄ£¬ÁíÍâһƪdml error loggingµÄ²Î¼ûÈçÏÂÁ´½Ó
http://blog.csdn.net/wh62592855/archive/2009/11/13/4808012.aspx
==================================================================================
Oracle ´Ó9i ¿ªÊ¼ÔöÇ¿ÁËÅú DML ÔÚ·¢ÉúÒ쳣ʱ´¦ÀíµÄ´íÎó¼°Ê§°ÜµÄ³ÌÐòÖ´ÐÐÄÜÁ¦¡£ÕâÊÇͨ¹ýFORALL Óï¾äµÄ SAVE EXCEPTION ×Ó¾äÀ´ÊµÏÖ£¬ÆäÓï·¨ÈçÏÂ:
FORALL index in lower..upper save exceptions
SAVE EXCEPTIONS ×Ó¾äÊÇ oracle 9i ÖÐÒýÈëµÄ£¬ËüÔÚÒ»¸öÒþʽÓαêÊôÐÔ£¬SQL%BULK_EXCEPTIONS Öб£´æ´íÎóÐУ¬ÔÊÐí FORALL Óï¾ä¼ÌÐø´¦ÀíÆäÓàÐС£
ÏÂÃæÕâÒ»¶Î´úÂëÊÇ SQL%BULK_EXCEPTIONS µÄÓ¦ÓÃÀý×Ó£º
create or replace procedure batch_dml(errnum outnumber,errtext outvarchar2)
is
type user_id_tab is table of number index by binary_integer;
type user_name_tab is table of varchar2( 20 ) index by binary_integer;
type user_sex_tab is table of varchar2( 2 ) index by binary_integer;
user_id user_id_tab;
user_name user_name_tab;
user_sex user_sex_tab;
bulk_bind_excep EXCEPTION;
pragma exception_init(bulk_bind_excep,- 24381 );
begin
for idx in 1 .. 50000 loop
user_id(idx):=idx;
user_name(idx):= 'xxx' ||idx;
user_sex(idx):= 'F' ;
endloop;
user_id( 40000 ):= 39999 ;
user_id( 10000 ):= 9999 ;
delete from t_user;
forall idx in user_id.first..user_id.last save exceptions
insert into t_user values(user_id(idx), user_name(idx),user_sex(idx));
errnum:= 0 ;
errtext:= '' ;
exception
when bulk_bind_excep then
for i in 1 ..sql%bulk_exceptions.count loop
dbms_output.put_line( 'Iteration '
||SQL%bulk_exceptions(i).error_index|| 'failed with error '
||sqlerrm(sql%bulk_exceptions(i).error_code));
endloop;
commit;
when others then
commit;
errnum:=sqlcode;
errtext:=sqlerrm;
end batch_dml;
Õâ¸öÀý×ÓÊÇÐÞ¸ÄÁËÉÏÃæµÄ³ÌÐò£¬¼ÓÉÏ save exceptions Òì³£´¦Àí£¬µ±Åú dml·¢ÉúÒì³
Ïà¹ØÎĵµ£º
oracle±í¿Õ¼ä²Ù×÷Ïê½â
1
2
3×÷Õߣº À´Ô´£º ¸üÐÂÈÕÆÚ£º2006-01-04
5
6
7½¨Á¢±í¿Õ¼ä
8
9CREATE TABLESPACE data01
10DATAFILE '/ora ......
Ò»£ºsql loader µÄÌØµã
oracle×Ô¼º´øÁ˺ܶàµÄ¹¤¾ß¿ÉÒÔÓÃÀ´½øÐÐÊý¾ÝµÄÇ¨ÒÆ¡¢±¸·ÝºÍ»Ö¸´µÈ¹¤×÷¡£µ«ÊÇÿ¸ö¹¤¾ß¶¼ÓÐ×Ô¼ºµÄÌØµã¡£
±ÈÈç˵expºÍimp¿ÉÒÔ¶ÔÊý¾Ý¿âÖеÄÊý¾Ý½øÐе¼³öºÍµ¼³öµÄ¹¤×÷£¬ÊÇÒ»ÖֺܺõÄÊý¾Ý¿â±¸·ÝºÍ»Ö¸´µÄ¹¤¾ß£¬Òò´ËÖ÷ÒªÓÃÔÚÊý¾Ý¿âµÄÈȱ¸·ÝºÍ»Ö¸´·½Ãæ¡£ÓÐ×ÅËٶȿ죬ʹÓüòµ¥£¬¿ì½ÝµÄÓŵ㣻ͬʱҲÓÐһР......
ÎÒÔÚhttp://zhidao.baidu.com/question/123262452.html?fr=msg¡¡ÌáµÄÎÊÌ⣬ÕûÀíµ½ÕâÀï¡¡·Ç³£¸Ðл zjwssg
µÄ»Ø´ð
ÅÅÐòÄÚ´æÉæ¼°µ½PGA¡£
ʲôʱºòʹÓÃ×Ô¶¯PGAÄÚ´æ¹ÜÀí£¿Ê²Ã´Ê±ºòʹÓÃÊÖ¶¯PGAÄÚ´æ¹ÜÀí£¿
°×ÌìϵͳÕý³£ÔËÐÐʱÊʺÏʹÓÃ×Ô¶¯PGAÄÚ´æ¹ÜÀí£¬ÈÃOracle¸ù¾Ýµ±Ç°¸ºÔØ×Ô¶¯¹ÜÀí¡¢·ÖÅäPGAÄÚ´æ¡£
Ò¹ÀïÓû§Êý ......
ÔÚÊý¾Ý²Ö¿â»·¾³ÖУ¬ÎÒÃÇͨ³£ÀûÓÃÎﻯÊÓͼǿ´óµÄ²éÑ¯ÖØÐ´¹¦ÄÜÀ´ÌáÉýͳ¼Æ²éѯµÄÐÔÄÜ£¬µ«ÊÇÎﻯÊÓͼµÄ²éÑ¯ÖØÐ´¹¦ÄÜÓÐʱºòÎÞ·¨ÖÇÄܵØÅжϲéѯÖÐһЩÏà¹ØÁªµÄÌõ¼þ£¬ÒÔÖÁÓÚÓ°ÏìÐÔÄÜ¡£±ÈÈçÎÒÃÇÓÐÒ»ÕÅÏúÊÛ±ísales£¬ÓÃÓÚ´æ´¢¶©µ¥µÄÏêϸÐÅÏ¢£¬°üº¬½»Ò×ÈÕÆÚ¡¢¹Ë¿Í±àºÅºÍÏúÊÛÁ¿¡£ÎÒÃÇ´´½¨Ò»ÕÅÎﻯÊÓͼ£¬°´Ô´洢ÀÛ¼ÆÏúÁ¿ÐÅÏ¢£¬¼ ......
CREATE OR REPLACE PROCEDURE sendemailtest
(mailmsg IN Varchar2)
IS
--using mail server to send email.
mailconn UTL_SMTP.connection;
mailhost & ......