易截截图软件、单文件、免安装、纯绿色、仅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


相关文档:

Redhat Linux oracle 10g em 按钮乱码解决

网上有很多的资料,参考itput(http://space.itpub.net/471666/viewspace-215923)的。
OS : Redhat
DB : Oracle 10.2.0.4.0
1.修改jdk 下面的字体。
[oracle@a ~]$ cd $ORACLE_HOME/jdk/jre/lib/
[oracle@a ~]]$ mv font.properties font.properties_bak
[oracle@a ~]]$
[oracle@a ~]]$ cp font.properties.zh_CN.R ......

再谈 Sql 两行变一行 实例

要求: 按 lct1, lct2  排序后的前两条纪录,显示为下列结果:
item_cd1   item_cd2            lct
01             a         ......

sql分頁

应一个朋友的要求,贴上收藏的SQL常用分页的办法~~
表中主键必须为标识列,[ID] int IDENTITY (1,1)
1.分页方案一:(利用Not In和SELECT TOP分页)
语句形式: 
SELECT TOP 页记录数量 *
from 表名
WHERE (ID NOT IN
  (SELECT TOP (每页行数*(页数-1)) ID
  from 表名
  ORDER BY ......

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 面试题一

1.用一条Sql语句查询出每门功课都大于80分的学生姓名 
Name
Class
Result
张三
语文
56
张三
数学
88
李四
语文
92
李四
数学
100
王五
语文
88
王五
数学
99
王五
英语
99
-------------------------------------------------------------------------------
答案:
SELECT DISTINCT nam ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号