Oracle和SQL Server儲存過程的不同

2021-04-19 23:30:40 字數 2628 閱讀 2539

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

sql儲存過程

alter

procedure

[dbo].

[getevent

]@scswid

nvarchar(20

)=null

,@todate

datetime

,@fromdate

datetime

asselect

notes.note_id,

notes.note,

scsw_calendar.date_time   

from

scsw_calendar

left

outer

join

notes

onscsw_calendar.note_id

=notes.note_id

where

scsw_calendar.scsw_id

=scswid

order

bypatient.patientid

oracel儲存過程

1.查詢資料的儲存過程

procedure

getevent(scswid

invarchar2

, fromdate

indate, todate

indate, refout out refcursor)

isbegin

open

refout

forselect

notes.note_id,

notes.note,

scsw_calendar.date_time

from

scsw_calendar

left

join

notes

onscsw_calendar.note_id

=notes.note_id

where

scsw_calendar.scsw_id

=scswid

andscsw_calendar.date_time

>=

fromdate

andscsw_calendar.date_time

<

todate

order

byscsw_calendar.date_time;

endgetevent;

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;

sql serve儲存過程

儲存過程 一.概念 預先編譯好的sql程式,可以包含 運算元據 變數 控制語句,增刪改查操作都可以,儲存過程是儲存在資料庫中 的乙個物件。二.好處 1.安全性更高 2.減少了網路流量 3.提高速度,效能更高 4.模組化程式設計 三 分類 1.系統儲存過程 由資料庫建立的,sp 開頭,常用的系統儲存過...

SQLServe錯誤整理

1.sql拒絕訪問?提示sql serve不存在或訪問被拒絕 sql server does not exist or access denied.a 1 你如果是獨立上網的請把21埠開啟.區域網把1433埠開啟就可以了.2 關閉防火牆 b 把資料庫連線的 sqllocalname local 的 ...

關於ACCESS資料轉為SQL SERVER資料表

1.關於配置 啟用ad hoc distributed queries exec sp configure show advanced options 1 reconfigure exec sp configure ad hoc distributed queries 1 reconfigure 使...