I'm new to Oracle Database and I'm having some trouble with declaring variables and using that in other queries. For example, I want to create a variable called caseID with which store a number based on the select statement. Then I want to use that caseID in other queries I want to create. This is what I have:
DECLARE
caseID NUMBER;
BEGIN
SELECT case_id FROM cases WHERE user_id = 'test';
END;
SELECT * FROM version where case_id = :caseID
MINUS
SELECT * FROM version where version_type = 'A'
I'm not able to use the caseID in the version query, a popup comes for me to enter what caseID is.