Preview

Hime

Good Essays
Open Document
Open Document
1241 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Hime
A stored procedure is a group of Transact-SQL statements compiled into a single execution plan. stored procedures return data in four ways: • Output parameters, which can return either data (such as an integer or character value) or a cursor variable (cursors are result sets that can be retrieved one row at a time).

• Return codes, which are always an integer value.

• A result set for each SELECT statement contained in the stored procedure or any other stored procedures called by the stored procedure.

• A global cursor that can be referenced outside the stored procedure.
Stored procedures assist in achieving a consistent implementation of logic across applications. The SQL statements and logic needed to perform a commonly performed task can be designed, coded, and tested once in a stored procedure. Each application needing to perform that task can then simply execute the stored procedure. Coding business logic into a single stored procedure also offers a single point of control for ensuring that business rules are correctly enforced.
Stored procedures can also improve performance. Many tasks are implemented as a series of SQL statements. Conditional logic applied to the results of the first SQL statements determines which subsequent SQL statements are executed. If these SQL statements and conditional logic are written into a stored procedure, they become part of a single execution plan on the server. The results do not have to be returned to the client to have the conditional logic applied; all of the work is done on the server. The IF statement in this example shows embedding conditional logic in a procedure to keep from sending a result set to the application:
IF (@QuantityOrdered < (SELECT QuantityOnHand FROM Inventory WHERE PartID = @PartOrdered) ) BEGIN -- SQL statements to update tables and process order. END
ELSE
BEGIN -- SELECT statement to retrieve the IDs of alternate

You May Also Find These Documents Helpful

  • Good Essays

    The SELECT statement is the primary means of extracting data from database tables, and allows you to determine exactly which data you want to extract by means of different comparison operators used in the WHERE clause. This includes the use of specific "wild card" characters which allow you to search for character or number patterns within the data. You can also perform mathematical expressions within the SELECT statement to create derived output. The ORDER BY clause allows you to sort the output data in either ascending (the default) or descending order. Lab #5 will explore all of these applications of the SELECT statement.…

    • 1559 Words
    • 7 Pages
    Good Essays
  • Good Essays

    Nt1310 Unit 1 Quiz

    • 1980 Words
    • 8 Pages

    6 . For an unconditional approach to a particular part of a complex PL/SQL block, which of the following control structures can be used?…

    • 1980 Words
    • 8 Pages
    Good Essays
  • Good Essays

    SEQUEL or SQL is a data language that provides benefits for all types of users. SQL’s purpose is to provide an interface to a relational database such as Oracle Database. Dr. Edgar Frank “Ted” Codd introduced the first commercially available implementation of SQL. Today, SQL is accepted as the standard RDBMS language. The features of SQL include processing sets of data as groups rather than as individual units and providing automatic navigation to the data. It uses statements that are complex and powerful individually, and that therefore stand alone. Flow-control statements were not part of SQL originally, but they are found in the recently accepted optional part of SQL. Flow-control statements are commonly known as "persistent stored modules" (PSM), and the PL/SQL extension to Oracle SQL is similar to PSM.…

    • 452 Words
    • 2 Pages
    Good Essays
  • Good Essays

    CMGT 400 Week 1 DQs

    • 676 Words
    • 3 Pages

    The project for CIS336 is designed to touch all aspects of the fundamental concepts of database design and logical data modeling covered during the class. The project is team centered and each team will be responsible for designing, developing, and demonstrating the functionality of a database created based on a defined set of business specifications. At the end of the session, each project team will submit the database designed by the team and demonstrate the database's ability to deliver the required information as outlined in the project specifications. All aspects of the project will be ...…

    • 676 Words
    • 3 Pages
    Good Essays
  • Powerful Essays

    Nt1310 Unit 1

    • 4209 Words
    • 17 Pages

    It parses and also executes the statement Displays the execution plan for the select statement automatically…

    • 4209 Words
    • 17 Pages
    Powerful Essays
  • Satisfactory Essays

    Unit 6 True

    • 287 Words
    • 1 Page

    The * in SELECT * clause of an SQL statement is a wildcard for returning all columns in a table. TRUE…

    • 287 Words
    • 1 Page
    Satisfactory Essays
  • Satisfactory Essays

    unit 6

    • 360 Words
    • 2 Pages

    6) The * in SELECT * clause of an SQL statement is a wildcard for returning all columns in a table.…

    • 360 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    List the relational operators and logical operators that can be used to form a validation rule.…

    • 636 Words
    • 3 Pages
    Good Essays
  • Good Essays

    Is411 Study Guide

    • 2595 Words
    • 11 Pages

    Procedure – a written statement describing the steps required to implement a process. Procedures are technical steps taken to achieve policy goals (how-to document)…

    • 2595 Words
    • 11 Pages
    Good Essays
  • Good Essays

    SQL Henry Books Chapter 7

    • 912 Words
    • 6 Pages

    b. Write an execute the command using the PLUME view to retrieve the book code, title, and price for every book with a price of less than $13.…

    • 912 Words
    • 6 Pages
    Good Essays
  • Good Essays

    Dbm 381 Week 1paper

    • 885 Words
    • 4 Pages

    A database consists of one or more tables; each containing data stored as individual records. Different database architectures determine how the tables and records are organized or related…

    • 885 Words
    • 4 Pages
    Good Essays
  • Good Essays

    A procedure is a document written to support a policy principle or rule. A Procedure is designed to establish corporate accountability for implementation of a policy by describing the set of actions that have to be executed and by whom within an organization in relation to it.…

    • 1050 Words
    • 5 Pages
    Good Essays
  • Good Essays

    Cis 111

    • 790 Words
    • 4 Pages

    “The benefits of using the relational model would result in an easy to use, flexible, high performance database at a low cost.” (Anita, 2010) Therefore, allowing them to participate in the entire design process of the logical construction. The relational model provides an easy and flexible way of manipulating data with a system that offers:…

    • 790 Words
    • 4 Pages
    Good Essays
  • Good Essays

    IS4560

    • 486 Words
    • 2 Pages

    methods, including character scrambling and masking, numeric variance and nulling, rely on an array of built-in SQL Server system functions that are used for string manipulation.…

    • 486 Words
    • 2 Pages
    Good Essays
  • Satisfactory Essays

    Relational Database Paper

    • 547 Words
    • 3 Pages

    The purpose of a query is to retrieve information from a table or tables, which can be based on some type of criteria. To put it simply, a query is designed to get you an answer from data already stored in the database.…

    • 547 Words
    • 3 Pages
    Satisfactory Essays