Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8924995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:34:35+00:00 2026-06-15T07:34:35+00:00

I have a procedure which does two things 1) selects a field from the

  • 0

I have a procedure which does two things

1) selects a field from the table1 get the value of a desired column
updates it by one and

2) updates the new incremented value back into that table.

Now when two users calling the procedure at same time then they both get the same value.

For e.g

if the value present in DB is 100
and two users call the procedure then ideally they should get 101 and 102.

but some time they are getting 101 for both.

Please help me in rectifying this error.
The procedure is :

DELIMITER $$

BEGIN
declare trc_id INT;

 SELECT  distinct column1 into trc_id FROM table1 where column2=match_name and     status='A';

set abc=trc_id+1;

update table1 set column1=str_id where column2=match_name  and column1=trc_id;

END $$

DELIMITER ;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T07:34:37+00:00Added an answer on June 15, 2026 at 7:34 am

    Use Synchronized Method to your procedure.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a stored procedure (SQL Server) which does nothing more than updates a
I have a stored procedure which basically does something like select top 1 expiryDate,
I have a stored procedure which does sorting pnd Paging like the Sorting Custom
We have a stored procedure in which there are two parts. In part 1,
Does anyone have an example of a stored procedure which makes a connection to
I have a procedure which performs some task, but performs it in two slightly
Have you encountered this exception for a stored procedure which does indeed have a
I have Oracle procedure which does the same work as following: create or replace
Have a procedure which looks like Procedure TestProc(TVar1, TVar2 : variant); Begin TVar1 :=
I have a procedure which uses 2 sql databases - this is required in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.