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
Copy codeThe 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
Copy codeThe 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