当前位置:网站首页>Sql: stored procedures and triggers - Notes
Sql: stored procedures and triggers - Notes
2022-07-06 21:34:00 【Nianchi ichthyology programming】
1. Conceptual classification of variables
Concept : A language element assigned a certain value .
classification : Global variables 、 local variable
| Global variables | Variables provided by the system and declared in advance , Generally, users can only view and cannot modify the value of global variables , In general, it is based on @@ The starting variable |
|---|---|
| local variable | An object declared by a user to hold a single data value of a specific type . It is local to a statement batch , In general, it is based on @ The starting variable |
2. Declaration and assignment of variables
Local variables must be declared before use , Basic statement of declaration :
declare @ local variable [as] data type [,......n]
Be careful : Use declare The initial value of the local variable declared by the statement is initialized to NULL.
Variable assignment statement format :
set @ Local variable name = value | expression
Be careful : Any expression can be SQL expression
You can also use select Statement to assign a value to a local variable , The format is :
select @ local variable = value | expression
Example : Declare three integer variables :@x、@y and @z, And give @x、@y Each variable is assigned an initial value , Then assign the sum value of these two variables to @z, And display variables @z Result .
declare @x int , @y int , @z int
set @x = 10
set @y = 20
set @z = @x + @y
print @z
print The function of is to return user-defined information to the client , Its grammatical form is :
print 'ascll Text string ' | @ Local variable name | String expressions | @@ Function name
边栏推荐
猜你喜欢

对话阿里巴巴副总裁贾扬清:追求大模型,并不是一件坏事

50个常用的Numpy函数解释,参数和使用示例
![[redis design and implementation] part I: summary of redis data structure and objects](/img/2e/b147aa1e23757519a5d049c88113fe.png)
[redis design and implementation] part I: summary of redis data structure and objects

2022菲尔兹奖揭晓!首位韩裔许埈珥上榜,四位80后得奖,乌克兰女数学家成史上唯二获奖女性

It's not my boast. You haven't used this fairy idea plug-in!
![[in depth learning] pytorch 1.12 was released, officially supporting Apple M1 chip GPU acceleration and repairing many bugs](/img/66/4d94ae24e99599891636013ed734c5.png)
[in depth learning] pytorch 1.12 was released, officially supporting Apple M1 chip GPU acceleration and repairing many bugs
![[MySQL] trigger](/img/b5/6df17eb254bbdb0aba422d08f13046.png)
[MySQL] trigger

Four common ways and performance comparison of ArrayList de duplication (jmh performance analysis)

【论文解读】用于白内障分级/分类的机器学习技术

Summary of cross partition scheme
随机推荐
ACdreamoj1110(多重背包)
El table table - sortable sorting & disordered sorting when decimal and% appear
2022 fields Award Announced! The first Korean Xu Long'er was on the list, and four post-80s women won the prize. Ukrainian female mathematicians became the only two women to win the prize in history
VIM basic configuration and frequently used commands
How do I remove duplicates from the list- How to remove duplicates from a list?
MySQL - transaction details
Replace Internet TV set-top box application through digital TV and broadband network
document. Usage of write () - write text - modify style and position control
Divide candy
Nodejs教程之Expressjs一篇文章快速入门
Vim 基本配置和经常使用的命令
JS according to the Chinese Alphabet (province) or according to the English alphabet - Za sort &az sort
js 根据汉字首字母排序(省份排序) 或 根据英文首字母排序——za排序 & az排序
Four common ways and performance comparison of ArrayList de duplication (jmh performance analysis)
After working for 5 years, this experience is left when you reach P7. You have helped your friends get 10 offers
The use method of string is startwith () - start with XX, endswith () - end with XX, trim () - delete spaces at both ends
分糖果
Redistemplate common collection instructions opsforlist (III)
guava:Collections. The collection created by unmodifiablexxx is not immutable
在最长的距离二叉树结点