定義預處理 類似sqlserver的存儲過程 語法 歡迎轉載 ,轉載時請保留作者信息。本文版權歸本人所有,如有任何問題,請與我聯繫[email protected] 。 過錯
定義預處理 類似sqlserver的存儲過程
語法
PREPARE stmt_name FROM preparable_stmt
說明
PREPARE 關鍵字
stmt_name 預處理語句的名字 昵稱;)
FROM 關鍵字
preparable_stmt 要預處理的語句
如
PREPARE stmt FROM 'SELECT * FROM game WHERE host_year = ?';
執行預處理
語法
EXECUTE stmt_name [USING value [, value] …]
說明 execute 關鍵字
stmt_name 預處理名字
using 關鍵字
value 參數值
如
EXECUTE stmt USING 2004;
歡迎轉載 ,轉載時請保留作者信息。本文版權歸本人所有,如有任何問題,請與我聯繫[email protected] 。 過錯
執行結果
csql> PREPARE stmt FROM 'SELECT * FROM game WHERE host_year = ?'; Current transaction has been committed. 1 command(s) successfully processed. csql> EXECUTE stmt USING 2004; === <Result of SELECT Command in Line 1> === host_year event_code athlete_code stadium_code nation_code medal game_date ======================================================================== 2004 20000 14544 30135 'AUS' 'B' 08/19/2004 ..... 884 rows selected. Current transaction has been committed. 1 command(s) successfully processed. csql>