½ñÌìÔÚÂÛ̳Àï¿´ÁËһƪÌû×Ó£¬ÌÖÂÛltrim() º¯ÊýµÄÏêϸÓ÷¨£¬ÏÂÃæÎҽ輸¸ö¸ßÊֵĻشð×ܽáһϣº
ÏÈ¿´¼¸¸öʵÀý£º
SQL> select ltrim('109224323','109') from dual;
LTRIM('109224323','109')
------------------------
224323
Õâ¸öµÄ¹¦ÄÜÓ¦¸Ã¶¼ÖªµÀµÄàÞ~~ ÔÙÀ´¿´Ò»¸ö£º
SQL> select ltrim('10900094323','109') from dual;
LTRIM('10900094323','109')
---------------------------
4323
ÊDz»ÊÇÓеãÃÔºýÁË£¿°´µÀÀí˵Ӧ¸ÃÊÇ00094323µÄ½á¹ûÂï~~ ÔÙÀ´¿´Á½¸ö¶Ô±ÈµÄ£º
SQL> select ltrim('10900111000991110224323','109') from dual;
LTRIM('10900111000991110224323
------------------------------
224323
SQL> select ltrim('109200111000991110224323','109') from dual;
LTRIM('10920011100099111022432
------------------------------
200111000991110224323
ÊDz»ÊÇÓÐÕâÑùµÄÒÉÎÊ£ºÎªÊ²Ã´µÚ¶þ¸ö²éѯÓï¾ä¶àÁËÒ»¸ö2¾Íû±»½ØÁËÄØ£¿
ÔÙÀ´¿´Ò»¸ö£º
SQL> select ltrim('902100111000991110224323','109') from dual;
LTRIM('90210011100099111022432
------------------------------
2100111000991110224323
ÎÒÏë´ó¼Ò¶¼¶¼»áÏë£ ......
Oracle PL/SQLÖÐÈçºÎʹÓÃ%TYPEºÍ%ROWTYPE
¡¡¡¡1. ʹÓÃ%TYPE
¡¡¡¡ÔÚÐí¶àÇé¿öÏ£¬PL/SQL±äÁ¿¿ÉÒÔÓÃÀ´´æ´¢ÔÚÊý¾Ý¿â±íÖеÄÊý¾Ý¡£ÔÚÕâÖÖÇé¿öÏ£¬±äÁ¿Ó¦¸ÃÓµÓÐÓë±íÁÐÏàͬµÄÀàÐÍ¡£ÀýÈ磬students±íµÄfirst_nameÁеÄÀàÐÍΪVARCHAR2(20),ÎÒÃÇ¿ÉÒÔ°´ÕÕÏÂÊö·½Ê½ÉùÃ÷Ò»¸ö±äÁ¿£º
¡¡¡¡DECLARE
¡¡¡¡ v_FirstName VARCHAR2(20);
¡¡¡¡µ«ÊÇÈç¹ûfirst_nameÁеĶ¨Òå¸Ä±äÁ˻ᷢÉúʲô£¨±ÈÈç˵±í¸Ä±äÁË£¬first_nameÏÖÔÚµÄÀàÐͱäΪVARCHAR2(25)£©£¿ÄǾͻᵼÖÂËùÓÐʹÓÃÕâ¸öÁеÄPL/SQL´úÂ붼±ØÐë½øÐÐÐ޸ġ£Èç¹ûÄãÓкܶàµÄPL/SQL´úÂ룬ÕâÖÖ´¦Àí¿ÉÄÜÊÇÊ®·ÖºÄʱºÍÈÝÒ׳ö´íµÄ¡£
¡¡¡¡Õâʱ£¬Äã¿ÉÒÔʹÓÔ%TYPE”ÊôÐÔ¶ø²»Êǽ«±äÁ¿ÀàÐÍÓ²ÐÔ±àÂë¡£
¡¡¡¡ÀýÈ磺
¡¡¡¡DECLARE
¡¡¡¡ v_FirstName students.first_name%TYPE;
¡¡¡¡Í¨¹ýʹÓÃ%TYPE,v_FirstName±äÁ¿½«Í¬students±íµÄfirst_nameÁеÄÀàÐÍÏàͬ£¨¿ÉÒÔÀí½âΪ½«Á½Õ߰ÆðÀ´£©¡£
¡¡¡¡Ã¿´ÎÄäÃû¿é»òÃüÃû¿éÔËÐиÃÓï¾ä¿éÒÔ¼°±àÒë´æ´¢¶ÔÏ󣨹ý³Ì¡¢º¯Êý¡¢°ü¡¢¶ÔÏóÀàºÍ´¥·¢Æ÷£©Ê±£¬¾Í»áÈ·¶¨¸ÃÀàÐÍ¡£
¡¡¡¡Ê¹ÓÃ%TYPEÊǷdz£ºÃµÄ±à³Ì·ç¸ñ£¬ÒòΪËüʹµÃPL/SQL¸ü¼ÓÁé»î£¬¸ü¼ÓÊÊÓ¦ÓÚ¶ÔÊý¾Ý¿â¶¨ÒåµÄ¸üС£
¡¡¡¡2. ʹÓÃ%ROWTYPE
¡¡¡¡2.1 PL/SQL¼Ç¼
¡¡¡¡P ......
¾³£Ê¹ÓÃOracleÊý¾Ý¿â10g£¬´ó¼Ò¿ÉÒÔ·¢ÏÖÒÔǰɾ³ýµÄ±íÔÚÊý¾Ý¿âÖгöÏÖÁËÌرð¶àµÄÀ¬»ø±í Èç:BINjR8PK5HhrrgMK8KmgQ9nw==
ÕâÒ»ÀàµÄ±íͨ³£ÎÞ·¨É¾³ý£¬²¢ÇÒÎÞ·¨ÓÃ"delete"ɾ³ý.
ÏÔʾ´ËÀà±í¿ÉÒÔÓÃÃüÁî:SHOW RECYCLEBIN ;
ɾ³ý·½·¨Îª:PURGE TABLE "BINjR8PK5HhrrgMK8KmgQ9nw==";
ɾ³ýÈ«²¿´ËÀà±íµÄ·½·¨Îª:PURGE RECYCLEBIN; ......
ÔÚJS²Ù×÷ OracleÊý¾Ý¿âʱ£¬ÓÉÓÚ¿ò¼ÜÔÒò²»ÄÜʹÓà to_dateÃüÁһ³ïĪչ£¬¿´Á˺öà×ÊÁÏ¡£·¢ÏÖÁËÍ»ÆÆ¿Ú¡£
ORACLEÖÐ ÎÞÂÛʲôµ«Èý·½Èí¼þ ¶¼ÊÇÒÔ“Ò»¸ö»á»°(session)”Ϊ»ù´¡½øÐÐһϵÁвÙ×÷µÄ£¬Ö»Òª¹Ø±ÕÕâ¸ö´°¿Ú£¬´Ë»á»°½«±»È¡Ïû/¹Ø±Õ¡£
Òò´ËÏëµ½£¬
alter session set nls_date_format ="yyyy/MM/dd hh24:mi:ss";
Õâ¸öÃüÁîÖ»¶ÔÒ»´Î»á»°ÓÐЧ£¬²¢²»ÊÇÓÀ¾ÃÉúЧ¡£
ÄÇô ¾ÍÔÚ ¿ªÆôÊÂÎñÒÔºó£¬ Ö´ÐÐINSERT֮ǰ£¬Ö´ÐÐÕâÌõÃüÁ
DatabaseManager.beginTransaction();
//½ñ»Ø¤Î¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¤ÎÈÕ¸¶¤ò¥Õ¥©ー¥Þー¥È
var sessionDate = "alter session set nls_date_format = 'yyyy/MM/dd HH24:mi:ss'";
DatabaseManager.execute(sessionDate);
DatabaseManager.insert("tablename",objData); ......
ÍøÉϲéÔÄÁËһЩÏà¹ØµÄÌû×ÓºÍÎÄÕ£¬Ëµ·¨´óÌåÏàͬ£¬µ«ÓÐЩµØ·½»¹ÊÇÓÐЩ²»Ò»Ñù£¬ÔÚÕâÀïÉÔ΢С×ܽáһ϶þÕßµÄÇø±ð°É¡£
1.
delete²úÉúrollbackºÍÏà¹ØËøÐÅÏ¢£¬Èç¹ûɾ³ý´óÊý¾ÝÁ¿µÄ±íËٶȻáºÜÂý£¬Í¬Ê±»áÕ¼ÓúܶàµÄrollback segments .¶øtruncate ÊÇDDL²Ù×÷£¬²»²úÉúrollback£¬Ëٶȿì.
Truncate table does not generate rollback information and redo records so it is much faster than delete.
In default, it deallocates all space except the space allocated by MINEXTENTS unless you specify REUSE STORAGE clause.
2.
delete²»´ÓtablespaceÖÐÌÚ³ö¿Õ¼ä,ÐèÒª ALTER TABLESPACE AAA COALESCE; ²ÅÓпռä
3.
truncate µ÷Õûhigh water mark ¶ødelete²».truncateÖ®ºó£¬TABLEµÄHWMÍ˻ص½ INITIALºÍNEXTµÄλÖã¨Ä¬ÈÏ£©£¬delete Ôò²»¿ÉÒÔ¡£
4.
truncate Ö»ÄܶÔTABLE£¬delete ¿ÉÒÔÊÇtable,view,synonym¡£
5.
TRUNCATE TABLE µÄ¶ÔÏó±ØÐëÊDZ¾Ä£Ê½Ïµģ¬»òÕßÓÐdrop any tableµÄȨÏÞ ¶ø DELETE ÔòÊǶÔÏó±ØÐëÊDZ¾Ä£Ê½Ïµģ¬»ò±»ÊÚÓè DELETE ON SCHEMA.TABLE »òDELETE ANY TABLEµÄȨÏÞ¡£
6.
truncateÊÇDDLÓïÑÔ. deleteÊÇDMLÓïÑÔ¡£²»¹ýҪעÒâ¾ÍÊÇ truncate ²»ÄÜÔÚ pl/sql ÉÏʹÓã ......
½ñÌìÔÚѧϰµÄ¹ý³ÌÖп´µ½ÁËLOW HWM£¬Ó¡ÏóÖÐÒÔÇ°ÔÚʲôµØ·½¿´µ½¹ý¿ÉÊÇËÀ»îÏë²»ÆðÀ´£¬È¥°Ù¶ÈÁË°ëÌ춼ûÕÒµ½Ïà¹ØµÄÐÅÏ¢¡£ÎÞÄÎ֮ϻ¹ÊÇGOOGLEÁËһϣ¬ÕÒµ½Ò»ÆªasktomÉϵÄÌû×Ó¡£¼Ç¼ÔÚÕâÀ˳±ãºÍ´ó¼Ò·ÖÏíһϡ£
High-water Mark
This is a term used with table segments stored in the database. If you envision a table, for example, as a 'flat' structure or as a series of blocks laid one after the other in a line from left to right, the high-water mark (HWM) would be the rightmost block that ever contained data, as illustrated in Figure 10-1.
+---- high water mark of newly created table
|
V
+--------------------------------------------------------+
| | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
high water mark after inserting 10,000 rows
|
v
+-------------------------------------------------- ......