oracleÁÙʱ±íÏà¹Ø֪ʶ
ÔÚOracle8i»òÒÔÉÏ°æ±¾ÖУ¬¿ÉÒÔ´´½¨ÒÔÏÂÁ½ÖÖÁÙʱ±í£º
1¡£»á»°ÌØÓеÄÁÙʱ±í
CREATE GLOBAL TEMPORARY <TABLE_NAME> (<column specification>)
ON COMMIT PRESERVE ROWS£»
2¡£ÊÂÎñÌØÓеÄÁÙʱ±í
CREATE GLOBAL TEMPORARY <TABLE_NAME> (<column specification>)
ON COMMIT DELETE ROWS£»
CREATE GLOBAL TEMPORARY TABLE MyTempTable
Ëù½¨µÄÁÙʱ±íËäÈ»ÊÇ´æÔڵģ¬µ«ÊÇÄãÊÔÒ»ÏÂinsert Ò»Ìõ¼Ç¼ȻºóÓñðµÄÁ¬½ÓµÇÉÏÈ¥select£¬¼Ç¼Êǿյģ¬Ã÷°×ÁË°É£¬ÎÒ°ÑÏÂÃæÁ½¾ä»°ÔÙÌùһϣº
--ON COMMIT DELETE ROWS ˵Ã÷ÁÙʱ±íÊÇÊÂÎñÖ¸¶¨£¬Ã¿´ÎÌá½»ºóORACLE½«½Ø¶Ï±í£¨É¾³ýÈ«²¿ÐУ©
--ON COMMIT PRESERVE ROWS ˵Ã÷ÁÙʱ±íÊǻỰָ¶¨£¬µ±ÖжϻỰʱORACLE½«½Ø¶Ï±í¡£
³åÍ»µÄÎÊÌâ¸ü±¾²»Óÿ¼ÂÇ.
ÁÙʱ±íÖ»ÊDZ£´æµ±Ç°»á»°(session)Óõ½µÄÊý¾Ý£¬Êý¾ÝÖ»ÔÚÊÂÎñ»ò»á»°ÆÚ¼ä´æÔÚ¡£
ͨ¹ýCREATE GLOBAL TEMPORARY TABLEÃüÁî´´½¨Ò»¸öÁÙʱ±í£¬¶ÔÓÚÊÂÎñÀàÐ͵ÄÁÙʱ±í£¬
Êý¾ÝÖ»ÊÇÔÚÊÂÎñÆÚ¼ä´æÔÚ£¬¶ÔÓڻỰÀàÐ͵ÄÁÙʱ±í£¬Êý¾ÝÔڻỰÆÚ¼ä´æÔÚ¡£
»á»°µÄÊý¾Ý¶ÔÓÚµ±Ç°»á»°Ë½ÓС£Ã¿¸ö»á»°Ö»ÄÜ¿´µ½²¢ÐÞ¸Ä×Ô¼ºµÄÊý¾Ý¡£DMLËø²»»á¼Óµ½
ÁÙʱ±íµÄÊý¾ÝÉÏ¡£ÏÂÃæµÄÓï¾ä¿ØÖÆÐеĴæÔÚÐÔ¡£
¡ñ ON COMMIT DELETE ROWS ±íÃûÐÐÖ»ÊÇÔÚÊÂÎñÆÚ¼ä¿É¼û
¡ñ ON COMMIT PRESERVE ROWS ±íÃûÐÐÔÚÕû¸ö»á»°ÆÚ¼ä¿É¼û
¿ÉÒÔ¶ÔÁÙʱ±í´´½¨Ë÷Òý£¬ÊÓͼ£¬³ö·¢Æ÷£¬¿ÉÒÔÓÃexportºÍimport¹¤¾ßµ¼Èëµ¼³ö±íµÄ
¶¨Ò壬µ«ÊDz»Äܵ¼³öÊý¾Ý¡£±íµÄ¶¨Òå¶ÔËùÓеĻỰ¿É¼û¡£
Temporary TablesÁÙʱ±í
1¼ò½é
ORACLEÊý¾Ý¿â³ýÁË¿ÉÒÔ±£´æÓÀ¾Ã±íÍ⣬»¹¿ÉÒÔ½¨Á¢ÁÙʱ±ítemporary tables¡£ÕâЩÁÙʱ±íÓÃÀ´±£´æÒ»¸ö»á»°SESSIONµÄÊý¾Ý£¬
»òÕß±£´æÔÚÒ»¸öÊÂÎñÖÐÐèÒªµÄÊý¾Ý¡£µ±»á»°Í˳ö»òÕßÓû§Ìá½»commitºÍ»Ø¹örollbackÊÂÎñµÄʱºò£¬ÁÙʱ±íµÄÊý¾Ý×Ô¶¯Çå¿Õ£¬
µ«ÊÇÁÙʱ±íµÄ½á¹¹ÒÔ¼°ÔªÊý¾Ý»¹´æ´¢ÔÚÓû§µÄÊý¾Ý×ÖµäÖС£
ÁÙʱ±íÖ»ÔÚoracle8iÒÔ¼°ÒÔÉϲúÆ·ÖÐÖ§³Ö¡£
2Ïêϸ½éÉÜ
OracleÁÙʱ±í·ÖΪ »á»°¼¶ÁÙʱ±í ºÍ ÊÂÎñ¼¶ÁÙʱ±í¡£
»á»°¼¶ÁÙʱ±íÊÇÖ¸ÁÙʱ±íÖеÄÊý¾ÝÖ»ÔڻỰÉúÃüÖÜÆÚÖ®ÖдæÔÚ£¬µ±Óû§Í˳ö»á»°½áÊøµÄʱºò£¬Ora
Ïà¹ØÎĵµ£º
1¡¢ÓÃdblinkÁ´½Óoracle
£¨1£©Óëƽ̨Î޹صÄд·¨£º
create public database
link cdt connect to apps
identified by apps using '(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.31.205.100)(PORT = 1541))
)
(CONNECT_DATA =
(SERVICE_NAME = CDT)
)
)'
£¨2£©¿ÉÒÔ½«µ¥ÒýºÅÄÚµÄÄÚÈÝ ......
1.ASCII
·µ»ØÓëÖ¸¶¨µÄ×Ö·û¶ÔÓ¦µÄÊ®½øÖÆÊý;
SQL> select ascii(’A’) A,ascii(’a’) a,ascii(’0’) zero,ascii(’ ’) space from dual;
A A ZERO SPACE
--------- --------- --------- ---------
65 97 48 32
2.CHR
¸ø³öÕ ......
ÔÚwindowsÏÂsqlplusÍêÈ«Õý³££¬¿ÉÊǵ½linuxÏ£¬sqlplusÖÐÎÄÏÔʾ¾Í³öÎÊÌâÁË£¬×ÜÊÇÏÔʾ“??”£¬Õâ¸öÎÊÌâÓÖÔõô½â¾öÄØ£¿
¾¹ýÔÚÍøÂçÉϲé×ÊÁÏ£¬ÒÔ¼°³¢ÊÔ£¬µÃµ½µÄ½â·¨ÈçÏ£º
ÆäʵºÜ¼òµ¥ÎÒÃÇÖ»ÒªÉèÖÃÍ˳ösqlplus,ÉèÖÃÏàÓ¦µÄ»·¾³±äÁ¿NLS_LANG
export NLS_LANG="SIMPLI ......
Ò» ÒýÑÔ
Êý¾Ý²Ö¿â¼¼ÊõÊÇÄ¿Ç°ÒÑÖªµÄ±È½Ï³ÉÊìºÍ±»¹ã·º²ÉÓõĽâ¾ö·½°¸£¬ÓÃÓÚÕûºÍµçÐÅÔËÓªÆóÒµÄÚ²¿ËùÓзÖÉ¢µÄÔʼҵÎñÊý¾Ý£¬²¢Í¨¹ý±ã½ÝÓÐЧµÄÊý¾Ý·ÃÎÊÊֶΣ¬¿ÉÒÔÖ§³ÖÆóÒµÄÚ²¿²»Í¬²¿ÃÅ£¬²»Í¬ÐèÇ󣬲»Í¬²ã´ÎµÄÓû§Ëæʱ»ñµÃ×Ô¼ºËùÐèµÄÐÅÏ¢¡£Êý¾Ý²Ö¿âϵͳÐèÒªÄܹ»¼°Ê±µØ×·×ٺͷÖÎö´óÁ¿µÄÀúÊ·Êý¾Ý£¬²¢Äܹ»¼°Ê±×ö³ö·ÖÎöºÍÔ¤²â£¬Òò´ËÊ ......
¡¡¡¡1´´½¨Ð±í
¡¡¡¡1.1´Ó²éѯµ½µÄ±í´´½¨±í
¡¡¡¡create table temp as select stuName,stuNo,stuSex from stuInfo where stuAge>25;
¡¡¡¡1.2´´½¨Ð±í
¡¡¡¡/*ѧÉúÐÅÏ¢±í*/
¡¡¡¡create table stuInfo(
¡¡¡¡stuName varchar2(10) ,
¡¡¡¡stuNo varchar2(10),
¡¡¡¡stuSex varchar2(4),
¡¡¡¡stuAge number(2),
¡¡¡¡st ......