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

Oracle Sql¼¼ÇÉ Upsert, Multitable Insert, Undrop

UpSert¹¦ÄÜ£º
MERGE <hint> INTO <table_name>
USING <table_view_or_query>
ON (<condition>)
WHEN MATCHED THEN <update_clause>
WHEN NOT MATCHED THEN <insert_clause>;
MultiTable Inserts¹¦ÄÜ£º
Multitable inserts allow a single INSERT INTO .. SELECT statement to conditionally, or non-conditionally, insert into multiple tables. This
statement reduces table scans and PL/SQL code necessary for performing multiple conditional inserts compared to previous versions. It's
main use is for the ETL process in data warehouses where it can be parallelized and/or convert non-relational data into a relational format:
-- Unconditional insert into ALL tables
INSERT ALL
INTO sal_history VALUES(empid,hiredate,sal)
INTO mgr_history VALUES(empid,mgr,sysdate)
SELECT employee_id EMPID, hire_date HIREDATE, salary SAL, manager_id MGR
from employees WHERE employee_id > 200;
-- Pivoting insert to split non-relational data
INSERT ALL
INTO Sales_info VALUES (employee_id,week_id,sales_MON)
INTO Sales_info VALUES (employee_id,week_id,sales_TUE)
INTO Sales_info VALUES (employee_id,week_id,sales_WED)
INTO Sales_info VALUES (employee_id,week_id,sales_THUR)
INTO Sales_info VALUES (employee_id,week_id, sales_FRI)
SELECT EMPLOYEE_ID, week_id, sales_MON, sales_TUE,
sales_WED, sales_THUR,sales_FRI
from Sales_source_data;
-- Conditionally insert into ALL tables
INSERT ALL
WHEN SAL>10000 THEN
INTO sal_history VALUES(EMPID,HIREDATE,SAL)
WHEN MGR>200 THEN
INTO mgr_history VALUES(EMPID,MGR,SYSDATE)
SELECT employee_id EMPID, hire_date HIREDATE, salary SAL, manager_id MGR
from employees WHERE employee_id > 200;
-- Insert into the FIRST table with a matching condition
INSERT FIRST
WHEN SAL > 25000THEN
INTO special_sal VALUES(DEPTID,SAL)
WHEN HIREDATE like ('%00%') THEN
INTO hiredate_history_00 VALUES(DEPTID,HIREDATE)
WHEN HIREDATE like ('%99%') THEN
INTO hiredate_history_99 VALUES(DEPTID,HIREDATE)
ELSE
INTO hiredate_hi


Ïà¹ØÎĵµ£º

OracleȡǰNλSQL

      Ò²Ðí¶ÔSQL ServerÀ´Ëµ,È¡Ç°NλµÄÊý¾ÝÊǺܼòµ¥µÄÊÂÇé,Ò»ÌõTOPÓï¾ä¾Í¸ã¶¨ÁË.
      ÔÚOracleÖÐÎÒÃÇÍùÍù»á¸Ð¾õµ½Í·ÌÛ,ƽÈÕÀïÒ²³£»áÓõ½,Ö÷ÒªÊÇʹÓÃpartition by.
Óï·¨ÈçÏÂ:
select emp_card_no,work_date,read_card_date,count(rownum) as cnt
from hra_read_car ......

OracleÊý¾Ýµ¼Èëµ¼³öimp/exp

¹¦ÄÜ£ºOracleÊý¾Ýµ¼Èëµ¼³öimp/exp¾ÍÏ൱ÓëoracleÊý¾Ý»¹Ô­Ó뱸·Ý¡£´ó¶àÇé¿ö¶¼¿ÉÒÔÓÃOracleÊý¾Ýµ¼Èëµ¼³öÍê³ÉÊý¾ÝµÄ±¸·ÝºÍ»¹Ô­£¨²»»áÔì³ÉÊý¾ÝµÄ¶ªÊ§£©¡£
¡¡¡¡OracleÓиöºÃ´¦£¬ËäÈ»ÄãµÄµçÄÔ²»ÊÇ·þÎñÆ÷£¬µ«ÊÇÄã×°ÁËoracle¿Í»§¶Ë£¬²¢½¨Á¢ÁËÁ¬½Ó £¨Í¨¹ýnet8 assistantÖб¾µØ——>·þÎñÃüÃû Ìí¼ÓÕýÈ·µÄ·þÎñÃüÃû
¡¡¡¡Æ ......

Oracle:PL/SQL ÖÐÈçºÎʹÓÃArray

http://tech.163.com/05/0701/10/1NIODMQS00091589.html
ÒòΪÔÚPL/SQL Öв¢Ã»ÓÐÊý×é.
ÕâÊÇż²é×ÊÁÏÕҵķ¶ÀýºÍ×Ô¼ºÐ´µÄ·¶ÀýÀ´½âÊÍÈçºÎÔÚPL/SQL ÖÐʹÓÃÊý×é. Ò²ÐíºÜ¶àÈËÒÑÖªµÀ, ²»¹ý¾ÍÊÇÈò»ÖªµÀµÄÅóÓÑÃÇÁ˽âһϰɡ£
----------------------
µ¥Î¬Êý×é
------------------------
DECLARE
TYPE
emp_ssn_array IS TA ......

SQL °æ±¾ºÍ²¹¶¡

I'm continually trying to track down what service packs are installed on various SQL Servers I support. I can never find the right support page on Microsoft's site. So here's an article with all the SQL Server version information I can track down. If you know of any older versions or can help me fil ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ