当前位置:网站首页>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
边栏推荐
- El table table - get the row and column you click & the sort of El table and sort change, El table column and sort method & clear sort clearsort
- Replace Internet TV set-top box application through digital TV and broadband network
- JS according to the Chinese Alphabet (province) or according to the English alphabet - Za sort &az sort
- Four common ways and performance comparison of ArrayList de duplication (jmh performance analysis)
- WEB功能测试说明
- 50个常用的Numpy函数解释,参数和使用示例
- 038. (2.7) less anxiety
- numpy 下载安装
- Divide candy
- Common English vocabulary that every programmer must master (recommended Collection)
猜你喜欢
Study notes of grain Mall - phase I: Project Introduction
【力扣刷题】一维动态规划记录(53零钱兑换、300最长递增子序列、53最大子数组和)
Tiktok will push the independent grass planting app "praiseworthy". Can't bytes forget the little red book?
嵌入式开发的7大原罪
【深度学习】PyTorch 1.12发布,正式支持苹果M1芯片GPU加速,修复众多Bug
The biggest pain point of traffic management - the resource utilization rate cannot go up
Is this the feeling of being spoiled by bytes?
966 minimum path sum
967- letter combination of telephone number
【Redis设计与实现】第一部分 :Redis数据结构和对象 总结
随机推荐
Internet News: Geely officially acquired Meizu; Intensive insulin purchase was fully implemented in 31 provinces
ICML 2022 | flowformer: task generic linear complexity transformer
Sequoia China, just raised $9billion
Ravendb starts -- document metadata
Four common ways and performance comparison of ArrayList de duplication (jmh performance analysis)
14年本科毕业,转行软件测试,薪资13.5K
FZU 1686 龙之谜 重复覆盖
C language char, wchar_ t, char16_ t, char32_ Relationship between T and character set
js通过数组内容来获取数组下标
@GetMapping、@PostMapping 和 @RequestMapping详细区别附实战代码(全)
爱可可AI前沿推介(7.6)
MLP (multilayer perceptron neural network) is a multilayer fully connected neural network model.
Shake Sound poussera l'application indépendante de plantation d'herbe "louable", les octets ne peuvent pas oublier le petit livre rouge?
[MySQL] basic use of cursor
First batch selected! Tencent security tianyufeng control has obtained the business security capability certification of the ICT Institute
Redistemplate common collection instructions opsforset (V)
Why does MySQL index fail? When do I use indexes?
Binary tree node at the longest distance
字符串的使用方法之startwith()-以XX开头、endsWith()-以XX结尾、trim()-删除两端空格
袁小林:安全不只是标准,更是沃尔沃不变的信仰和追求