Stored Procedure tutorial with example

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aadsaca
    New Member
    • Mar 2008
    • 17

    Stored Procedure tutorial with example

    Hello everyone!

    Please give me good examples of stored procedures in mysql5.

    or give me sites with good tutorial about stored procedures.


    tnx,
    arjel
  • mgpsivan
    New Member
    • Feb 2007
    • 13

    #2
    Originally posted by aadsaca
    Hello everyone!

    Please give me good examples of stored procedures in mysql5.

    or give me sites with good tutorial about stored procedures.


    tnx,
    arjel
    Hi arjel,
    This is how we shall use a Stored procedure in MySQL 5.0
    Example:[code=mysql]
    Delimiter $$
    DROP PROCEDURE IF EXISTS getAuthors $$
    CREATE PROCEDURE getAuthors ()
    BEGIN
    SELECT
    AuthorName,
    Address,
    City,
    Phone
    FROM Author
    END $$
    Delimiter ;[/code]
    The Delimiter should be specified else error will be thrown.Paramete r can be passed in the first line of the procedure as
    Create Procedure Procedurename(p aram1 datatype)
    The procedure can be executed as
    Call procedurename([parameters values])

    Regards
    Sivan.G

    Please enclose any code within the proper code tags. See the Posting Guidelines on how to do that.

    MODERATOR
    Last edited by ronverdonk; Mar 12 '08, 03:08 PM. Reason: code tags

    Comment

    • ronverdonk
      Recognized Expert Specialist
      • Jul 2006
      • 4259

      #3
      Originally posted by aadsaca
      Hello everyone!

      Please give me good examples of stored procedures in mysql5.
      or give me sites with good tutorial about stored procedures.

      tnx,
      arjel
      If you just had googled, like I did, you would have found numerous articles. Best one is (still) from MySQL development itself HERE with a downloadable document, and ALSO HERE and then DIY Approach to Stored Procedures in MySQL

      Ronald
      Last edited by ronverdonk; Mar 12 '08, 11:50 PM. Reason: another link added

      Comment

      • aadsaca
        New Member
        • Mar 2008
        • 17

        #4
        Thanks to all!

        i'll gonna browse those websites.

        tnx again,
        arjel

        Comment

        • aadsaca
          New Member
          • Mar 2008
          • 17

          #5
          to all,

          Where should i start?
          Do I need to set-up something in mysql5 ?

          tnx,
          arjel

          Comment

          • aadsaca
            New Member
            • Mar 2008
            • 17

            #6
            to all,

            in the tutorial(pdf file)
            it says:

            After you've installed the latest version, you should run
            either mysql_fix_privi lege_tables or mysql_install_d b -- or stored procedures won't work for you.


            sadly,
            i dont know where to run it....
            please help me.

            tnx,
            arjel

            Comment

            Working...