茫茫網海中的冷日
         
茫茫網海中的冷日
發生過的事,不可能遺忘,只是想不起來而已!
 恭喜您是本站第 1669449 位訪客!  登入  | 註冊
主選單

Google 自訂搜尋

Goole 廣告

隨機相片
20091011_00003.jpg

授權條款

使用者登入
使用者名稱:

密碼:


忘了密碼?

現在就註冊!

DB研討會 : [轉貼]Oracle 用 Select 方式 Insert Table 資料

發表者 討論內容
冷日
(冷日)
Webmaster
  • 註冊日: 2008/2/19
  • 來自:
  • 發表數: 15771
[轉貼]Oracle 用 Select 方式 Insert Table 資料
Oracle 用 Select 方式 Insert Table 資料
Oracle 用 Select 方式 Insert Table 資料, 用法有以下幾種 :

用法 1
insert into Table_Name
select col1
     , col2
     , ...
  from Source_Table;


用法 2
-- 兩個 Table 架構要相同
insert into Table_Name
select *
  from Source_Table;


用法 3
-- 若要 "使用 * 號, 且要外加其他欄位", 則 * 號前面要有 table alias name
insert into Table_Name
select table_alias.*
     , col1
     , col2
     , ...
  from Source_Table table_alias;


用法 4
-- 限定寫入的目的欄位有哪些
insert into Table_Name(
  column1
, column2
, ...
)
select col1
     , col2
     , ...
  from Source_Table;

原文出處:昭佑.天翔: Oracle 用 Select 方式 Insert Table 資料
冷日
(冷日)
Webmaster
  • 註冊日: 2008/2/19
  • 來自:
  • 發表數: 15771
[轉貼]Oracle select into 的用法
Oracle select into 的用法

select into .. from 可以塞到column變數或是row變數, 但是where條件只能抓出一筆, 不然會產生錯誤,dbms_output.put_line可以輸出到畫面,以下指令執行完點sql視窗"output"可以看到結果.
declare
T_aTable  aTable%rowtype; --row type
v_col1 aTable.col1%TYPE; --column type
begin
select col1
into v_col1
from aTable where v_col1 = 'XX' -- -塞到v_col1 這變數
;
select *
into T_aTable
from aTable where v_col1 = 'XX' --塞到T_aTable 這row
;
dbms_output.put_line(v_col1); --output v_col1
dbms_output.put_line(T_aTable); --output T_aTable
end;


原文出處:松露筆管麵: Oracle select into 的用法
前一個主題 | 下一個主題 | 頁首 | | |



Powered by XOOPS 2.0 © 2001-2008 The XOOPS Project|