1

Topic: Field with certain variants of filling

Good afternoon
Dear experts, tell please how to make so, what the field would be filled only with certain values?
For example the table

my_tab (id number, sel varchar2 (10))

Also it would be necessary that in the field sel values of type ' allow ', ' deny ', ' error ' could get only
How it can be organized?

2

Re: Field with certain variants of filling

igor_alex;
Check constraint or foreign key on the reference manual.

3

Re: Field with certain variants of filling

igor_alex;

SQL> create table my_tab (id number, sel varchar2 (10) check (sel in (' allow ', ' deny ', ' error ')))
2 /
Table created.
SQL> insert into my_tab (sel) values (' deny ');
1 row created.
SQL> insert into my_tab (sel) values (' igor_alex ');
insert into my_tab (sel) values (' igor_alex ')
*
ERROR at line 1:
ORA-02290: check constraint (sss. SYS_C001553903) violated

.....
stax

4

Re: Field with certain variants of filling

Stax wrote:

igor_alex;

SQL> create table my_tab (id number, sel varchar2 (10) check (sel in (' allow ', ' deny ', ' error ')))
2 /
Table created.
SQL> insert into my_tab (sel) values (' deny ');
1 row created.
SQL> insert into my_tab (sel) values (' igor_alex ');
insert into my_tab (sel) values (' igor_alex ')
*
ERROR at line 1:
ORA-02290: check constraint (sss. SYS_C001553903) violated

.....
stax

Restriction of check of a column cannot refer to other columns

5

Re: Field with certain variants of filling

Whether

igor_alex wrote:

Restriction of check of a column can refer to other columns

Yes from a horse-radish it?

SQL> create table my_spisok (sel varchar2 (10));
Table created
SQL> alter table my_spisok add constraint qwe primary key (sel);
Table altered
SQL> insert into my_spisok values (' qqq ');
1 row inserted
SQL> create table my_tab (sel varchar2 (10));
Table created
SQL> alter table my_tab add constraint asd foreign key (sel) references my_spisok (sel);
Table altered
SQL>
SQL> insert into my_tab values (' qqq ');
1 row inserted
SQL> insert into my_tab values (' www ');
insert into my_tab values (' www ')
ORA-02291: integrity constraint (SYS.ASD) violated - parent key not found
SQL>

6

Re: Field with certain variants of filling

igor_alex wrote:

Restriction of check of a column cannot refer to other columns

, the friend - what for you so?

7

Re: Field with certain variants of filling

stax. wrote:

, the friend - what for you so?

C, rows... All c in the house a smile)).
SY.

8

Re: Field with certain variants of filling

stax.;
If to you it is not basic, , send messages under another anybody
.....
stax

9

Re: Field with certain variants of filling

2, and can gray  original, and dark blue - counterfeit?

10

Re: Field with certain variants of filling

2 wrote:

Stax;
I suggest forum community to organize the company on universal  gray counterfeit stax smile))

it is not necessary, let has a good time, I will get used in due course (or a clone I will create)
The person of the achieved, I  not under gray that else I am necessary do not understand now
.....
stax

11

Re: Field with certain variants of filling

wrote:

Dobrozhelatel2, and can gray  original, and dark blue - counterfeit?

No, dark blue  also, as earlier  the gray.

12

Re: Field with certain variants of filling

Stax wrote:

I will get used in due course (or a clone I will create)

, I created

13

Re: Field with certain variants of filling

stax. wrote:

it is passed...
, I created

Thanks smile))
.....
stax

14

Re: Field with certain variants of filling

Stax (present);
to you a gift smile

15

Re: Field with certain variants of filling

Like, Sta always subscribed in the end.
It means, dark blue - present

16

Re: Field with certain variants of filling

--Eugene-;
Too so I think. It would be difficult to forge the signature.
.....
stax