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

SQL *PLUS RepostµÄ¿ª·¢·½·¨

SQL *PLUS  RepostµÄ¿ª·¢·½·¨
ʹÓÃSQL*PLUS ¿ÉÖ±½ÓÔÚIE BrowserÖÐÉú³É¹æÕûµÄ×Ö·ûÐÍReport. ʵÏÖ·½·¨¼òµ¥£¬²¼ÊðÈÝÒס£
·½·¨:
1.       ÀûÓÃÎı¾±à¼­Æ÷±àдSQL*PLUS  ½Å±¾£¬±£´æ³É .sql Îļþ¡£
2.       ÉÏ´«sql ÎļþÖÁÓ¦ÓõÄsql Ŀ¼¡£
3.       ×¢²áMethod ΪSQL*PLUS µÄConcurrent,²¢µ÷ÓÃ´Ë sql Îļþ.
SQL*PLUS Report µÄ¸ñʽ»¯·½·¨:
1.       ¸Ä±äÁбêÌâ
COLUMN  <×Ö¶ÎÃû»ò×ֶαðÃû> HEADING <±êÌâÃû>
Àý:
       COLUMN LAST_NAME      HEADING 'LAST NAME'
       COLUMN SALARY         HEADING 'MONTHLY SALARY'
       COLUMN COMMISSION_PCT HEADING 'COMMISSION'
 
      
2.       ÁбêÌâ×Ô¶¯ÕÛÐÐ
COLUMN  <×Ö¶ÎÃû»ò×ֶαðÃû> HEADING <±êÌâÃû1-1|±êÌâÃû1-2>
Àý£º
       COLUMN SALARY    HEADING 'MONTHLY|SALARY'
COLUMN LAST_NAME HEADING 'LAST|NAME'
 
3.       ¸Ä±ä±êÌâÏ»®Ï߸ñʽ£¨Format of underline£©
SET UNDERLINE
Àý£º
SET UNDERLINE =
/
 
4.       ¸Ä±äÁеÄÏÔʾ¸ñʽ
COLUMN  <×Ö¶ÎÃû»ò×ֶαðÃû>  FORMAT <¸ñʽÃèÊö>
 
ÊýÖµÐ͸ñʽÃèÊöÓëto_numberº¯Êý»ù±¾Ò»Ö£¬Èç:
$99.990
ÆäËü¸ñʽÊý¾Ý¾ùÓÃA(n)À´ÉèÖÿí¶È,È磺
A10
Èç¹ûÓÐ×Ö·û³¬³ö10,Ôò»á×Ô¶¯ÕÛÐÐ. ³ý·ÇÄã×öÈçÏÂÉèÖà :
SET  WRAP OFF
Ôò¶à³öµÄ×Ö·û»á±»½Øµô.
 
5.       ¸´ÖÆ×ֶθñʽÉèÖÃ
COLUMN <Ä¿±ê×Ö¶ÎÃû> LIKE <À´Ô´×Ö¶ÎÃû> HEADING <±êÌâÃû>
Àý:
COLUMN COMMISSION_PCT LIKE SALARY HEADING BONUS 
 
6.       ²»ÏÔʾijһÁÐ
COLUMN <Ä¿±ê×Ö¶ÎÃû> NOPRINT
 
7.       ÅÅÐòºó£¬Öظ´×ֶβ»ÏÔʾ(¼´·Ö×é


Ïà¹ØÎĵµ£º

×Ô¼º×ܽáµÄ²»¶¨Ìõ¼þSQL²éѯÓï¾äµÄд·¨

  ÎÒ˵µÄ²»¶¨Ìõ¼þÊÇÖ¸²éѯÌõ¼þµÄ¸öÊý²»¶¨¡£ÓÐʱһ¸ö£¬ÓÐʱÁ½¸ö£¬ÓÐʱºÃ¼¸¸ö¡£
Ê×ÏÈÎÒ·¢ÏÖ
select * from A where a='kkk' Óë
select * from A where a like 'kkk'
ÆäʵЧ¹ûÊÇÒ»Ñù£¬Ö»Òª like ºóÃæµÄ×Ö·û´®²»°üº¬Í¨Åä·û¡£ÕâÑùÒ»À´¾ÍºÜ·½±ãÁË¡£Æ©ÈçÓÐ
select * from A where a='KKK' and b='LLL'
ÓÐÁ½¸ö²éѯÌõ¼þ£¬ ......

sqlÓï·¨caseÓ÷¨

CASE ¿ÉÄÜÊÇ SQL Öб»ÎóÓÃ×î¶àµÄ¹Ø¼ü×ÖÖ®Ò»¡£ËäÈ»Äã¿ÉÄÜÒÔÇ°ÓùýÕâ¸ö¹Ø¼ü×ÖÀ´´´½¨×ֶΣ¬µ«ÊÇËü»¹¾ßÓиü¶àÓ÷¨¡£ÀýÈ磬Äã¿ÉÒÔÔÚ WHERE 
×Ó¾äÖÐʹÓà CASE¡£ 
Ê×ÏÈÈÃÎÒÃÇ¿´Ò»Ï CASE µÄÓï·¨¡£ÔÚÒ»°ãµÄ SELECT ÖУ¬ÆäÓï·¨ÈçÏ£º 
SELECT = 
CASE 
WHEN THEN 
WHEN THEN 
ELSE  ......

SQL×Ö·û´®´¦Àíº¯Êý»ã×Ü

Ò»¡¢×Ö·ûת»»º¯Êý
1¡¢ASCII()
·µ»Ø×Ö·û±í´ïʽ×î×ó¶Ë×Ö·ûµÄASCII ÂëÖµ¡£ÔÚASCII£¨£©º¯ÊýÖУ¬´¿Êý×ÖµÄ×Ö·û´®¿É²»ÓÑ’À¨ÆðÀ´£¬µ«º¬ÆäËü×Ö·ûµÄ×Ö·û´®±ØÐëÓÑ’À¨ÆðÀ´Ê¹Ó㬷ñÔò»á³ö´í¡£
2¡¢CHAR()
½«ASCII Âëת»»Îª×Ö·û¡£Èç¹ûûÓÐÊäÈë0 ~ 255 Ö®¼äµÄASCII ÂëÖµ£¬CHAR£¨£© ·µ»ØNULL ¡£
3¡¢LOWE ......

ÓÃEXPLAIN PLAN ·ÖÎöSQLÓï¾ä

ÈçºÎÉú³Éexplain plan?
¡¡¡¡½â´ð:ÔËÐÐutlxplan.sql. ½¨Á¢plan ±í
¡¡¡¡Õë¶ÔÌض¨SQLÓï¾ä£¬Ê¹Óà explain plan set statement_id = 'tst1' into plan_table
¡¡¡¡ÔËÐÐutlxplp.sql »ò utlxpls.sql²ì¿´explain plan
EXPLAIN PLAN ÊÇÒ»¸öºÜºÃµÄ·ÖÎöSQLÓï¾äµÄ¹¤¾ß,ËüÉõÖÁ¿ÉÒÔÔÚ²»Ö´ÐÐSQLµÄÇé¿öÏ·ÖÎöÓï¾ä. ͨ¹ý·ÖÎö,ÎÒÃǾͿÉÒÔÖ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ