当前位置:网站首页>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
边栏推荐
- 爬虫实战(五):爬豆瓣top250
- Why does MySQL index fail? When do I use indexes?
- JPEG2000 matlab source code implementation
- 在最长的距离二叉树结点
- [in depth learning] pytorch 1.12 was released, officially supporting Apple M1 chip GPU acceleration and repairing many bugs
- Redistemplate common collection instructions opsforhash (IV)
- 【Redis设计与实现】第一部分 :Redis数据结构和对象 总结
- numpy 下载安装
- [MySQL] basic use of cursor
- 启动嵌入式间:资源有限的系统启动
猜你喜欢

Shake Sound poussera l'application indépendante de plantation d'herbe "louable", les octets ne peuvent pas oublier le petit livre rouge?

HMS core machine learning service creates a new "sound" state of simultaneous interpreting translation, and AI makes international exchanges smoother

Internet News: Geely officially acquired Meizu; Intensive insulin purchase was fully implemented in 31 provinces

It's not my boast. You haven't used this fairy idea plug-in!

Michael smashed the minority milk sign

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

互联网快讯:吉利正式收购魅族;胰岛素集采在31省全面落地

guava:Collections. The collection created by unmodifiablexxx is not immutable
![[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

50 commonly used numpy function explanations, parameters and usage examples
随机推荐
袁小林:安全不只是标准,更是沃尔沃不变的信仰和追求
【滑动窗口】第九届蓝桥杯省赛B组:日志统计
for循环中break与continue的区别——break-完全结束循环 & continue-终止本次循环
Michael smashed the minority milk sign
In JS, string and array are converted to each other (II) -- the method of converting array into string
Seven original sins of embedded development
Nodejs教程之Expressjs一篇文章快速入门
Vim 基本配置和经常使用的命令
jvm:大对象在老年代的分配
Tips for web development: skillfully use ThreadLocal to avoid layer by layer value transmission
14 years Bachelor degree, transferred to software testing, salary 13.5k
mysql根据两个字段去重
50 commonly used numpy function explanations, parameters and usage examples
js中,字符串和数组互转(二)——数组转为字符串的方法
JS operation DOM element (I) -- six ways to obtain DOM nodes
【Redis设计与实现】第一部分 :Redis数据结构和对象 总结
[go][转载]vscode配置完go跑个helloworld例子
numpy 下载安装
document.write()的用法-写入文本——修改样式、位置控制
Study notes of grain Mall - phase I: Project Introduction