Local variables in stored procedure: In stored procedures local variables are declared in DECLARE section.
create procedure chk_tot (c_num in integer)
/* Other SQL statements */
Statement block: A statement block in a stored procedure is a group of SQL statements which behave as a single statement.
/* Statement block */
/* Declare local variables */
/* Sequence of statements */
/* Exceptions */
Stored function: Along with stored procedures, stored functions are used in stored procedure language. The difference between them is that a stored function returns a value. However, a stored procedure does not return a value. CREATE FUNCTION statement is used to create a stored function.
create function total_sale(empl_num in integer)
declare t_sale number(30,2);
select sum(sales) into t_sale from employees where empl = empl_num;