I'm simply trying to use a single row subquery function inside a NVL, DECODE function but it does not allow me to do so. Complianing invalid identifier.
I try using the same sub-query at different places but still I'm not able to access the variable as below. I dont wish to use a WITH clause for this case as dropped.
CREATE TABLE REQ_QUEUE(robbery_requirement_number NUMBER(6),
REQUIREMENT_NUMBER NUMBER(6));
INSERT INTO REQ_QUEUE(12345,ABC123);
INSERT INTO REQ_QUEUE(A1234D,236HJN);
I tried to use at the start of query and after the from keyword with no luck.
select (select req.robbery_requirement_number from requirements req
where req.requirement_number = woir.requirement_number ) rob_req,
-- --decode(rob_req, NULL, wo.aircraft_reg, '123RT') ac1,
NVL(rob_req, 'NONE') AC2,