الانتقال إلى المحتوى

لمنع تداخل التواريخ في البلوك الفرعي عند الادخال Date Overlopping Is not Prmitted


gold_heart

Recommended Posts

لمنع تداخل التواريخ في البلوك الفرعي عند الادخال


date overlopping is not prmitted


in details block



لدينا جدولين





master



create table itemss (item_code number(5),name varchar2(50),constraint pk_itemss primary key (item_code) );




Detail



create table prices (price_code number(5) ,date_from


date , date_to date , price number (5) , item_code number(5) );

alter table prices add constraint pk_prices primary key (price_code)
alter table prices add constraint fk_prices foreign key (item_code) references itemss (item_code);




[/center]

وهذه صورة البلوكين على الفورم






مع العلم ان كل صنف


item


له اكثر من سعر بختلاف التاريخ


والسوال




كيف يمكن منع تداخل التواريخ في البلوك الفرعي الاسعار


prices عند الادخال اسعار جديده



في الانتظار...

تم تعديل بواسطة gold_heart
رابط هذا التعليق
شارك

try write below code in WHEN-VALIDATE-RECORD trigger at block prices




declare
ln$count_exists number;
begin

select count(1)
into ln$count_exists
from prices
where item_code = :prices.item_code
and
(:prices.date_from between date_from and date_to
or
:prices.date_to between date_from and date_to
or (:prices.date_from < date_from and :prices.date_to > date_to)
)
and (ROWID <> :prices.ROWID or :prices.ROWID is null);

if ln$count_exists > 0 then
   message('Overlooping is existed');
edn if;

end;

رابط هذا التعليق
شارك

it is working

تم تعديل بواسطة omogun
رابط هذا التعليق
شارك

اعتقد ان الكود صحيح لكن المشكله الان


ان الفورمز لايمكن عمل


run


ابدا


ولا يظهر خطا


وحاولت حلول كثيره لم تفلح


الصور من هنا





وايضا





الموضوع






في انتظار الرد ... وشكرا

تم تعديل بواسطة gold_heart
رابط هذا التعليق
شارك

انضم إلى المناقشة

يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.

زائر
أضف رد على هذا الموضوع...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   تمت استعادة المحتوى السابق الخاص بك.   مسح المحرر

×   You cannot paste images directly. Upload or insert images from URL.

جاري التحميل
×
×
  • أضف...

برجاء الإنتباه

بإستخدامك للموقع فأنت تتعهد بالموافقة على هذه البنود: سياسة الخصوصية