C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !






MYSQL Procedure with SQLTransactions and Exception Handling


Posted Date: 24 Sep 2008    Resource Type: Code Snippets    Category: SQL

Posted By: Yugi       Member Level: Gold
Rating:     Points: 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  
    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!
     
    Related Resources



    dotNet Slackers   BizTalk Adaptors    Web Design

    doors in nj

    Contact Us    Privacy Policy    Terms Of Use