MIS 325 Lecture Notes - Lecture 17: Stored Procedure, Sql, Data Type

39 views2 pages
Creating a procedure:
CREATE [OR REPLACE] PROCEDURE procedure_name
(
Parameter IN/OUT/IN OUT Data type,
Parameter IN/OUT/IN OUT Data type
)
AS/IS
Stored variable Data type;
PL/SQL block
CALL procedure(parameters): Executes a stored procedure
Parameters:
Used to pass a value to the stored procedure from a calling program
Can also be used to pass a value back from the stored procedure to the calling
program
Passing parameters by position:
Must code the parameters in the same order as they are coded in the
CREATE PROCEDURE statement
procedure(parameter, parameter);
Passing parameters by name:
Can list parameters in any order
procedure(parameter => value, parameter => value);
Types of parameters
Input Parameter:
Passed to the stored procedure from the calling program
Cannot change value of the parameter
Parameters are input parameters by default
IN keyword (optional)
Output Parameter:
Returned to the calling program from the stored procedure
Values must be set by the body of the stored procedure
Must code OUT keyword
Input/Output Parameter:
Stores an initial value that's passed in from the calling program
like an input parameter
Can also change the value and return it to a calling program like
an output parameter
Code IN OUT keywords
DROP PROCEDURE procedure_name: Drops a procedure
User-Defined Function (UDF, Stored Function, Function):
Similar to a stored procedure
Always returns a value or a table
Can’t make changes to the database by using INSERT, UPDATE, or DELETE
statements
Unlock document

This preview shows half of the first page of the document.
Unlock all 2 pages and 3 million more documents.

Already have an account? Log in

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents