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

ORACLE WITH AS Ó÷¨

Ô­ÎÄ´«ËÍÃÅ£ºhttp://blog.csdn.net/wh62592855/archive/2009/11/06/4776631.aspx
¼ÇµÃÒÔǰÔÚÂÛ̳Àï¿´µ½inthirtiesÓõ½¹ýWITH ASÕâ¸ö×ÖÑÛ£¬µ±Ê±Ã»ÌرðÔÚÒâ¡£½ñÌìÔÚÒ»¸öÌû×ÓÀïÓÖ¿´µ½ÓÐÈËÓÃÕâ¸ö£¬ËùÒÔ¾ÍÈ¥ÍøÉÏËÑÁËËÑÏà¹ØÄÚÈÝ£¬×Ô¼ºÐ¡ÊÔÁËÒ»°Ñ£¬Ð´ÏÂÀ´£¬·½±ãÒÔºóÍüÁ˵Ļ°Ñ§Ï°¡£
===================================================================================
ÏȾٸöÀý×Ó°É£º
ÓÐÁ½ÕÅ±í£¬·Ö±ðΪA¡¢B£¬ÇóµÃÒ»¸ö×ֶεÄÖµÏÈÔÚ±íAÖÐѰÕÒ£¬Èç¹ûA±íÖдæÔÚÊý¾Ý£¬ÔòÊä³öA±íµÄÖµ£»Èç¹ûA±íÖв»´æÔÚ£¬ÔòÔÚB±íÖÐѰÕÒ£¬ÈôB±íÖÐÓÐÏàÓ¦¼Ç¼£¬ÔòÊä³öB±íµÄÖµ£»Èç¹ûB±íÖÐÒ²²»´æÔÚ£¬ÔòÊä³ö"no records”×Ö·û´®¡£
with
sql1 as (select to_char(a) s_name from test_tempa),
sql2 as (select to_char(b) s_name from test_tempb where not exists (select s_name from sql1 where rownum=1))
select * from sql1
union all
select * from sql2
union all
select 'no records' from dual
where not exists (select s_name from sql1 where rownum=1)
and not exists (select s_name from sql2 where rownum=1);
Ôپٸö¼òµ¥µÄÀý×Ó
with a as (select * from test)
select * from a;
Æäʵ¾ÍÊǰÑÒ»´ó¶ÑÖØ¸´Óõ½µÄSQLÓï¾ä·ÅÔÚwith as ÀïÃæ£¬È¡Ò»¸ö±ðÃû£¬ºóÃæµÄ²éѯ¾Í¿ÉÒÔÓÃËü
ÕâÑù¶ÔÓÚ´óÅúÁ¿µÄSQLÓï¾äÆðµ½Ò»¸öÓÅ»¯µÄ×÷Ó㬶øÇÒÇå³þÃ÷ÁË
ÏÂÃæÊÇËÑË÷µ½µÄÓ¢ÎÄÎĵµ×ÊÁÏ
About Oracle WITH clause
Starting in Oracle9i release 2 we see an incorporation of the SQL-99 “WITH clause”, a tool for materializing subqueries to save Oracle from having to re-compute them multiple times.
The SQL “WITH clause” is very similar to the use of Global temporary tables (GTT), a technique that is often used to improve query speed for complex subqueries. Here are some important notes about the Oracle “WITH clause”:
   • The SQL “WITH clause” only works on Oracle 9i release 2 and beyond.
   • Formally, the “WITH clause” is called subquery factoring
   • The SQL “WITH clause” is used when a subquery is executed multiple times
   • Also useful for re


Ïà¹ØÎĵµ£º

PostgreSQLаæÌá¸ßOracle¼æÈÝÐÔ ÓûÓë¼×¹ÇÎÄÊԱȸߣ¿

ÉÌÒµ¿ªÔ´Êý¾Ý¿â³§¼ÒEnterpriseDBÓë6ÔÂ17ÈÕ·¢²¼ÁË×îеÄPostgres Plus¸ß¼¶·þÎñÆ÷°æ£¬ÆäÄ¿±êÊÇÌá¸ßÓëOracleÊý¾Ý¿âµÄ¼æÈÝÐÔ£¬EnterpriseDBÊÇ¿ªÔ´Êý¾Ý¿âPostgreSQL£¨Ò²½Ð×öPostgres£©±³ºóµÄÖ÷ÒªÉÌÒµÖ§³Ö¹«Ë¾¡£
ÆäʵPostgres Plus¸ß¼¶·þÎñÆ÷°æ²¢·ÇÍêÈ«¿ªÔ´£¬ËüÊÇÔÚ¿ªÔ´µÄPostgreSQLÊý¾Ý¿â»ù´¡Ö®ÉÏÌí¼ÓÁËÐí¶à¸½¼ÓÌØÐÔ£¬ÒÔÌá¸ßºÍO ......

´î½¨Oracle 10g Proc+VS2008¿ª·¢»·¾³

1¡¢ÏÂÔØ°²×°Microsoft Visual Studio 2008£º
     ÏÂÔØµØÖ·£ºhttp://www.microsoft.com/downloads/details.aspx?FamilyId=83C3A1EC-ED72-4A79-8961-25635DB0192B&displaylang=zh-cn£¬Õâ¸öÊÇ“Visual Studio 2008 רҵ°æ£¨90 ÌìÊÔÓð棩”¡£
     °²×°²½ÖèÂÔ¡£
2¡ ......

oracle ÕÒ³öÁ½±íÖ®¼ä·ÇÖØ¸´Êý¾Ý

select r.rollid as rollid from zh1_rool r where r.date_p >=to_date('2009-11-26 23:59:59','yyyy-mm-dd hh24:mi:ss') and rollid not in
(select t.lot_number as rollid
from inv.mtl_onhand_quantities_detail t
left join mtl_system_items_b mi
on t.inventory_item_id = mi.inventory_ ......

oracle union

select t.lot_number
from inv.mtl_onhand_quantities_detail t
left join mtl_system_items_b mi
on t.inventory_item_id = mi.inventory_item_id
where mi.segment1 like '101%' and mi.organization_id = 102
group by t.lot_number having count(*)=1 union
select t.lot_number||'x'
......

ORACLE RAC¹¤×÷Ô­Àí


ORACLE RAC¹¤×÷Ô­Àí
ORACLE RAC¹¤×÷Ô­Àí
¡¡¡¡ÔÚÒ»¸öÓ¦Óû·¾³µ±ÖУ¬ËùÓеķþÎñÆ÷ʹÓú͹ÜÀíͬһ¸öÊý¾Ý¿â£¬Ä¿µÄÊÇΪÁË·Öɢÿһ̨·þÎñÆ÷µÄ¹¤×÷Á¿£¬Ó²¼þÉÏÖÁÉÙÐèÒªÁ½Ì¨ÒÔÉϵķþÎñÆ÷£¬¶øÇÒ»¹ÐèÒªÒ»¸ö¹²Ïí´æ´¢É豸¡£Í¬Ê±»¹ÐèÒªÁ½ÀàÈí¼þ£¬Ò»¸öÊǼ¯ÈºÈí¼þ£¬ÁíÍâÒ»¸ö¾ÍÊÇOracleÊý¾Ý¿âÖеÄRAC×é¼þ¡£Í¬Ê±ËùÓзþÎñÆ÷ÉϵÄOS¶¼Ó¦¸ÃÊÇÍ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ