بتاريخ: 8 سبتمبر 201312 سنة comment_239895 السلام عليكم ورحمة الله وبركاته كنت اود ان اعرف هل يمكن ان استخدم IN condition داخل الدالة decode فهل هذا ممكن واذا كان ممكن برجاء توضيح كيفية كتابة الجملة تقديم بلاغ
بتاريخ: 8 سبتمبر 201312 سنة comment_239899 السلام عليكم ورحمة الله وبركاته الكتاب Oracle PL/SQL Programming Is It Null, or Is It Not?A null collection is not the same thing as an initialized collection with zero elements. Image 100003 has no keywords, but the object view is mistakenly returning an empty but initialized collection. To get a true NULL instead, I can use a DECODE to test the number of keywords: CREATE OR REPLACE VIEW images_v OF image_t WITH OBJECT IDENTIFIER (image_id) AS SELECT i.image_id, BFILENAME('ROOTDIR', i.file_name), i.file_type, i.bytes, DECODE((SELECT COUNT(*) FROM keywords k2 WHERE k2.image_id = i.image_id), 0, NULL, CAST (MULTISET (SELECT keyword FROM keywords k WHERE k.image_id = i.image_id) AS keyword_tab_t)) FROM images i; In other words, if there are no keywords, return NULL; otherwise, return the CAST/MULTISET expression. From this view, "SELECT ... WHERE image_id=100003" properly yields the following: IMAGE_ID KEYWORDS ---------- ------------------------------------------------------- 100003 But you might conclude that this amount of conceptual purity is not worth the extra I/O (or having to look at the convoluted SELECT statement). 5_تقرير لطباعة الحركات الشهرية لجميع الحسابات خلال السنة المحددة REP1005 الكود المكتوب داخل تصميم التقرير select act.ac_num , act.ac_nam , sum(vd-vc) , sum(decode(to_char(dat,'mm'),'01', (vd-vc),0)) "mon 1", sum(decode(to_char(dat,'mm'),'02', (vd-vc),0)) "mon 2", sum(decode(to_char(dat,'mm'),'03', (vd-vc),0)) "mon 3", sum(decode(to_char(dat,'mm'),'04', (vd-vc),0)) "mon 4", sum(decode(to_char(dat,'mm'),'05', (vd-vc),0)) "mon 5", sum(decode(to_char(dat,'mm'),'06', (vd-vc),0)) "mon 6", sum(decode(to_char(dat,'mm'),'07', (vd-vc),0)) "mon 7", sum(decode(to_char(dat,'mm'),'08', (vd-vc),0)) "mon 8", sum(decode(to_char(dat,'mm'),'09', (vd-vc),0)) "mon 9", sum(decode(to_char(dat,'mm'),'10', (vd-vc),0)) "mon 10", sum(decode(to_char(dat,'mm'),'11', (vd-vc),0)) "mon 11", sum(decode(to_char(dat,'mm'),'12', (vd-vc),0)) "mon 12"from act , v_ent_act where ac_num = d_c_num and to_number(to_char(dat,'YYYY')) = _year group by act.ac_num , act.ac_nam order by act.ac_num ; جزاك الله كل خير تقديم بلاغ
بتاريخ: 8 سبتمبر 201312 سنة كاتب الموضوع comment_239903 اخى الكريم الرد اللى حضرتك كاتبته انا مش فاهمة منه اى حاجة انا كان سؤالى اذا كان ممكن استخدم ال IN condition داخل ال decode function مثلا decode (side_code in (2,4) ,sum(item_value),0) يعنى الحقل اللى عايزة اسال عليه فى الدالة عاوزة حالة اذا كان هذا المتغير ياخد اكتر من قيمة وعاوزة احدد تلك القيم من خلال الشرط in تقديم بلاغ
بتاريخ: 9 سبتمبر 201312 سنة comment_239943 لا مينفعش , استخدم CASE SELECT CASE WHEN JOB IN ('CLERK','PRESIDENT') THEN SAL+7 FORM EMP ; تم تعديل 9 سبتمبر 201312 سنة بواسطة eslam elbyaly تقديم بلاغ
بتاريخ: 12 سبتمبر 201312 سنة comment_240071 السلام عليكم ورحمة الله وبركاته اخي الكريم يمكنك وضع الشرط الذي تريده كما في الكود التالي Select empno , ename , deptno , decode( deptno , 10 , 'ACCOUNTING', 20, 'RESEARCH', 30, 'SALES', 40, 'OPERATIONS', 'Non domestic') "departments employ" from emp ; Select empno , ename , deptno , decode( deptno , 10 , 'ACCOUNTING', 20, 'RESEARCH', 30, 'SALES', 40, 'OPERATIONS', 'Non domestic') "departments employ" from emp where deptno in( 10, 30 ) ; جزاك الله كل خير تقديم بلاغ
انضم إلى المناقشة
يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.