¡¾×ª¡¿ ¹ØÓÚPL/SQLÖжԴ洢¹ý³Ìadd debug information
¹ØÓÚPL/SQLÖжԴ洢¹ý³Ìadd debug information
http://space.itpub.net/13129975/viewspace-626245
Èç¹ûʹÓÃPL/SQL DeveloperÖÐÑ¡ÔñÒ»¸ö´æ´¢¹ý³Ìdebugµ«ÓÖdebug²»½øÈ¥£¡
½â¾öÕâ¸öÎÊÌâÊǺܼòµ¥µÄ£¬Ö»ÐèÒªÔÚPL/SQL DeveloperÖÐÑ¡ÔñÒªdebugµÄ´æ´¢¹ý³Ì£¬È»ºóµãÓÒ¼ü£¬ÔÚµ¯³öµÄ²Ëµ¥ÖÐÑ¡Ôñ"Add debug information"ºóÔÙÖØпªÒ»¸ö´°¿Ú¿ªÊ¼debug¾ÍÄÜdebug½øÈ¥ÁË¡£
ÏÖÔڵĹؼüÎÊÌâÊÇ£ºµ±¶ÔÒ»¸ö´æ´¢¹ý³ÌÑ¡Ôñ"Add debug information"ºó£¬PL/SQL Developerµ½µ××öÁËʲôÊÂÇ飿ÔÚPL/SQL DeveloperÖÐÈç¹ûij¸ö´æ´¢¹ý³ÌÄܹ»±»debug½øÈ¥£¬ÔòÄãÔÚÕâ¸ö´æ´¢¹ý³ÌÉϵãÓÒ¼ü£¬ÔÚµ¯³öµÄ²Ëµ¥ÖÐÑ¡Ïî"Add debug information"Ç°Ãæ»áÓÐÒ»¸öС¹´£¬PL/SQL DeveloperÊÇ´ÓÄĶùÖªµÀÕâ¸öС¹´Ó¦²»Ó¦¸Ã¹´Éϵģ¿
µÚÒ»¸öÎÊÌâµÄ´ð°¸ÊÇPL/SQL Developerʵ¼ÊÊÇÖ´ÐÐÁËALTER PROCEDUREOWNER.PROCEDURENAME COMPILE DEBUG¡£
ÈçÏÂÊÇÎÒÑо¿ÉÏÊöÎÊÌâµÄÕû¸ö¹ý³Ì£º
´ò¿ªÒ»¸ö PL/SQL Developer£¬²éѯһÏÂÕâ¸öPL/SQL DeveloperµÄmain sessionµÄsid£¬ÕâÀïµÃµ½µÄ½á¹ûÊÇ421¡£
È»ºóÔÙ¿ªÒ»¸ösql plusµÄ´°¿Ú£¬ÒÀ´ÎÖ´ÐÐÈçÏÂÓï¾ä£º
SQL> select p.PID,p.SPID,s.SID from v$process p,v$session s where s.paddr = p.addr and s.sid = 421;
PID SPID SID
---------- ------------ ----------
28 241816 421
SQL> oradebug setospid 241816
Oracle pid: 28, Unix process pid: 241816, image: oracle@p690ca
SQL> oradebug unlimit
ÒÑ´¦ÀíµÄÓï¾ä
SQL> oradebug event 10046 trace name context forever,level 12
ÒÑ´¦ÀíµÄÓï¾ä
ÉÏÊö¼¸²½×öÍêºó»Øµ½ÔÏȵÄÄǸöPL/SQL Developer£¬Ñ¡Öд洢¹ý³ÌA_TESTINGFORJOBMANAGER£¬È»ºóµãÓÒ¼ü£¬ÔÚµ¯³öµÄ²Ëµ¥ÖÐÑ¡Ôñ"Add debug information"¡£
Ôٻص½sqlplus´°¿Ú£¬ÒÀ´ÎÖ´ÐÐÈçÏÂÓï¾ä£º
SQL> oradebug tracefile_name
/u01/app/oracle/admin/ipratest/udump/ipratest_ora_241816.trc
SQL> oradebug event 10046 trace name context off
Ò
Ïà¹ØÎĵµ£º
ϵͳ»·¾³£ºWindows 7
Èí¼þ»·¾³£ºVisual C++ 2008 SP1 +SQL Server 2005
±¾´ÎÄ¿µÄ£º±àдһ¸öº½¿Õ¹ÜÀíϵͳ
ÕâÊÇÊý¾Ý¿â¿Î³ÌÉè¼ÆµÄ³É¹û£¬ËäÈ»³É¼¨²»¼Ñ£¬µ«ÊÇ×÷ΪÎÒÓÃVC++ ÒÔÀ´±àдµÄ×î´ó³ÌÐò»¹ÊÇ´«µ½ÍøÉÏ£¬ÒÔ¹©²Î¿¼¡£ÓÃVC++ ×öÊý¾Ý¿âÉè¼Æ²¢²»ÈÝÒ×£¬µ«Ò²²»ÊDz»¿ÉÄÜ¡£ÒÔÏÂÊÇÎҵijÌÐò½çÃ棬ºóÃæ ......
.PivotµÄÓ÷¨Ìå»á:
Óï¾ä·¶Àý:
select PN,[2006/5/30] as [20060530],[2006/6/2] as [20060602]
from consumptiondata a
Pivot (sum(a.M_qty) FOR a.M_date in ([2006/5/30],[2006/6/2])) as PVT
order by PN
Table½á¹¹ Consumptiondata (PN,M_Date,M_qty)
order by PN¿ÉÒª¿É²»Òª,²¢²»ÖØ ......
ÔںܶàµÄ×ÊÁÏÖж¼ÃèÊö˵SQLSERVERµÄ´æ´¢¹ý³Ì½ÏÆÕͨµÄSQLÓï¾äÓÐÒÔÏÂÓŵ㣺
1. ´æ´¢¹ý³ÌÖ»ÔÚ´´Ôìʱ½øÐбàÒë¼´¿É£¬ÒÔºóÿ´ÎÖ´Ðд洢¹ý³Ì¶¼²»ÐèÔÙÖØбàÒ룬¶øÎÒÃÇͨ³£Ê¹ÓõÄSQLÓï¾äÿִÐÐÒ»´Î¾Í±àÒëÒ»´Î,ËùÒÔʹÓô洢¹ý³Ì¿ÉÌá¸ßÊý¾Ý¿âÖ´ÐÐËٶȡ£
2. &nbs ......
SQL Server´´½¨ÁÙʱ±í£º
´´½¨ÁÙʱ±í
·½·¨Ò»£º
create table #ÁÙʱ±íÃû(×Ö¶Î1 Ô¼ÊøÌõ¼þ,
×Ö¶Î2 Ô¼ÊøÌõ¼þ,
.....)
create table ##ÁÙʱ±íÃû(×Ö¶Î1 Ô¼ÊøÌõ¼þ,
×Ö¶Î2 Ô¼ÊøÌõ¼þ,
.....)
·½·¨¶þ£º
select * into #ÁÙʱ±íÃû from ÄãµÄ±í;
select * into ##ÁÙʱ±íÃû from ÄãµÄ±í;
×¢£ºÒÔÉϵÄ#´ú±í¾Ö²¿ÁÙʱ±í£¬##´ú±íÈ«¾ ......
µÚÒ»ÖÖ·½·¨£ºÊ¹ÓÃNVLº¯Êý´¦ÀíNULLÖµ¡£
ÆäÓï·¨¸ñʽÊÇNVL(exp1,exp2)¡£ÆäÖвÎÊýexp1ºÍexp2¿ÉÒÔʹÈÎÒâÊý¾ÝµÄÀàÐÍ£¬µ«Á½ÕßÊý¾ÝÀàÐͱØÐëÆ¥Å䡣ʾÀý£ºselect ename,sal,comm,sal+nvl(comm,0) as salary from emp;
µÚ¶þÖÖ·½·¨£ºÊ¹ÓÃNVL2º¯Êý´¦ÀíNULLÖµ¡£
ÆäÓï·¨¸ñʽÊÇNVL2(exp1,exp2,exp3)¡£ÕâÊÇoracle9iÐÂÔö¼ÓµÄº¯Êý¡£Èç¹ûexp1 ......