儲存過程開發的具體步驟

2021-06-10 19:43:47 字數 1158 閱讀 9346

一、編寫儲存過程

delimiter //           -- //代表分隔符

drop procedure ifexists proc_name; //

create procedureproc_oper_art

in i_is_auto integer,    --是否是自動建立標識   1:自動   0:手動

in i_art_id  integer,    -- 文章id

out o_is_succ integer     -- 是否操作成功 0:成功   1:失敗

begin

declare v_createtime   datetime;         -- 文章建立時間,這個是帶時分秒的

-- 異常捕獲

declareexit handler for sqlexception

begin

seto_is_succ = 1;

end;

--給年、月、日賦值

set v_year = date_format(curdate(), '%y');

select a.creatime,                              -- into給變數是這樣寫的

b.html_path,

a.is_recoving,

a.auto_create_cycle

into v_createtime,

v_path,

v_is_recoving,

v_cycle

from cms_article a,

cms_column b

where a.col_id = b.id

and a.id = i_art_id;

-- 拼接path

setv_rel_path = concat(v_path, '/', v_day, '/', i_art_id, '.html');     -- 字串拼接是用concat()

end;

二、測試儲存過程

call proc_name();

上例中儲存過程有in有out,呼叫時為

call proc_oper_art(1,2, @a);             -- out引數需要用@加變數

執行後可用select @a查詢返回的結果

vue開發環境的搭建具體步驟

相信很多人在剛開始學習vue這個框架的時候,在最開始搭建開發環境的時候,都會遇到一些大大小小的坑,我之前在學習angular的時候搭建過一次,過了乙個月後在搭建第二次的時候,竟然有一些混亂,所以今天想整理出來 vue現在在前端,相對於算是現在前端工程師都比較常用的框架之一,他和angular有一些相...

ssh整合具體步驟

struts2 spring hibernate是j2ee的最新流行框架。本篇是我搭建這個框架的經驗總結。本方案採用自底向上 hibernate spring struts2的方式進行整合。具體步驟如下 1.通過myeclipse嚮導,匯入實現hibernate3.2功能 生成會話工廠和hibern...

git操作的具體步驟

1.cd 路徑 進入當前目錄 2.配置git基本操作 注 沒有訊息就是好訊息 3.git init 在本地進行初始化 建立暫存區 git 檔案儲存當前專案的所有版本資訊 4.工作區 暫存區 git add 檔名 提交指定檔案 git add 提交所有檔案 git commit m 這一次提交的描述 ...