当前位置:网站首页>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
边栏推荐
- document. Usage of write () - write text - modify style and position control
- Redistemplate common collection instructions opsforhash (IV)
- 互联网快讯:吉利正式收购魅族;胰岛素集采在31省全面落地
- Guava: use of multiset
- Tips for web development: skillfully use ThreadLocal to avoid layer by layer value transmission
- 【力扣刷题】32. 最长有效括号
- Yuan Xiaolin: safety is not only a standard, but also Volvo's unchanging belief and pursuit
- 抖音將推獨立種草App“可頌”,字節忘不掉小紅書?
- 跨分片方案 总结
- Sdl2 source analysis 7: performance (sdl_renderpresent())
猜你喜欢
KDD 2022 | realize unified conversational recommendation through knowledge enhanced prompt learning
Sequoia China, just raised $9billion
numpy 下载安装
Yuan Xiaolin: safety is not only a standard, but also Volvo's unchanging belief and pursuit
跨分片方案 总结
Five wars of Chinese Baijiu
Data Lake (VIII): Iceberg data storage format
Seven original sins of embedded development
Study notes of grain Mall - phase I: Project Introduction
2017 8th Blue Bridge Cup group a provincial tournament
随机推荐
Reflection operation exercise
OneNote in-depth evaluation: using resources, plug-ins, templates
语谱图怎么看
【Redis设计与实现】第一部分 :Redis数据结构和对象 总结
The difference between break and continue in the for loop -- break completely end the loop & continue terminate this loop
Nodejs tutorial expressjs article quick start
[go][reprint]vscode run a HelloWorld example after configuring go
Yuan Xiaolin: safety is not only a standard, but also Volvo's unchanging belief and pursuit
038. (2.7) less anxiety
js之遍历数组、字符串
Ravendb starts -- document metadata
[redis design and implementation] part I: summary of redis data structure and objects
Thinking about agile development
c语言char, wchar_t, char16_t, char32_t和字符集的关系
Vim 基本配置和经常使用的命令
C # use Oracle stored procedure to obtain result set instance
guava:Collections. The collection created by unmodifiablexxx is not immutable
Redistemplate common collection instructions opsforhash (IV)
抖音將推獨立種草App“可頌”,字節忘不掉小紅書?
Seven original sins of embedded development