1Create PROCEDURE Usp_addboradcast
2(
3inchSubjects VARCHAR ( $),
4inchDetail text,
5 inchUseidint,
6inchIsdeleteint,
7inchConfirm INT,
8inchTime DateTime,
9inchAcceptuserid VARCHAR ( -),
TeninchIsread INT
One
A)
-BEGIN
-DECLARE CNTintdefault0;
theDECLARE Iintdefault0;
-DECLARE GrowthidintDEFAULT0;
-DECLARE T_error INTEGER DEFAULT0;
-DECLARE CONTINUE HANDLER for SQLEXCEPTION SET t_error=1;
+START TRANSACTION;
-
+INSERT into Wc_broadcast (ID, ' subject ', content,userid,isdelete,isconfirm,adddate) VALUES (Subjects,detail,useid, Isdelete,confirm,time);
ASelectLAST_INSERT_ID () into Growthid;
at/*total number of string cuts*/
- //& for Separators
-//Func_get_split_string_tota is a function
-SetCNT = Func_get_split_string_total (Acceptuserid,'&');
-While i<cnt
-Do
inInsert into Wc_broadcastinfo (id,broadcastid,userid,isread) VALUES (growthid,func_get_split_string (Acceptuserid,'&', i), isread);
-Seti = i +1;
toEnd while;
+
-IF T_error =0Then
theCommit
*ELSE
$ROLLBACK;
Panax NotoginsengEND IF;
-
theENDView Code1. Specific functions
View Code
View Code
2. Set the split string
View Code
MySQL database, involving things, looping add data