unique constraint with duplicate entry [message #379087] |
Sun, 04 January 2009 12:11 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
shahzaib_4vip@hotmail.com
Messages: 410 Registered: December 2008 Location: karachi
|
Senior Member |
|
|
Hellow Memeber's
I have one issue in Developer Form i create 2 table one is job and other is Style
job table have 2 column Job_no and Job_name both column have primary key which foreign key on style table
and style have 3 column style_no,job_no,Job_name
now i want to enter style wise job entry and don't want to enter duplicate job_no and job_name in style table
for example
i have 2 job
Job A and Job B
And i have one style
Style AAA
now i want to enter job on style AAA
job A
and Job B
and Job B Again
Now i want when ever i enter a Duplicate job its give me Error in form
Thanks
Shahzaib ismail
|
|
|
|
Re: unique constraint with duplicate entry [message #379091 is a reply to message #379087] |
Sun, 04 January 2009 13:39 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
shahzaib_4vip@hotmail.com
Messages: 410 Registered: December 2008 Location: karachi
|
Senior Member |
|
|
For example if i create a Unique Constraint on Job_no and Job_name
Style no AAA
Job A and Job B
Style no ABC
(Job A and Job B)
it will give me error no duplicate allow due to unique constraint
so i need style AAA (many jobs but not duplicate)
Style ABC (many jobs not not Duplicate)
Hope you understand
|
|
|
Re: unique constraint with duplicate entry [message #379093 is a reply to message #379091] |
Sun, 04 January 2009 15:39 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](/forum/images/custom_avatars/72104.gif) |
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Quote: | Hope you understand
|
Sorry, I don't.
Whichever your "unique combination" is (style, job, no matter how you call it), it should be done by creating an unique constraint on a database level.
I re-read your messages a few times, but couldn't get the idea (is it because it is quite late here or I'm to stupid to get it, I wouldn't know). Though, if you manage to illustrate it in a form of a spreadsheet (do NOT attach an Excel file, please!) which means: use [code] or [pre] tags to preserve formatting so that we could see form of a spreadsheet table, perhaps I'll be able to understand it.
Hopefully, you might get the answer by someone else!
|
|
|
Re: unique constraint with duplicate entry [message #379096 is a reply to message #379087] |
Sun, 04 January 2009 16:06 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
shahzaib_4vip@hotmail.com
Messages: 410 Registered: December 2008 Location: karachi
|
Senior Member |
|
|
ok lets me explain you once again because your reply is very help full for me
i create one table which structure is
create table job
(job_no number(10),
job_name varchar2(20),
constraint pk_job_job primary key(job_no,job_name))
and create one other table which is style
create table style
(Style_no number(20),
style_job_no number(10),
style_job_name varchar2(20),
constraint fk_style foreign key(style_job_no,style_job_name)
references job(job_no,job_name))
Now i insert 3 records in job
insert into job
values
('1','cutting');
insert into job
values
('2','Stitching');
insert into job
values
('3','Packing');
in style table
i insert
insert into style
values
('9645','2','Stitching');
insert into style
values
('9645','2','Stitching');
Now My Question is simple in style '9645' i don't want to enter job no 2 multiple time
so i need a trigger where when i enter duplicate job no in one particular style its give me error
Hope this time you will understand
Any way Thanks A lot for your reply
|
|
|
|
|