MySQL Stored Procedure Variable Example

MySQL Stored Procedure Variable Example

Open your MySQL Query Editor then copy & paste the below code to make a Stored Procedure which will hold some variables in MySQL:

DELIMITER |

CREATE PROCEDURE SP_VARIABLE_EXAMPLE ()
BEGIN
DECLARE LastName VARCHAR(255)  DEFAULT 'Noor.Hasan';
DECLARE WorkExperience INT  DEFAULT 7;

SELECT LastName, WorkExperience ;

END;
|

MySQL Stored Procedure Variable Example - MySQL Query Editor Output

Again open your MySQL Query Editor then copy & paste the below code to execute the Stored Procedure & get some interesting result:

   call SP_VARIABLE_EXAMPLE;

MySQL Stored Procedure Example - Executing Stored Procedure - MySQL Query Editor Output

 

Related Tutorial Examples

  1. MySQL Stored Procedure: Batch Salary Increment Example
  2. MSSQL PRINT Like Function in MySQL Example
  3. How to Find MySQL Stored Procedure or Function Information
  4. How To Find MySQL SERVER VERSION Information
  5. MySQL Stored Procedure: INSERT INTO SELECT... Example
  6. MySQL sample database script: Create Database using SQL Statement Example
  7. MySQL Sub-Query: INSERT INTO SELECT... Example
  8. MySQL NULL value Example using PHP
  9. 20 steps to make CakePHP Blog Project
  10. PERL Example: Hellow world! program in PERL

No comments:

Post a Comment

leave your comments here..