在 Oracle 中创建变量
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2708888/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Create Variable In Oracle
提问by GigaPr
What is the Oracle equivalent of this MS SQL Server notation?
这个 MS SQL Server 表示法的 Oracle 等价物是什么?
DECLARE @Variable INT
SET @Variable = 1
回答by FrustratedWithFormsDesigner
In PL/SQL, you have a declare block:
在 PL/SQL 中,您有一个声明块:
declare
x integer := 1;
...
begin
...
end;
If you are writing an SQL*Plus script, you use variable
to declare a bind variable
如果您正在编写 SQL*Plus 脚本,则variable
用于声明绑定变量
variable x integer := 1;
It's also possible to definevariables.
也可以定义变量。
回答by Pablo Santa Cruz
In PL/SQL:
在 PL/SQL 中:
DECLARE
a number;
BEGIN
a := 1;
END;
You can paste this code in SQLPlus to run it.
您可以将此代码粘贴到 SQLPlus 中以运行它。