Replace all & parameters of a query in Sqldeveloper

Asked

Viewed 1,114 times

1

I have a query that uses several times the same parameter, in Sqldeveloper, calls Substitution Variable (VS), for example, &empresa.

If I use this VS with the query below:

SELECT
    *
FROM
    pedido
WHERE empresa   = &empresa;

The Sqldeveloper before executing the query, asks what the value of the VA, then inform and it performs the query.

Problem:
If I create a more complex query, using the same VA more than once, Sqldeveloper asks for the VA value every time. I wonder if there is a way to ask only once.

P.S.: I don’t want to use another variable to store the value of the VA and then use the variable in several places.

1 answer

1


Using the syntax &variavel, the value assigned to it is temporary, ie will only be used in the current SQL clause.

If you use syntax &&variavel, the value assigned is permanent, that is, the same variable can be used in several SQL clauses.

To documentation can help you.

  • 1

    Interesting, I am migrating from PLSQL to Sqldeveloper, and tested here in PLSQL does not work the &&, only the &, that has the same functionality. Thank you

  • 1

    I did the exact same test here, and I realized the same thing.

Browser other questions tagged

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