بتاريخ: 4 أغسطس 200916 سنة comment_165477 السلام على اهل السلام كيف الصحة ان شاء الله الكل بخيرشوفو اليوم انا عملت باتون فيها هذا الكود declare -- sold quantity for book A in export B cursor sold is select sum(nvl(b.RcpDtlQty,0)) sold1,c.expcde expcde, c.expbok bok from krcpdtat a,krcpdtlt b, kexpbokt c where a.rcpcde=b.rcpdtlcde and a.rcpint=b.rcpdtlint and a.rcpcnlflg is null and a.rcpprtflg is not null and b.rcpexpcde=c.expcde and b.rcpdtlbok=c.expbok group by c.expcde, c.expbok; exported_cur kexpbokt.expqty%type; returned_cur krtnstrt.RTNQTY%type; remain_cur kexpbokt.expqtyrmn%type; expcde_cur kexpbokt.expcde%type; bok_cur kexpbokt.expbok%type; sold_cur number(6):=0; begin --choose sold books that satified the condition : export-rtn<sold+rmn for x in sold loop expcde_cur:=x.expcde; bok_cur:= x.bok; sold_cur:=x.sold1; --remaining select nvl(a.expqtyrmn,0) into remain_cur from kexpbokt a where a.expcde =expcde_cur and a.expbok= bok_cur; --returned select nvl(sum(a.rtnqty),0) into returned_cur from krtnstrt a where a.rtnexpcde =expcde_cur and a.rtnbok=bok_cur; --export select nvl(a.expqty,0) into exported_cur from kexpbokt a where a.expcde =expcde_cur and a.expbok=bok_cur; if (exported_cur-returned_cur)<(remain_cur+sold_cur) then update kexpbokt a set a.expqty =(returned_cur+remain_cur+sold_cur) where a.expcde=expcde_cur and a.expbok =bok_cur; insert into book1 values(bok_cur,expcde_cur); end if; end loop; commit; end; ركزو علىالكيرسور cursor sold is select sum(nvl(b.RcpDtlQty,0)) sold1,c.expcde expcde, c.expbok bok from krcpdtat a,krcpdtlt b, kexpbokt c where a.rcpcde=b.rcpdtlcde and a.rcpint=b.rcpdtlint and a.rcpcnlflg is null and a.rcpprtflg is not null and b.rcpexpcde=c.expcde and b.rcpdtlbok=c.expbok group by c.expcde, c.expbok; انا كنت مسويتها بدلsum(nvl(b.RcpDtlQty,0)كنت حاطة count (*)بس لما غيرتها الى السامصاؤ يطلع لي هذا الخطأfrm-40735 unhandled exception ORA-00001ولما اقوله ديسبلي ارور يقولي نو ارور احد يعرف ليشاو اش اسوي؟؟ تقديم بلاغ
بتاريخ: 4 أغسطس 200916 سنة comment_165478 السلام عليكمطيب جربي اكتبي بنهاية الكود EXECPTION كالتالي: EXECPTION WHEN OTHERS THEN NULL; ان استمر الخطأ.. ارفق الفورم والجدول... تم تعديل 4 أغسطس 200916 سنة بواسطة PALI.ORACLE تقديم بلاغ
بتاريخ: 4 أغسطس 200916 سنة comment_165479 this error of primary key violation or unique value تقديم بلاغ
بتاريخ: 4 أغسطس 200916 سنة comment_165529 اخي العزيز كما قال الاخ maher المشكلة هي ORA-00001: unique constraint violatedومعنى ذلك انه لا يوجد لديك اي مشكلة في الكيرسر ولكن المشكلة اما في عملية الـ update او في عملية الـ insert حيث قوم بتعديل قيمة تحتوي على قيد فريد (unique) الى قيمه موجوده اصلا او تقوم بعمل اضافة سجل واسناد قيمه لاحد هذه الحقول التي تحتوي ايضا على قيد فريد (unique) بقيمه موجوده مسبقا لكن لمذا ظهر الخطأ عند تعديل العملية من count الى sum يعزى السبب بتغير نتيجة الكيرسر وكما يوجد في النهاية شرط يحدد عمليه الـ update والـ insert وفي هذه الحالة تحقق الشرط فقام بتطبيق ما بهى وظهر الخطأ تقديم بلاغ
بتاريخ: 5 أغسطس 200916 سنة كاتب الموضوع comment_165551 تشكراتي لكم جميعاوجزاكم الله الف خيرفعلا لما شلت جملة الانسرت لما شلتها اشتغلت اممم وبس تقديم بلاغ
انضم إلى المناقشة
يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.