abcprep.com - your onestop GMAT, GRE, PMP hub
.NET FAQs Unleashed!
 
    



    


What is a Stored Procedure in SQL? Write the syntax for a Stored Proc.

A Stored Procedure is a set of instructions saved for invoking repeated execution. A procedure may be used to handle a set of business logic to be performed. Say we want to insert a record in a table, this type of a scenario is repeatitive and hence a stored procedure may take care of this requirement. Further, the stored procedure may be passed parameters by the calling routine, and so it may be reusable. Below is the syntax to create a procedure:

Create or Replace Procedure [SCHEMA.]PROCEDURENAME
([Argument][in|out|in out])
[is|as]
begin
[Statements ....]
end;

Example:
Create or Replace Procedure usp_Insert_Employee
(fname varchar2(20) in, lname varchar2(20) in)
as
begin
Insert into t_Employee Values
(fname, lname);
end;

SQL Queries  SQL  Create Table  DDL, Create, Alter, Drop commands  DML, Select, Insert, Update, Delete  Create Database  ACID Rules  Dual Table  NULL  Join, Inner, Outer, Left, Right, Full, Cartesian, Natural, Equi  Table, View and a Synonym?  Execute  Function  Stored Procedure  Syntax Stored Proc  Stored Procedure Vs. Function








Know Your Breath, Know Your Life!!!