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!

ora-02251: subquery not allowed here

RPuttaguntaMay 31 2007 — edited May 31 2007

Hi folks,

I have this situation.

SQL> ed
Wrote file afiedt.buf

  1* create table x (id varchar2(10))
SQL> /

Table created.

SQL> ED
Wrote file afiedt.buf

  1* create table y(name varchar2(10))
SQL> /

Table created.

SQL> insert into x values ('texas');

1 row created.

SQL> commit;

Commit complete.

SQL> alter table y add constraint rahul_check check(name in (select id from x));
alter table y add constraint rahul_check check(name in (select id from x))
                                                        *
ERROR at line 1:
ORA-02251: subquery not allowed here

I heard this can ONLY be implemented using a trigger, but, is there a way to do this using a 'check constraint'?

Thank you,
Rahul.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 28 2007
Added on May 31 2007
3 comments
995 views