الانتقال إلى المحتوى
View in the app

A better way to browse. Learn more.

مجموعة مستخدمي أوراكل العربية

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

عاوز جواب شافى فى هذا الCursor

Featured Replies

بتاريخ:

الاخوة الكرام السلام عليكم وكل عام وانتم بخير
سوالى هو
لماذا يستخدم الكيرسور فى هذا المثال وكلنا يعلم بان الكيرسور يستخدم لمعالجة الإستعلام الذى يعود باكثر من صف وهنا اريد ان اعرف لماذا تم الإستخدام

declare


v_invalid BOOLEAN;


cursor c_deptname is


select dname from dept where deptno = :emp.deptno;


begin


open c_deptname;


fetch dname into :emp.dept_name ; --displiay item


v_invalid := c_deptname%notfound;


if v_invalid then


message('this deptno is invalid.');


raise form_trigger_failure;



لما لا اكتفى فقط بوضع كود فى when validate item ويكون غلى النحو التالى



select dname into :emp.dept_name --display_item


from dept where deptno = :emp.deptno


when no_data_found then


message('invalid deptno try again');


raise form_trigger_failure;



ولكم كل الشكر والتقدير

بتاريخ:

والله يا ريس انت أدري , من غير ما اقرأ المثال , هو لو بيرجع باكتر من قيمة استخدم الكرسور , بيرجع بقيمة واحدة تبقي مش محتاج كرسور

بتاريخ:

يا أخي الـ Cursor أفضل من جملة Select لأن هذه الاخيرة بها Loop فما بالك لو أنك تبحث في مليون سجل مثلاً
والله أعلم

بتاريخ:

Sa,


Using select into statement is better as you query using primary key column and it will return at most one record and you handled NO_DATA_FOUND exception.



You can use cursor if it will return more than one record and you want to loop in data-set result


Thanks

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

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

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

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

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

Account

Navigation

البحث

إعداد إشعارات المتصفح الفورية

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.