Solved

How to fetch record 1 by 1 in a stored procedure ????

Posted on 2008-10-15
1
535 Views
Last Modified: 2012-05-05
Hi,
    I am using MYSQL to write a stored procedure.
    i have a table (UserTable ) which contains UserID and UserName fields.
    I have another table (ShortCutInfo) which contains UserID and ShortCutURL fields.

   I want to write a stored procedure (moreover a conversion script) which is intented to change
   update or insert record in ShortCutInfo table depending on the value of UserID present in UserTable.

   If a UserID of table UserTable exists in ShortCutInfo table then update ShortCutURL field with "URLUpdated"

  If a UserID doesnot exists in ShortCutInfo table then Insert a new record with UserID (same as in UserTable) and ShortCutID as "URLInserted".

 Can anyone suggest me how to read and do operation in an Stored procedure ???????
0
Comment
Question by:Paramhans
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 25

Accepted Solution

by:
Tomas Helgi Johannsson earned 500 total points
ID: 22728979
    Hi!

Take a look at the manual : http://dev.mysql.com/doc/refman/5.0/en/create-procedure.html  :)

Also take a look at this example on how to create multistatement procedure:
http://www.java2s.com/Tutorial/MySQL/0201__Procedure-Function/CreatingaMultistatementStoredProcedure.htm
This will give you an idea on how to solve your problem.

Regards,
   Tomas Helgi
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question