Jump to content

how to use transactions


shaddf

Recommended Posts

Is this allowed in mysql transactions;Can i insert conditionally into different tablesĀ  by different

users to insert data :

i have tried this inside a stored procedure,but can someone correct me if it is good approach:

 START TRANSACTION;
    INSERT INTO minderstbl(m_date,m_notes )VALUES(in_date,in_remindernotes);
    SELECT Rm_id  INTO l_rem_id  FROM minderstbl where m_date=in_date and m_notes=in_remindernotes  limit 1;
         IF in_status = 1 THEN


   INSERT INTO i_ndertbl(id,Doc_id,frq_no,eq_text )VALUES(l_rem_id,in_doctitleid,in_freq_no,in_freq_text);
 
    ELSEIF in_status = 2 THEN
	INSERT INTO nderstbl(ct_id,em_id,eq_no,q_text )VALUES(in_compid,l_rem_id ,in_freq_no,in_freq_text);

    ELSEIF in_status = 3 THEN
	INSERT INTO rstbl(m_id,q_no,q_text )VALUES(l_rem_id ,in_freq_no,in_freq_text);

 
    END IF;
	if l_rem_id !='' then
	SELECT l_rem_id ;
       
	end if;
COMMIT;
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.