Select Scale in PL/SQL - Oracle SQL Developer

Asked

Viewed 231 times

0

I come from a background of T-SQL (MS SQL Server) and have things that do not work equally in PL/SQL.

I would like to know how to select scalars in PL/SQL.

Examples in MS SQL Server

Example 1:

SELECT 1 + 1

Example 2:

DECLARE @variavel INT = 1

SELECT @variavel

How I would make these examples work in PL/SQL on Oracle SQL Developer?

1 answer

1


For the cases of the above examples, I declare a variable using define, declare doesn’t work.

Also, to be able to work with the variable in a select I should add && in front of the variable name at the time of the query:

define  
    a integer :=30
    select 'x' from dual where &&a = 31;
    select 'x' from dual where &&a = 30;
    select &&a from dual;
    select 1 + 1 from dual;
    select &&a + &&a from dual;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.