如何在執行另一個SQL語句之前檢查sql語句是否已執行。檢查sql語句是否已執行
我作出這樣
DECLARE tempId double default 2;
insert IGNORE into `system_users`(`user_id`,`username`,`password`) values (id , userName ,md5(password)) ;
set tempId= last_insert_id();
IF tempId <> 0 THEN
insert into `user_profile`(`user_id`, `full_name`, `cellphone`, `Date_time_ added`,`added_by`) values (id, fullName ,cellPhone , CURRENT_TIMESTAMP(),addedBy) ;
函數LAST_INSERT_ID(),因爲user_id是不是自動增量PK不與我的情況下工作,這是FOT用戶識別號碼。什麼是用來測試sql語句執行的函數。
你的DBMS是否允許你使用交易? – Filburt
嗯你是什麼意思交易? – palAlaa
我指的是[數據庫事務](http://en.wikipedia.org/wiki/Database_transaction)。 – Filburt