Welcome Guest!
 WEBDB
 Previous Message All Messages Next Message 
How to write the faster PL/SQL??????The difference between the following two sql  =?GB2312?Q?=D6=EC=B2=A5?=
 Nov 07, 2002 04:28 PST 
Hi,
I want to know the difference between the following two PL/SQL ,
No.1 :
-----------------------------------------------------------------------------------ĦĦĦĦĦĦ
select
   (select trim(typename) from d
    where typecode=a.docutypeid and cataid='GW'
    and deptid=b.deptid) || 'Ħ²'|| a.DISPATCHYEAR || 'Ħ³' || trim(a.dispatchno)
as wenhao,
   (select trim(typename) from d
    where typecode=b.currentstatus and cataid='ZT'
    and deptid=b.deptid)
as zhuangtai,
   (select trim(typename) from d
    where typecode=b.phase and cataid='HJ' and deptid=b.deptid )
as huanjie
from a, b, c
where a.docuid =b.docuid and b.docuid=c.docuid and b.phase='DPPF'and
b.deptid=c.receivedeptid and b.deptid=? and b.currentstatus=?
and a.dispatchyear=?
-----------------------------------------------------------------------------------
No.2 :
select TRIM(d1.TYPENAME) || 'Ħ²'|| a.DISPATCHYEAR || 'Ħ³' || trim(a.dispatchno)
as wenhao,
from a,b,c ,d d1,d d2, d d3
where a.docuid=b.docuid and b.docuid=c.docuid
and d1.typecode=a.docutypeid    and d1.cataid='GW' and d1.deptid=b.deptid
and d2.typecode=b.currentstatus and d2.cataid='ZT' and d2.deptid=b.deptid
and d3.typecode=b.phase         and d3.cataid='HJ' and d3.deptid=b.deptid
and b.phase='DPPF'and b.deptid=c.receivedeptid
and b.deptid=? and b.currentstatus=? and a.dispatchyear=?

-----------------------------------------------------------------------------------
the char '?' means for input variable.
the result of No.1 clause is same with the result of No.2 clause!

*************************************************************************************
   I want to know the difference of these clauses!and how to write the faster PL/SQL clause!
   Do u have the good experience of write efficient PL/SQL?

   Thanks a lot!

Bob Zhu   z-@dfmc.com.cn

2002/10/07
	
 Previous Message All Messages Next Message 
  Check It Out!

  Topica Channels
 Best of Topica
 Art & Design
 Books, Movies & TV
 Developers
 Food & Drink
 Health & Fitness
 Internet
 Music
 News & Information
 Personal Finance
 Personal Technology
 Small Business
 Software
 Sports
 Travel & Leisure
 Women & Family

  Start Your Own List!
Email lists are great for debating issues or publishing your views.
Start a List Today!

© 2001 Topica Inc. TFMB
Concerned about privacy? Topica is TrustE certified.
See our Privacy Policy.