Your SlideShare is downloading. ×
Stored procedures in_mysql
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Stored procedures in_mysql

310

Published on

Stored procedures in_mysql

Stored procedures in_mysql

Published in: Education, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
310
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
24
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Disclaimer: This presentation is prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra –Mentoring Partner Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
  • 2. Stored procedure Nabeel.C nabilmohad@gmail.com www.facebook/ nabilmohad twitter.com/shafikarassry in.linkedin.com/in/nabilmohad +919746477551
  • 3. STORED PROCEDURE • A stored procedure is an laready written sql statement that is saved in the database. we can run the stored procedure from the database’s enviornment. Stored procedures does not execute automatically.
  • 4. Pre compailed execution. Sql server compailes each stored procedure once and then reutilize the execution plan.
  • 5. Redused client/server traffic • Stored procedure reduced the traffic between application and database server because instead of sending multiple uncompiled long SQL commands statement, application only has to send the stored procedure name and get the result back. .
  • 6. Efficient reuse of code and programming abstraction. • stored procedure can be used by multiple users and client programs. If we utlize them in a planned manner, you will find the devlopment cycle take less time.
  • 7. Syntax:- • DELIMITER CREATE PROCEDURE procedure_name() BEGIN codes; END DELIMITER ; • In order to invoke a stored procedure we use the following SQL command: CALL STORED_PROCEDURE_NAME()
  • 8. • DELIMITER // CREATE PROCEDURE GetAllProducts() BEGIN SELECT * FROM products; END // DELIMITER ; • Call GetAllProducts();
  • 9. stored procedures with parameters • • Parameters make the stored procedure more flexible and useful. In MySQL, a parameter has one of three modes IN, OUT and INOUT.
  • 10. • IN this is the default mode. IN indicates that a parameter can be passed into stored procedures but any modification inside stored procedure does not change parameter. Suppose you pass parameter Id, which is equal 10, into stored procedure GetAll(Id), after executing the stored procedure the value of Id is still 10 even though the GetAll stored procedure can change the value of it.
  • 11. • OUT this mode indicates that stored procedure can change this parameter and pass back to the calling program. • INOUT obviously this mode is combined of IN and OUT mode; you can pass parameter into stored procedure and get it back with the new value from calling program.
  • 12. • DELIMITER // CREATE PROCEDURE GetOfficeByCountry(IN countryName VARCHAR(255)) BEGIN SELECT city, phone FROM offices WHERE country = countryName; END // DELIMITER ;
  • 13. Contact Us Emarald Mall (Big Bazar Building) Mavoor Road, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 NC Complex, Near Bus Stand Mukkam, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 Start up Village Eranakulam, Kerala, India. Email: info@baabtra.com

×