C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » SQL »

MYSQL Procedure with SQLTransactions and Exception Handling


Posted Date: 24 Sep 2008    Resource Type: Code Snippets    Category: SQL
Author: YugiMember Level: Gold    
Rating: 1 out of 5Points: 10



This code shows how to use SQLTransaction in MYSQL Database

DELIMITER $$

DROP PROCEDURE IF EXISTS `Sp_UserProfile` $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `Userdata`(Fname varchar(50),LName varchar(45),Collg varchar(30),course varchar(30))

BEGIN

declare uaccid int;
declare memid int;
declare cnt1 int default 0;
declare cnt2 int default 0;

DECLARE EXIT HANDLER FOR SQLEXCEPTION rollback;
declare exit handler for not found rollback;
declare exit handler for sqlwarning rollback;

START TRANSACTION;

insert into personal_profile (FirstName,LastName ) values (Fname,LName);

select membe_id into memid from users order by memberPF_id desc limit 1;

insert into profile(Member_ID,College,course) values(memid,Collg, course);


COMMIT;

END $$

DELIMITER ;


Attachments

  • MySql stored procedure with sqltransations and exception handling (21458-24107-proc with trans and exception.txt)


  • Responses


    No responses found. Be the first to respond and make money from revenue sharing program.

    Feedbacks      
    Popular Tags   What are tags ?   Search Tags  
    Sign In to add tags.
    SQLTransaction  .  MySql  .  

    Post Feedback


    This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
    You must Sign In to post a response.
    Next Resource: Script to Run DataBase Daily to update reacords and send mail to admin about updated Recoreds
    Previous Resource: Implementation of Cursor in SQL Server
    Return to Discussion Resource Index
    Post New Resource
    Category: SQL


    Post resources and earn money!
     
    More Resources



    dotNet Slackers

    About Us    Contact Us    Privacy Policy    Terms Of Use