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!

PLS-00405: subquery not allowed in this context

goodluck247Jul 7 2017 — edited Sep 6 2017

Hello all,

Suppose I have the following data setup:

create table a (a1 number);

create table b (b1 number, b2 varchar2(100));

create table c (c1 number, c2 number);

insert into c values(1, null);

insert into c values(2, null);

insert into c values(3, 2);

insert into c values(4, 2);

insert into c values(5, 2);

insert into c values(6, 5);

create or replace trigger a_b_tgr

   after insert on a

   for each row

begin

    if :NEW.a1 in (select c1

                            from c

                            start with c1 = 2

                            connect by c2 = prior c1) then

        insert into b values(:NEW.a1, 'Some text.');

    end if;

end;

/

So, when I try to create this trigger, it gives me the 'PLS-00405: subquery not allowed in this context' error... Why?..

And how should I go about it? The idea of hardcoding 2,3,4,5,6 in the trigger doesn't seem to be a good one...

Thank you.

This post has been answered by Frank Kulash on Jul 7 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 4 2017
Added on Jul 7 2017
5 comments
6,015 views