在oracle 中插入多行,顯然不可以用下面的方法:
insert into sys_defect (defect_id,defect_code,defect_level,defect_desc,update_userid,update_time,sys_defect.enabled,defect_type,code_level,parent_defect_id)values
('10001408','get3kk05','0','執行awb失敗','10017656',sysdate,'y','cm','0','0'),
('10001409','get3kk06','0','補償awb異常','10017656',sysdate,'y','cm','0','0'),
('10001410','get3kk07','0','bin檔異常','10017656',sysdate,'y','cm','0','0'),
('10001411','get3kk08','0','otp已燒錄','10017656',sysdate,'y','cm','0','0')
但可以借助union all實現如下:
insert into sys_defect (defect_id,defect_code,defect_level,defect_desc,update_userid,update_time,sys_defect.enabled,defect_type,code_level,parent_defect_id)select '10001408','get3kk05','0','執行awb失敗','10017656',sysdate,'y','cm','0','0' from dual union all
select '10001409','get3kk06','0','補償awb異常','10017656',sysdate,'y','cm','0','0' from dual union all
select '10001410','get3kk07','0','bin檔異常','10017656',sysdate,'y','cm','0','0' from dual union all
select '10001411','get3kk08','0','otp已燒錄','10017656',sysdate,'y','cm','0','0' from dual
oracle的多行插入
最近在學習oracle,用到了多行插入。多行插入有兩種形式。insert into nbass select from nbas 其中 nbas 是其中乙個表,nbass是另乙個表,將nbas中資訊查詢出來插入到nbass中。insert allinto nbas values 活塞 1990 in...
oracle的多行插入
oracle的多行插入和mysql的不大一樣,相對來說複雜一點 比如這裡有乙個顧客表 create table customers id int primary key,name varchar2 20 在這張表裡插入多行資料 insert all into customers values 1,j...
oracle儲存過程輸出多行記錄
今天oracle上機實驗。作業題目要求 顯示所有學生學號和姓名。type,rowtype都只能讀出一行記錄。但是游標可以讀多行。cursor select into v record from s declare cursor l c is select sno,sname from s begin...