当前位置:网站首页>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
边栏推荐
- 爱可可AI前沿推介(7.6)
- C语言:#if、#def和#ifndef综合应用
- ACdreamoj1110(多重背包)
- JS according to the Chinese Alphabet (province) or according to the English alphabet - Za sort &az sort
- C language char, wchar_ t, char16_ t, char32_ Relationship between T and character set
- guava:创建immutableXxx对象的3种方式
- js中,字符串和数组互转(一)——字符串转为数组的方法
- npm run dev启动项目报错 document is not defined
- el-table表格——sortable排序 & 出现小数、%时排序错乱
- 对话阿里巴巴副总裁贾扬清:追求大模型,并不是一件坏事
猜你喜欢
guava:Collections.unmodifiableXXX创建的collection并不immutable
50 commonly used numpy function explanations, parameters and usage examples
对话阿里巴巴副总裁贾扬清:追求大模型,并不是一件坏事
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
Aike AI frontier promotion (7.6)
Common English vocabulary that every programmer must master (recommended Collection)
[MySQL] basic use of cursor
The biggest pain point of traffic management - the resource utilization rate cannot go up
[Li Kou brushing questions] one dimensional dynamic planning record (53 change exchanges, 300 longest increasing subsequence, 53 largest subarray and)
This year, Jianzhi Tencent
随机推荐
字符串的使用方法之startwith()-以XX开头、endsWith()-以XX结尾、trim()-删除两端空格
jvm:大对象在老年代的分配
Sdl2 source analysis 7: performance (sdl_renderpresent())
Guava: three ways to create immutablexxx objects
js通过数组内容来获取数组下标
对话阿里巴巴副总裁贾扬清:追求大模型,并不是一件坏事
Redistemplate common collection instructions opsforset (V)
2017 8th Blue Bridge Cup group a provincial tournament
Study notes of grain Mall - phase I: Project Introduction
Proxy and reverse proxy
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
Three schemes of SVM to realize multi classification
Aike AI frontier promotion (7.6)
愛可可AI前沿推介(7.6)
Is this the feeling of being spoiled by bytes?
The use method of string is startwith () - start with XX, endswith () - end with XX, trim () - delete spaces at both ends
Acdreamoj1110 (multiple backpacks)
Fastjson parses JSON strings (deserialized to list, map)
14年本科毕业,转行软件测试,薪资13.5K
启动嵌入式间:资源有限的系统启动