Oracle和Mssql儲存過程區別

2022-02-12 04:07:40 字數 2244 閱讀 7592

儲存過程

一. 多表連線查詢,更新儲存過程 

sql儲存過程 

alter procedure [dbo].[ getevent] 

@scswid nvarchar(20)= null , 

@todate datetime, 

@fromdate datetime 

as select notes.note_id, 

notes.note, 

scsw_calendar.date_time 

from scsw_calendar 

left outer join notes on scsw_calendar.note_id=notes.note_id 

where scsw_calendar.scsw_id = scswid 

order by patient.patientid 

oracel儲存過程 

1.查詢資料的儲存過程 

procedure getevent(scswid in varchar2, fromdate in date, todate in date, refout out

refcursor

) is 

begin 

open refout for 

select notes.note_id, 

notes.note, 

scsw_calendar.date_time 

from scsw_calendar 

left join notes on scsw_calendar.note_id=notes.note_id 

where scsw_calendar.scsw_id = scswid 

and scsw_calendar.date_time >= fromdate 

and scsw_calendar.date_time < todate 

order by scsw_calendar.date_time; 

end getevent; 

2.更新資料的儲存過程: 

procedure updatearticlesubmodel 

( articlesubid number, 

articletitle nvarchar2, 

articlekeyword nvarchar2, 

articlecontent clob, 

createperson nvarchar2, 

changedate date, 

settop number, 

articlesubstyleid number, 

checked number 

) as 

begin 

update "articlesubmodel" 

set "articletitle"=articletitle, 

"articlekeyword"=articlekeyword, 

"articlecontent"=articlecontent, 

"createperson"=createperson, 

"createdate"=changedate, 

"settop"=settop, 

"articlesubstyleid"=articlesubstyleid, 

"checked"=checked 

where "articlesubid"=articlesubid; 

commit; 

exception when others then 

rollback; 

end updatearticlesubmodel; 

3.刪除資料的儲存過程 

procedure deletearticlesubmodel 

( articlesubid number 

) as 

begin 

delete from "articlesubaccessories" 

where "articlesubid"=articlesubid; 

delete from "articlesubmodel" 

where "articlesubid"=articlesubid; 

commit; 

exception when others then 

rollback; 

end deletearticlesubmodel;

Oracle執行引數化SQL語句和儲存過程

using system using system.collections.generic using system.text using system.data.oracleclient using system.data namespace oracleopdemo private static...

MSSQL儲存過程

sqlserver 帶有返回值,儲存過程同時新增兩張表,並將第一張表的主鍵插入第二張表當中 2010 07 04 22 00 55 分類 sql 字型大小 訂閱 sql server 中,可以使用 scope identity identity ident current 來取得最後插入記錄的值值,...

shell指令碼批量排程Oracle儲存過程

本程式批量排程oracle儲存過程,支援定時排程任務,處理儲存過程排程過程中的依賴關係。1.run prc.sh bin bash author zhangbingkai 2018.10.14 v prc call 1 v date 2 shell dir 3 v oracle home cat s...