Results 1 to 6 of 6

Thread: Stored procedure in MySQL database

  1. #1
    Join Date
    Jul 2009
    Posts
    140

    Stored procedure in MySQL database

    Greetings,

    I am using MySQL database and not so much familiar with this database because it is newly in my computer system.I don't go for institutions to learn this.I am hopefully depends on you all guys.Would you introduce me regrading the use of stored procedures for MySQL database.Your help would be appreciated .

    Thank you very much .

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Stored procedure in MySQL database

    The stored procedure are very useful objects in the database which can be used in the program to short your codes.It is a segment of database which is constructed using the SQL code and stored in the database catalog.The programmer can invoke it using a calling statement.

    There are some usefull actions are performed by the procedures like -

    1- It can increases the performance of application
    2- It helps to reduce the traffic between application and database server
    3-The Stored procedure keep secured in the database and managed by database administrator.

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: Stored procedure in MySQL database

    There are some defined procedures are stored in the database for specific activities but you can create another whenever you need to create.The procedures which would be created by the user called user defined procedure and one stored already in the database catalog called stored or system defined procedure.

    A stored procedure in the database that calls itself is known as recursive stored procedure.Almost the Relational Database Management System supports recursive stored procedure but MySQL is doesn't support this concept.Your can investigate the current version of your MySQL database before using recursive stored procedure.

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Writing the stored procedure

    This is the simple stored procedure introduced by me. It access the list of products from the products table.

    you need to take a look at the stored procedure code given below:

    Code:
     DELIMITER //
     CREATE PROCEDURE Get_Products()
       BEGIN
       SELECT *  FROM products;
       END //
     DELIMITER ;

  5. #5
    Join Date
    May 2008
    Posts
    2,297

    Declaring variables in stored priocedure

    Declaring variables in stored priocedure

    During the creation of stored procedures,you need some variables for input and output operation.you can create the variable within the code as follows-

    Code:
    DECLARE variable_name data-type(size) DEFAULT default_value;
    Just include it in your source code and pass the name of variables as an argument.After creating variables you can assign the values in the variables.The procedure to assign the value in the variable is shown below-

    Code:
    DECLARE st_varb INT DEFAULT 0
     SET st_varb = 20;
    The SET command is used to assign the value in variables.

  6. #6
    Join Date
    Oct 2005
    Posts
    2,393

    Calling the stored procedure

    Calling the stored procedure
    When,you done from the creation of procedure to put the desired functionality.It would be stored in the database catalog and if you need to call it then you have to create a program and the program will use the defined statement to call a particular procedure -

    The calling of the procedure can be preformed as follows-

    Code:
    CALL STORED_PROCEDURE_NAME()
    The CALL command is used to call any stored procedure in MySQL database.

Similar Threads

  1. Using stored procedures and stored functions in MySQL
    By Adiran in forum Software Development
    Replies: 6
    Last Post: 14-12-2010, 01:54 AM
  2. Use Of Stored Procedure in SQL Server
    By technika in forum Software Development
    Replies: 5
    Last Post: 30-01-2010, 11:24 AM
  3. What is sqlca Informix stored Procedure
    By Bosch in forum Software Development
    Replies: 3
    Last Post: 13-08-2009, 01:57 PM
  4. How to Write stored procedure in SQL Server
    By Benito in forum Software Development
    Replies: 3
    Last Post: 03-08-2009, 12:29 PM
  5. How to call stored procedure using do while Loop
    By AK_Chopra in forum Software Development
    Replies: 3
    Last Post: 29-05-2009, 01:47 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,229,683.22480 seconds with 17 queries