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

oracleͬʱÏò¶à±í²åÈëÊý¾Ý

µ¥±í²åÈëÒÔinsert into¿ªÍ·,²»ÄÜÓÐthen intoÓï¾ä.
¶à±í²åÈëÒÔinsert first/all ¿ªÍ·,¿ÉÒÔÓÐthen intoÓï¾ä
ÔÚOracle²Ù×÷¹ý³ÌÖо­³£»áÓöµ½Í¬Ê±Ïò¶à¸ö²»Í¬µÄ±í²åÈëÊý¾Ý£¬´ËʱÓøÃÓï¾ä¾Í·Ç³£ºÏÊÊ¡£
All±íʾ·Ç¶Ì·ÔËË㣬¼´Âú×ãÁ˵ÚÒ»¸öÌõ¼þÒ²µÃÏòÏÂÖ´Ðв鿴ÊÇ·ñÂú×ãÆäËüÌõ¼þ£¬¶øFirstÊǶÌ·ÔËËãÕÒµ½ºÏÊÊÌõ¼þ¾Í²»ÏòϽøÐС£
INSERT ALL
WHEN prod_category=’B’ THEN
INTO book_sales(prod_id,cust_id,qty_sold,amt_sold)
VALUES(product_id,customer_id,sale_qty,sale_price)
WHEN prod_category=’V’ THEN
INTO video_sales(prod_id,cust_id,qty_sold,amt_sold)
VALUES(product_id,customer_id,sale_qty,sale_price)
WHEN prod_category=’A’ THEN
INTO audio_sales(prod_id,cust_id,qty_sold,amt_sold)
VALUES(product_id,customer_id,sale_qty,sale_price)
SELECT prod_category ,product_id ,customer_id ,sale_qty
,sale_price
from sales_detail;
Merging Rows into a Table
 
MERGE INTO oe.product_information pi
USING (SELECT product_id, list_price, min_price
from new_prices) NP
ON (pi.product_id = np.product_id)
WHEN MATCHED THEN UPDATE SET pi.list_price =np.list_price
,pi.min_price = np.min_price
WHEN NOT MATCHED THEN INSERT (pi.product_id,pi.category_id
,pi.list_price,pi.min_price)
VALUES (np.product_id, 33,np.list_price, np.min_price);


Ïà¹ØÎĵµ£º

oracleÊý¾Ý¿âʱ³£ÓõIJÙ×÷ÃüÁîÕûÀí

µÇ¼oracleÊý¾Ý¿âʱ³£ÓõIJÙ×÷ÃüÁîÕûÀí
1¡¢su – oracle ²»ÊDZØÐ裬ÊʺÏÓÚûÓÐDBAÃÜÂëʱʹÓ㬿ÉÒÔ²»ÓÃÃÜÂëÀ´½øÈësqlplus½çÃæ¡£
2¡¢sqlplus /nolog »òsqlplus system/manager »ò./sqlplus system/manager@ora9i
;
3¡¢SQL>connect / as sysdba ;£¨as sysoper£©»ò
connect internal/oracle AS SYSDBA ;(scott/ti ......

Oracle´óÈ«

Oracle Óû§¼°½ÇÉ« ½éÉÜ ÊÕ²Ø
Ò». Óû§¹ÜÀí
1.1 ½¨Á¢Óû§£¨Êý¾Ý¿âÑéÖ¤£©
     CREATE  USER   DAVE  IDENTIFIED  BY   pwd
     DEFAULT TABLESPACE  users
     TEMPORARY   TABLESPACE  temp ......

Oracle À俽±¸ÊµÀý¹Òµ½ÐÂORACLEʱӦעÒâÎÊÌâ¡£

À俽±¸ÁËÒ»¸öÔ­ÓÐÊý¾Ý¿â£¬Òª°ÑËûÒÆÖ²µ½ÐµÄÊý¾Ý¿âÖÐʱ£¬Òª×¢Òâһϣº
1.Oradim -new -sid [ʵÀýÃû:demo] -intpwd [PWD]  -pfile= [Òª´´½¨ÊµÀýµÄÅäÖÃÎļþ£º*.ora]
2.set Oracle_SID=[ʵÀýÃû]£¨×°Íêºó¼ÇµÃÒªÔÚ×¢²á±íÀï¼ÓÉÏ:HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_OraDb10g_home1£ºORACLE_SID£¬ÖµÎªÊµÀýÃû¡££©
3.sql ......

Oracle µÄrownum Ô­ÀíºÍʹÓà ¼°ÓërowidµÄÇø±ð

Oracle µÄrownum Ô­ÀíºÍʹÓÃ
ÔÚOracle ÖУ¬Òª°´Ìض¨Ìõ¼þ²éѯǰNÌõ¼Ç¼£¬Óøörownum ¾Í¸ã¶¨ÁË¡£
select * from emp where rownum <= 5
¶øÇÒÊéÉÏÒ²¸æ½ë£¬²»ÄܶÔrownum ÓÃ">"£¬ÕâÒ²¾ÍÒâζ×Å£¬Èç¹ûÄãÏëÓÃ
select * from emp where rownum > 5
ÔòÊÇʧ°ÜµÄ¡£ÒªÖªµÀΪʲô»áʧ°Ü£¬ÔòÐèÒªÁ˽ârownum ±³ºóµÄ»úÖÆ£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ