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

SQL PLUS ÃüÁî´óÈ«(ת)

OracleµÄsql*plusÊÇÓëoracle½øÐн»»¥µÄ¿Í»§¶Ë¹¤¾ß¡£ÔÚsql*plusÖУ¬¿ÉÒÔÔËÐÐsql*plusÃüÁîÓësql*plusÓï¾ä¡£
   ÎÒÃÇͨ³£Ëù˵µÄDML¡¢DDL¡¢DCLÓï¾ä¶¼ÊÇsql*plusÓï¾ä£¬ËüÃÇÖ´ÐÐÍêºó£¬¶¼¿ÉÒÔ±£´æÔÚÒ»¸ö±»³ÆΪsql bufferµÄÄÚ´æÇøÓòÖУ¬²¢ÇÒÖ»Äܱ£´æÒ»Ìõ×î½üÖ´ÐеÄsqlÓï¾ä£¬ÎÒÃÇ¿ÉÒÔ¶Ô±£´æÔÚsql bufferÖеÄsql Óï¾ä½øÐÐÐ޸ģ¬È»ºóÔÙ´ÎÖ´ÐУ¬sql*plusÒ»°ã¶¼ÓëÊý¾Ý¿â´ò½»µÀ¡£
   ³ýÁËsql*plusÓï¾ä£¬ÔÚsql*plusÖÐÖ´ÐеÄÆäËüÓï¾äÎÒÃdzÆ֮Ϊsql*plusÃüÁî¡£ËüÃÇÖ´ÐÐÍêºó£¬²»±£´æÔÚsql bufferµÄÄÚ´æÇøÓòÖУ¬ËüÃÇÒ»°ãÓÃÀ´¶ÔÊä³öµÄ½á¹û½øÐиñʽ»¯ÏÔʾ£¬ÒÔ±ãÓÚÖÆ×÷±¨±í¡£
   ÏÂÃæ¾Í½éÉÜÒ»ÏÂһЩ³£ÓõÄsql*plusÃüÁ
 
1. Ö´ÐÐÒ»¸öSQL½Å±¾Îļþ
SQL>start file_name
SQL>@ file_name
ÎÒÃÇ¿ÉÒÔ½«¶àÌõsqlÓï¾ä±£´æÔÚÒ»¸öÎı¾ÎļþÖУ¬ÕâÑùµ±ÒªÖ´ÐÐÕâ¸öÎļþÖеÄËùÓеÄsqlÓï¾äʱ£¬ÓÃÉÏÃæµÄÈÎÒ»ÃüÁî¼´¿É£¬ÕâÀàËÆÓÚdosÖеÄÅú´¦Àí¡£
@Óë@@µÄÇø±ðÊÇʲô£¿
@µÈÓÚstartÃüÁÓÃÀ´ÔËÐÐÒ»¸ösql½Å±¾Îļþ¡£
@ÃüÁîµ÷Óõ±Ç°Ä¿Â¼Ïµģ¬»òÖ¸¶¨È«Â·¾¶£¬»ò¿ÉÒÔͨ¹ýSQLPATH»·¾³±äÁ¿ËÑÑ°µ½µÄ½Å±¾Îļþ¡£¸ÃÃüÁîʹÓÃÊÇÒ»°ãÒªÖ¸¶¨ÒªÖ´ÐеÄÎļþµÄȫ·¾¶£¬·ñÔò´Óȱʡ·¾¶(¿ÉÓÃSQLPATH±äÁ¿Ö¸¶¨)϶ÁÈ¡Ö¸¶¨µÄÎļþ¡£
@@ÓÃÔÚsql½Å±¾ÎļþÖУ¬ÓÃÀ´ËµÃ÷ÓÃ@@Ö´ÐеÄsql½Å±¾ÎļþÓë@@ËùÔÚµÄÎļþÔÚͬһĿ¼Ï£¬¶ø²»ÓÃÖ¸¶¨ÒªÖ´ÐÐsql½Å±¾ÎļþµÄȫ·¾¶£¬Ò²²»ÊÇ´ÓSQLPATH»·¾³±äÁ¿Ö¸¶¨µÄ·¾¶ÖÐÑ°ÕÒsql½Å±¾Îļþ£¬¸ÃÃüÁîÒ»°ãÓÃÔڽű¾ÎļþÖС£
È磺ÔÚc:\tempĿ¼ÏÂÓÐÎļþstart.sqlºÍnest_start.sql£¬start.sql½Å±¾ÎļþµÄÄÚÈÝΪ£º
@@nest_start.sql     - - Ï൱ÓÚ@ c:\temp\nest_start.sql
ÔòÎÒÃÇÔÚsql*plusÖУ¬ÕâÑùÖ´ÐУº
SQL> @ c:\temp\start.sql
2. ¶Ôµ±Ç°µÄÊäÈë½øÐб༭
SQL>edit
 
3. ÖØÐÂÔËÐÐÉÏÒ»´ÎÔËÐеÄsqlÓï¾ä
SQL>/
 
4. ½«ÏÔʾµÄÄÚÈÝÊä³öµ½Ö¸¶¨Îļþ
SQL> SPOOL file_name
   ÔÚÆÁÄ»ÉϵÄËùÓÐÄÚÈݶ¼°üº¬ÔÚ¸ÃÎļþÖУ¬°üÀ¨ÄãÊäÈëµÄsqlÓï¾ä¡£
 
5. ¹Ø±ÕspoolÊä³ö
SQL> SPOOL OFF
   Ö»ÓйرÕspoolÊä³ö£¬²Å»áÔÚÊä³öÎļþÖп´µ½Êä³öµÄÄÚÈÝ¡£
 
6£®ÏÔʾһ¸ö±íµÄ½á¹¹
SQL> desc table_name
 
7. COLÃüÁ
Ö÷Òª¸ñʽ»¯ÁеÄÏÔʾÐÎʽ¡£
¸ÃÃüÁîÓÐÐí¶àÑ¡Ï¾ßÌåÈçÏ£º
COL[UMN] [{ column|expr} [ option ...]]
O


Ïà¹ØÎĵµ£º

²âÊÔSQL ServerÖ´ÐÐʱ¼äºÍCPUʱ¼ä

ÔÚÐèÒª²âÊÔsqlÓï¾ä»òÕß´æ´¢¹ý³ÌÐÔÄܵÄʱºò¿ÉÒÔÓõÃÉÏ
  CHECKPOINT --ÓÃÓÚ¼ì²éµ±Ç°¹¤×÷µÄÊý¾Ý¿âÖб»¸ü¸Ä¹ýµÄÊý¾ÝÒ³»òÈÕÖ¾Ò³£¬²¢½«ÕâЩÊý¾Ý´ÓÊý¾Ý»º³åÆ÷ÖÐÇ¿ÖÆдÈëÓ²ÅÌ
  GO
  DBCC FreeProcCache --´Ó»º³å³ØÖÐɾ³ýËùÓлº³åÇø
  DBCC DropCleanBuffers&nbs ......

JAVAÖзÀÖ¹SQL×¢Èë¹¥»÷ÀàµÄÔ´´úÂë

JAVA£­×Ö·û´®¹ýÂËÀà
package cn.com.hbivt.util;
/**
* Title:
*
* Description:
*
* Copyright: Copyright (c) 2005
*
* Company:
*
* @author not attributable
* @version 1.0
*/
public class StringUtils {
   ......

Îı¾µÄµ¼Èëµ¼³öºÍSQL½Å±¾µÄÖ´Ðз½·¨


Ò».Îı¾µ¼ÈëÊý¾Ý¿â
--²½Öè1.´´½¨¿ØÖÆÎļþ
load data¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ --1¡¢¿ØÖÆÎļþ±êʶ
infile 'E:\oradata\orcl\test\inf_user.txt'¡¡¡¡¡¡¡¡¡¡¡¡¡¡ --2¡¢ÒªÊäÈëµÄÊý¾ÝÎļþÃûΪinf_user.txt   (Îļþȱʡ·Åµ½C:\ Ï£¬Èç¹û²»ÊÇ£¬¾ÍÐèÒªÖ¸Ã÷ȫ·¾¶)
append into table inf_user¡¡¡¡¡¡¡¡--3¡¢Ïò±ítestÖÐ× ......

ÀàËÆSQL µÄGroup by¹¦ÄÜ

×î½ü×öÁ˼¸¸öССͳ¼ÆµÄ±¨±í½çÃ棬ÓÉÓÚ.net²»´øgroup by µÄ¹¦ÄÜ£¬Í³¼ÆÆðÀ´ÓÐʱºòÏ൱²»±ã£¬±ã³Ã×Å˯×ŵÄʱºòдÁËÒ»¸öÀàËƵķ½·¨¡£
Óв»×ãÖ®´¦»òÊÇÓиüºÃµÄ·½·¨»¹Íû´ó¼ÒÖ¸Õý¡£
ÖÁÓÚЧÂÊÈçºÎ£¿Î´Öª£¬ÒòΪ±¾È˵IJâÊÔÊý¾Ý¾ÍÊDZȽÏÉÙ¡£
/// <summary>
/// SQL Group by
/// </summary>
/// &l ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ