Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Whe cant use as a sub query variable ?

Mohammed SardarSep 26 2014 — edited Sep 26 2014

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,

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 24 2014
Added on Sep 26 2014
14 comments
4,542 views