Some experiences on writing stored procedures

Source: Internet
Author: User
Next, I will introduce how to compile a database stored procedure. The essence of the stored procedure is to deploy a set of definition code and SQL statements on the database.

Next, I will introduce how to compile a database stored procedure. The essence of the stored procedure is to deploy a set of definition code and SQL statements on the database.

As Zhou Niu has a lot of JS knowledge, I will share with you the preliminary stages of writing the stored procedure in SQL.
In the database field, in the SQL, DB, and Oracle databases, it is a means to enhance or change the business functions by writing the storage process. The flexibility of the database is self-evident. The following describes how to write a stored procedure.
The essence of the database stored procedure is to deploy a set of definition code and SQL at the database end:
Let's take a look at our paging storage instance:
For example, the table car content is as follows:
Title price
001 BMW $30000
002 BENZ $31000

Example 1: query the stored procedure of car content
The Code is as follows:
Create proc baidu_car
As
Select * from car
Go
Exec baidu_car

Instance 2: Add a record to the car table
The Code is as follows:
Create proc insert_car
@ Param1 char (10), @ param2 varchar (20), @ param3 money
With encryption --------- encryption
As
Insert car (number, car name, price) Values (@ param1, @ param2, @ param3)
Go
Example:
Exec insert_car '008 ', 'lambogi', 100000
Go
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.