Create Variable In Oracle

别说谁变了你拦得住时间么 提交于 2020-01-03 18:35:27

问题


What is the Oracle equivalent of this MS SQL Server notation?

DECLARE @Variable INT
SET @Variable = 1

回答1:


In PL/SQL, you have a declare block:

declare
    x integer := 1;
    ...
begin
    ...
end;

If you are writing an SQL*Plus script, you use variable to declare a bind variable

variable x integer := 1;

It's also possible to define variables.




回答2:


In PL/SQL:

DECLARE
  a number;
BEGIN
  a := 1;
END;

You can paste this code in SQLPlus to run it.



来源:https://stackoverflow.com/questions/2708888/create-variable-in-oracle

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!