extension to dml in oracle

          1 over of multitable insert statements
          ?1)the insert...select statement can be userd to insert row into multiple table as part of a single dml statement.
          ?2) multitable insert statements can be used in data warehousing systems to transfer data from one or more operational sources to source to a set of target table.
          ?3) they providde significant performance improvement over
          ??? single dml versuls multiple insert...select statement
          ??? single dml versus a proceedduree to do mutiple inserts using if ,,, then syntax.
          2
          ? unconditional insert
          ? insert all
          ??? into sal_history values (EMPID,HIREDATE,SAL)
          ??? into mgr_history values (EMPID,MGR,SAL)
          ? select employee_id EMPID,hire_date JIREDATE,
          ???????? salary SAL,manager_id MGR
          ? from employees
          ? where employee_id>200;
          3 Conditional insert all
          ? insert all
          ?? when sal>1000 then
          ???? into sal_history values(empid,hiredate,sal)
          ?? when mgr>200 then
          ???? into mgr_history values(empid,mgr,sal)
          ?? select emp_id empid,hire_date hiredate,salary sal,manager_id mgr,
          ?? from employees
          ?? where employee_id>200;
          4 Conditional first insert
          ? insert first
          ??? when sal >25000? then
          ????? into special_sal values(deptid,sal)
          ??? when hiredate like ('%00%') then
          ????? into hiredate_history_00 values(deptid,hiredate)
          ??? when hiredate like ('%99%') then
          ????? insert hiredate_history_99 values(ddeptid,hiredate)
          ??? else
          ????? into hiredate_history values(deptid,hiredate)
          ??? select ddepartmeent_id deptid,sum(salary) sal,
          ???? max(hire_date) hiredate
          ??? from employees
          ??? group by department_id;
          5 Pivoting insert
          ?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,weekid,sales_mon,sales_tue,sales_wed,sales_thur,sales_fri
          ? from sales_source_data;
          6 create index with create table statement
          ? create table new_emp
          ? (employee_id number(6)
          ???????? primary key using index
          ???????? (create index emp_id_idx on new_emp(employee_id)),
          ?? first_name varchar2(20),
          ?? last_name varchar2(25)
          ? )

          posted on 2006-10-11 14:41 康文 閱讀(200) 評論(0)  編輯  收藏 所屬分類: 數據庫

          <2006年10月>
          24252627282930
          1234567
          891011121314
          15161718192021
          22232425262728
          2930311234

          導航

          統計

          常用鏈接

          留言簿(1)

          隨筆分類

          隨筆檔案

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 抚顺县| 浙江省| 郎溪县| 东乡族自治县| 昌吉市| 晋中市| 望都县| 千阳县| 加查县| 佛山市| 探索| 甘泉县| 吉安县| 平遥县| 曲靖市| 调兵山市| 永昌县| 贵港市| 右玉县| 中方县| 陇西县| 望奎县| 吉首市| 南木林县| 合肥市| 信宜市| 安化县| 大新县| 九寨沟县| 聂荣县| 鹤庆县| 开远市| 武陟县| 瑞金市| 博野县| 安龙县| 杭州市| 漾濞| 抚州市| 通州区| 济宁市|