Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

oracle´æ´¢¹ý³ÌÒì³£ÐÅÏ¢µÄÏÔʾ

oracle´æ´¢¹ý³ÌÒì³£ÐÅÏ¢µÄÏÔʾ
֮ǰд´æ´¢¹ý³Ìʱ£¬Òì³£´¦Àíд·¨ÊÇ£º
...
EXCEPTION
  WHEN OTHERS THEN
    ROLLBACK;
END ...
ÕâÖÖд·¨µ±´æ´¢¹ý³ÌÅ׳öÒ쳣ʱ£¬ÎÒÃDz»ÖªµÀÆäµ½µ×Å׳öÁËÄÄÖÖÒì³££¨±ÈÈçÁпí¶È²»¹»´ó¶øÔÚ²åÈëÊý¾ÝʱÅ×Òì³££©£¬¿ÉÒÔ°´ÈçÏ·½Ê½ÏÔʾÒì³£ÐÅÏ¢
EXCEPTION
    WHEN OTHERS THEN
      DBMS_OUTPUT.put_line('sqlcode : ' ||sqlcode);
      DBMS_OUTPUT.put_line('sqlerrm : ' ||sqlerrm);
      ROLLBACK;
END ...
sqlcodeÊÇÒì³£±àºÅ£¬sqlerrmÊÇÒì³£µÄÏêϸÐÅÏ¢£¬Èç¹ûÒì³£ÐÅϢ̫¶à£¬¿ÉÒÔ½ØÈ¡Ò»¶ÎÏÔʾ£¬Èç
DBMS_OUTPUT.put_line('sqlerrm : ' ||substr(sqlerrm,1,100));ÊǽØÈ¡Ç°100¸ö×Ö·ûÏÔʾ³öÀ´¡£
תÔØ×Ô£ºhttp://layznet.javaeye.com/blog/592873


Ïà¹ØÎĵµ£º

J2EE²Ù×÷OracleµÄclobÀàÐÍ×Ö¶Î


2008-09-02
J2EE²Ù×÷OracleµÄclobÀàÐÍ×Ö¶Î
¹Ø¼ü×Ö: java
OracleÖУ¬Varchar2Ö§³ÖµÄ×î´ó×Ö½ÚÊýΪ4KB£¬ËùÒÔ¶ÔÓÚijЩ³¤×Ö·û´®µÄ´¦Àí£¬ÎÒÃÇÐèÒªÓÃCLOBÀàÐ͵Ä×ֶΣ¬CLOB×Ö¶Î×î´óÖ§³Ö4GB¡£
»¹ÓÐÆäËû¼¸ÖÖÀàÐÍ£º
blob:¶þ½øÖÆ,Èç¹ûexe,zip
clob:µ¥×Ö½ÚÂë,±ÈÈçÒ»°ãµÄÎı¾Îļþ.
nlob:¶à×Ö½ÚÂë,ÈçUTF¸ñʽµÄÎļþ.
ÒÔÏÂ¾Í ......

һЩoracleµÄÃüÁî¼°º¯Êý °üÀ¨decodeµÈ


 1¡¢set linesize 100;  ÉèÖó¤¶È   
 2¡¢set pagesize 30;   ÉèÖÃÿҳÏÔʾÊýÄ¿   
 3¡¢em a.sql  ´ò¿ª¼Çʱ¾     
 4¡¢@ a Ö´ÐÐÎļþaÖеĴúÂ룬¿ÉÖ¸¶¨ÎļþµÄ·¾¶ @d:a.txt ......

ORACLE Êý¾Ý¿âÃû¡¢ÊµÀýÃû¡¢ORACLE_SIDµÄÇø±ð

Êý¾Ý¿âÃû(DB_NAME)¡¢ÊµÀýÃû(Instance_name)¡¢ÒÔ¼°²Ù×÷ϵͳ»·¾³±äÁ¿(ORACLE_SID)
ÔÚORACLE7¡¢8Êý¾Ý¿âÖÐÖ»ÓÐÊý¾Ý¿âÃû(db_name)ºÍÊý¾Ý¿âʵÀýÃû(instance_name)¡£ÔÚORACLE8i¡¢9iÖгöÏÖÁËеIJÎÊý£¬¼´Êý¾Ý¿âÓòÃû(db_domain)¡¢·þÎñÃû(service_name)¡¢ÒÔ¼°²Ù×÷ϵͳ»·¾³±äÁ¿(ORACLE_SID)¡£ÕâЩ¶¼´æÔÚÓÚͬһ¸öÊý¾Ý¿âÖеıêʶ£¬ÓÃÓÚÇ ......

oracle Ò»´Îɾ³ý¶àÕűíµÄÊý¾Ý£¨Î´²âÊ԰棩

spool d:\deletetb.sql;
select 'delete ' || table_name || ' where to_char(col,'||'''yyyy'''||')='||'''2007'''||';'
  from user_tables
where table_name in  (select 'HS_' || lpad(rownum, '2', '0')
          from dual
        ......

Oracle ¼¸¸ö¹Ø¼ü×ÖÀí½â

/*
--DML´¥·¢Æ÷ÀàÐÍ:
·ÖΪÓï¾ä¼¶´¥·¢Æ÷ºÍÐм¶´¥·¢Æ÷.
Óï¾ä¼¶´¥·¢Æ÷²»ÐèÒª¼Ófor each row¹Ø¼ü×Ö,²¢ÇÒ²»ÄÜʹÓÃ:new ºÍ :old¹Ø¼ü×Ö.¶ÔÕû¸ösqlÓï¾äÖ»Ö´ÐÐÒ»´Î´¥·¢Æ÷.
Ðм¶´¥·¢Æ÷ÐèÒª¼Ófor each row¹Ø¼ü×Ö,¿ÉÒÔʹÓÃ:newºÍ:old¹Ø¼ü×Ö,¶ÔÕû¸ösqlÓï¾äÓ°Ïìµ½µÄÿһÐж¼Ö´ÐÐÒ»´Î´¥·¢Æ÷.
--:newºÍ:old¹Ø¼ü×Ö×ܽá
:newÖ¸µÄÊǵ±Ç°D ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ