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

¡¾×ª¡¿oracleÐÐתÁÐͨÓùý³Ì

oracleÐÐתÁÐͨÓùý³Ì(ת)
»·¾³oracle 10g
¹¤×÷¹ØÏµ,³£×öЩÐÐתÁб¨±í,±¨±íͨ³£²»ÊÇÔÚ´óÊý¾Ý¼¯ºÏÉÏ´¦Àí.
ËùÒÔдÁ˸ö¹ý³Ì.
±¾¹ý³Ì±È½ÏÊʺÏÔÚÓÚÐèÒª¶¯Ì¬Êä³ö±¨±íµÄµØ·½,ÀýÈçwebÖÐ.
²»ÊǺÜÍêÃÀ,µ«ÒѾ­¿ÉÒÔ½â¾ö¾ø´ó²¿·ÖµÄÎÊÌâ.
create or replace function func_RowToCol(
viewName Varchar2,
grpCols Varchar2,
colCol Varchar2,
valueCol Varchar2,
fillEmptyWithZero Number:=1,
rowOrder Varchar2:='',
colOrder Varchar2:='',
rowOrderinGrp Integer:=1,
colOrderStyle Varchar2:=' asc ',
fillValue Varchar2:=''
) return varchar2
Is
/*****************************************************************************************************
Ãû³Æ:func_RowToCol
²ÎÊý˵Ã÷:
viewName ÊÓͼÃû³Æ,ʵ¼ÊÉÏ¿ÉÒÔÊÇÊý¾Ý¿âµÄ±í¸ñÃû³Æ,ÊÓͼÃû³Æ,Ò²¿ÉÒÔÊÇSQLÓï¾ä.
grpCols ÐèÒª·Ö×éµÄÁÐ,ÒÔ¸ñʽ col1,col2..coln´«Èë,ÆäÖÐnÊÇ´óÓÚ0µÄÕûÊý
colCol ÓÉÐÐתΪÁеÄÄǸöÁÐ
valueCol ÐÐתÁкó,ÒÀÈ»×÷ΪֵÌî³äµÄÄǸöÁÐ,Ö»ÄÜÊÇÒ»¸öÁÐ
--viewIsSql ÊÓͼÊÇ·ñÊÇsqlÓï¾ä,Èç¹ûÊÇÔò´«Èë1,·´Ö®´«Èë2,ĬÈÏÊÇ1(ÊÇsql)
fillEmptyWithZero ÓÃ0À´Ìî³ä¿ÕÖµ,ĬÈÏ¿ÕÖµÒÀÈ»±£Áô¿ÕÖµ.Èç¹ûÊÇ1,ÔòÖ»¶ÔvalueColΪÊýÖµÀàÐ͵ÄÓÐЧ.
rowOrder ½á¹ûĬÈϵÄÅÅÐòÓï¾ä,Èç¹ûÓÐ,ÔòʹÓÃÕâ¸ö£¬Õâ¸öÊǶԽá¹ûµÄÐÐÅÅÐò
colOrder ¶Ôת³ÉµÄÁнøÐÐÅÅÐòµÄÒÀ¾Ý.
rowOrderinGrp ÐеÄÅÅÐòÁÐÊÇ·ñÔÚ·Ö×éÁУ¨grpcols)ÖУ¬0 ±íʾ²»ÊÇ£¬1±íʾÊÇ£¬Ä¬ÈÏÊÇÔÚ·Ö×éÁÐÖС£
colOrderStyle Õâ¸ö²ÎÊý˵Ã÷ÁËÁеÄÅÅÐò·½Ê½
fillValue Ìî³äÖµ£¬Èç¹û·Ç¿Õ,ÇÒfillEmptyWithZero=1£¬ÔòÓÃ.
¾ÙÀý:ÓÐÒ»¸ö±í¸ñEmpSalary(SalMonth number,EmpName varchar2(20),salary number) ÆäÖÐ
salMonth,EmpName×é³ÉÎ¨Ò»Ô¼Êø
¼ÙÉèÓÐÒÔÏÂÊý¾Ý:
SALMONTH EMPNAME SALARY
---------- -------------------- ----------
200801 lzf 8000
200801 wth 8000
200801 lxl 7000
200801 fjl 8000
200801 wcl 40000
200802 lzf 9000
200802 wth 8000
....
ÏÖÔÚÐèÒª°´ÕÕÕâÑùµÄ¸ñʽÊä³ö
salaryMonth lzf wth lxl fjl wcl
200801 8000 8000 7000 8000 40000
200801 9000 8000
ÄÇô²ÎÊýÓ¦¸ÃÕâÑù´«µÝfunc_RowToCol('empsalary','','salarymonth','empname','salary',0,1);
Êä³ö:
Èç¹û³É¹¦,Ôò·µ»ØÒ»¸ö»ùÓÚtempdata_manycolsµÄ²éѯsql×Ö·û´®
Èç¹ûʧ°Ü,Ôò·µ»Ø¿ÕÖµ.
×¢ÒâÊÂÏî:
±¾º¯ÊýÊÇ»ùÓÚÒ»¸ö½Ðtempdata_manyCols


Ïà¹ØÎĵµ£º

Oracle Êý¾Ý¿âµÄ°ó¶¨±äÁ¿ÌØÐÔ¼°Ó¦ÓÃ

¹Ø¼ü´Ê:
°ó¶¨±äÁ¿(binding variable),¹²Ïí³Ø(shared buffer pool), SGA(system global area);
ÔÚ¿ª·¢Ò»¸öÊý¾Ý¿âϵͳǰ,ÓÐË­¶ÔOracle ϵͳÁ˽âºÜ¶à,ÓÈÆäÊÇËüµÄÌØÐÔ,ºÃÏóºÜÉÙ°É;¶Ô³õѧÕßÀ´½²,Õâ¸üÊDz»¿ÉÄܵÄÊÂÇé;½ö½ö¼òµ¥ÕÆÎÕÁËSQLµÄд·¨,¾Í¿ªÊ¼ÁËÊý¾Ý¿âµÄ¿ª·¢,Æä½á¹ûÖ»ÄÜÊÇ¿ª·¢Ò»¸öûÓÐЧÂÊ,ҲûÓпÉÀ©Õ¹µÄϵͳ;
Òò´Ë,ÎÒ ......

¡¶Í¿Ä¨Oracle£­Èý˼±Ê¼ÇÖ®Ò»²½Ò»²½Ñ§Oracle¡·³ö¯ÊÖ¼Ç

¡öÀÖÖª
  “Ë­ÊÇË­µÄË­”£¬ÕâÊÇΨÃÀÖÐ͸×ÅÓÄÔ¹µÄÒ»Ê׸裬µ«È´»áĪÃûµØµçµ½ÐÄÖеÄÀÛ¡£Ñ§Ï°Ì«ÀÛ£¬¹¤×÷Ì«ÀÛ£¬Éú»îÌ«ÀÛ£¬Á¬¸èÃûÌý×Ŷ¼ÄÇôÀÛ¡£
²ß»®µÄµÚÒ»±¾Êé¡¶´óÏó——Thinking in UML¡·£¬´ÓÔË×÷£¬µ½ÉÏÊУ¬µ½³©Ïú£¬µ½¾­µä£¬µ½¹úÄÚUMLµÚÒ»Ê飬һÄêÖ®ÄÚʵÏÖÁËÒ»¸ö¸öûÓÐÃιýµÄÃÎÏë¡£ÕýÈçÕâÊ׸èÖеÄÒ ......

Oracle 9i/10g ĬÈϵÄÓû§ºÍÃÜÂë

sys/change_on_install
system/manager
sysman/oem_temp
scott/tiger
aqadm /aqadm
Dbsnmp/dbsnmp
Óû§Ãû ¿ÚÁî µÇ¼Éí·Ý¼°ËµÃ÷
sys/change_on_install SYSDBA»òSYSOPER£¬µ«²»ÄÜÒÔNORMALµÇ¼£¬¿É×÷ΪĬÈϵÄϵͳ¹ÜÀíÔ±¡£
system/Manager SYSDBA»òNORMAL£¬µ«²»ÄÜÒÔSYSOPERµÇ¼£¬¿É×÷ΪĬÈϵÄϵͳ¹ÜÀíÔ±¡£
scott/Tig ......

ORACLE ÐÐתÁÐ ²âÊÔͨ¹ý£¨9i£©

--ORACLE ÐÐתÁР ²âÊÔͨ¹ý£¨9i£©
/***************************************************************************************************
ÒÔѧÉú³É¼¨ÎªÀý×Ó£¬±È½ÏÐÎÏóÒ×¶®
***********************************************************************************************************/
--1¡¢ÐÐתÁÐ
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ