Hi everybody,
I am doing some tests here and write some SQLs. I try to write some reusable code and therefore I want to declare some variables at the beginning and reuse them in the script, like this:
DEFINE stupidvar = 'stupidvarcontent';
SELECT stupiddata
FROM stupidtable
WHERE stupidcolumn = &stupidvar;
I tried so far:
Use a DECLARE section and insert the following SELECT statement in BEGIN
and END;
. Acces the variable using &stupidvar
.
Use the keyword DEFINE
and access the variable.
Using the keyword VARIABLE
and access the the variable.
I am getting all kinds of errors during my tries (Unbound variable, Syntax error, Expected SELECT INTO
...).
While searching the net I find a lot of different explanations, concerning SQL, PL/SQL, etc.
I am using SQLDeveloper to access an Oracle DB. How can I declare a variable and reuse it in the following statements?
Thank you in advance!