iImax 发表于 2012-10-24 23:21:05

Oracle Sql技巧

近期参加OCP培训,讲师说的太快,之前一直是SQLSERVER,很多东西要恶补了。
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 ALLINTO sal_history VALUES(empid,hiredate,sal)INTO mgr_history VALUES(empid,mgr,sysdate) SELECT employee_id EMPID, hire_date HIREDATE, salary SAL, manager_id MGRFROM employees WHERE employee_id > 200;
页: [1]
查看完整版本: Oracle Sql技巧