الواثق بوعد الله بتاريخ: 23 ديسمبر 2009 تقديم بلاغ مشاركة بتاريخ: 23 ديسمبر 2009 السلام عليكمسؤالى وهو ماذا يقصد بــ Nested Tablesو الــ VARRAY وبارك الله فيكم اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
Om MAriam بتاريخ: 23 ديسمبر 2009 تقديم بلاغ مشاركة بتاريخ: 23 ديسمبر 2009 Nested Tables and Varrays [iD 61745.1] -------------------------------------------------------------------------------- Modified 28-MAY-2009 Type BULLETIN Status PUBLISHED Checked for relevance on 28-May-2009 Nested Tables and VarraysIntroduction------------Oracle8 provides two collection types: nested tables and varying arrays or VARRAYS. A collection is an ordered group of elements of the same type. Each element from the group can be accessed using a unique subscript. The element types of a collection can be either built-in datatypes, user-defined types or references (REFs) to object types.Nested Tables-------------An ordered group of items of type TABLE are called nested tables.Nested tables can contain multiple columns and can be used asvariables, parameters, results, attributes, and columns. Theycan be thought of as one column database tables. Rows of anested table are not stored in any particular order.The size of a nested table can increase dynamically, i.e., nestedtables are unbounded. Elements in a nested table initially haveconsecutive subscripts, but as elements are deleted, they can havenon-consecutive subscripts. Nested tables can be fully manipulated using SQL, Pro*C, OCI, and PL/SQL. The range of values for nested table subscripts is 1..2147483647. To extend a nested table, the built-in procedure EXTEND must be used. To delete elements, the built-in procedure DELETE must be used. An uninitialized nested table is atomically null, so the IS NULLcomparison operator can be used to see if a nested table is null. Oracle8 provides new operators such as CAST, THE, and MULTISET for manipulating nested tables.Examples for Nested Tables--------------------------Example 1:----------The following example illustrates how a simple nested table is created.a) First, define a Object type as follows: SQL> CREATE TYPE ELEMENTS AS OBJECT ( 2> ELEM_ID NUMBER(6), 3> PRICE NUMBER(7,2)); 4> / Next, create a table type ELEMENTS_TAB which stores ELEMENTS objects: SQL> CREATE TYPE ELEMENTS_TAB AS TABLE OF ELEMENTS; 2> /c) Finally, create a database table STORAGE having type ELEMENTS_TAB as one of its columns: SQL> CREATE TABLE STORAGE ( 2> SALESMAN NUMBER(4), 3) ELEM_ID NUMBER(6), 4) ORDERED DATE, 5) ITEMS ELEMENTS_TAB) 6) NESTED TABLE ITEMS STORE AS ITEMS_TAB;Example 2:----------This example demonstrates how to populate the STORAGE table with a single row:SQL> INSERT INTO STORAGE 2> VALUES (100,123456,SYSDATE, 3> ELEMENTS_TAB(ELEMENTS(175692,120.12), 4> ELEMENTS(167295,130.45), 5> ELEMENTS(127569,99.99)));Example 3:----------The following example demonstrates how to use the operator THE which isused in a SELECT statement to identify a nested table:SQL> INSERT INTO 2> THE 3> (SELECT ITEMS FROM STORAGE WHERE ELEM_ID = 123456) 4> VALUES (125762, 101.99);Example 4:----------The following example shows how to update the STORAGE table row wheresalesman column has value 100:SQL> UPDATE STORAGE 2> SET ITEMS = ELEMENTS_TAB(ELEMENTS(192512, 199.99)) 3> WHERE SALESMAN = 100;Varrays-------Varrays are ordered groups of items of type VARRAY. Varrays can be usedto associate a single identifier with an entire collection. This allowsmanipulation of the collection as a whole and easy reference ofindividual elements.The maximum size of a varray needs to be specified in its type definition.The range of values for the index of a varray is from 1 to the maximumspecified in its type definition. If no elements are in the array, thenthe array is atomically null. The main use of a varray is to groupsmall or uniform-sized collections of objects.Elements of a varray cannot be accessed individually through SQL, althoughthey can be accessed in PL/SQL, OCI, or Pro*C using the array stylesubscript. The type of the element of a VARRAY can be any PL/SQL typeexcept the following: BOOLEAN TABLE VARRAY object types with TABLE or VARRAY attributes REF CURSOR NCHAR NCLOB NVARCHAR2Varrays can be used to retrieve an entire collection as a value. Varraydata is stored in-line, in the same tablespace as the other data in its row.When a varray is declared, a constructor with the same name as the varray isimplicitly defined. The constructor creates a varray from the elementspassed to it. You can use a constructor wherever you can use a functioncall, including the SELECT, VALUES, and SET clauses.A varray can be assigned to another varray, provided the datatypes are theexact same type. For example, suppose you declared two PL/SQL types: TYPE My_Varray1 IS VARRAY(10) OF My_Type; TYPE My_Varray2 IS VARRAY(10) OF My_Type;An object of type My_Varray1 can be assigned to another object of typeMy_Varray1 because they are the exact same type. However, an object oftype My_Varray2 cannot be assigned to an object of type My_Varray1 becausethey are not the exact same type, even though they have the same element type.Varrays can be atomically null, so the IS NULL comparison operator can beused to see if a varray is null. Varrays cannot be compared for equalityor inequality.Examples for Varrays--------------------Example 5:---------The following shows how to create a simple VARRAY:a) First, define a object type ELEMENTS as follows: SQL> CREATE TYPE MEDICINES AS OBJECT ( 2> MED_ID NUMBER(6), 3> MED_NAME VARCHAR2(14), 4> MANF_DATE DATE); 5> / Next, define a VARRAY type MEDICINE_ARR which stores MEDICINES objects: SQL> CREATE TYPE MEDICINE_ARR AS VARRAY(40) OF MEDICINES; 2> /c) Finally, create a relational table MED_STORE which has MEDICINE_ARR as a column type: SQL> CREATE TABLE MED_STORE ( 2> LOCATION VARCHAR2(15), 3> STORE_SIZE NUMBER(7), 4> EMPLOYEES NUMBER(6), 5> MED_ITEMS MEDICINE_ARR);Example 6:----------The following example shows how to insert two rows into the MED_STORE table:SQL> INSERT INTO MED_STORE 2> VALUES ('BELMONT',1000,10, 3> MEDICINE_ARR(MEDICINES(11111,'STOPACHE',SYSDATE)));SQL> INSERT INTO MED_STORE 2> VALUES ('REDWOOD CITY',700,5, 3> MEDICINE_ARR(MEDICINES(12345,'STRESS_BUST',SYSDATE)));Example 7:----------The following example shows how to delete the second row we have inserted inexample 6 above:SQL> DELETE FROM MED_STORE 2> WHERE LOCATION = 'REDWOOD CITY';Example 8:----------The following example shows how to update the MED_STORE table and add moremedicines to the Belmont store:SQL> UPDATE MED_STORE 2> SET MED_ITEMS = MEDICINE_ARR ( 3> MEDICINES(12346,'BUGKILL',SYSDATE), 4> MEDICINES(12347,'INHALER',SYSDATE), 5> MEDICINES(12348,'PAINKILL',SYSDATE));Differences Between Nested Tables and Varrays---------------------------------------------* Nested tables are unbounded, whereas varrays have a maximum size.* Individual elements can be deleted from a nested table, but not from a varray. Therefore, nested tables can be sparse, whereas varrays are always dense.* Varrays are stored by Oracle in-line (in the same tablespace), whereas nested table data is stored out-of-line in a store table, which is a system-generated database table associated with the nested table.* When stored in the database, nested tables do not retain their ordering and subscripts, whereas varrays do.* Nested tables support indexes while varrays do not. اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
الواثق بوعد الله بتاريخ: 23 ديسمبر 2009 كاتب الموضوع تقديم بلاغ مشاركة بتاريخ: 23 ديسمبر 2009 ممكن بالعربي أخى اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
أحمد جادو بتاريخ: 23 ديسمبر 2009 تقديم بلاغ مشاركة بتاريخ: 23 ديسمبر 2009 بارك الله فيكي يا أخت (أم مريم) ولكن لي سؤالكيف يمكن استخدام هذه القيم سواء داخل الشاشات Forms أو التقارير Reports أو حتى الاستعلامات Queryعشان أنا جربت أعمل Data Block Wizard ولم يقبل مني الNested ولا حتى الVarray اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
Om MAriam بتاريخ: 23 ديسمبر 2009 تقديم بلاغ مشاركة بتاريخ: 23 ديسمبر 2009 جرب الدمو بالمرفق بس run الscribt الاولولمعلومات اكثر شوف اللينك ده:http://sheikyerbouti.developpez.com/collec...collections.htm UsingNested_tables.rar اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
ام طيبه بتاريخ: 4 فبراير 2010 تقديم بلاغ مشاركة بتاريخ: 4 فبراير 2010 عزيزتي ام مريم محتاجه في شغلي ان كل الفورم تشوف arrayبس المشكله انه لا اعرف كيف اعمل global array اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
Om MAriam بتاريخ: 4 فبراير 2010 تقديم بلاغ مشاركة بتاريخ: 4 فبراير 2010 What do you mean by Global array?Once you create the type (Varray, nested table,..) They become an objects on the database and visible on the shcema اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
ام طيبه بتاريخ: 4 فبراير 2010 تقديم بلاغ مشاركة بتاريخ: 4 فبراير 2010 عزيزتي ام مريم عندي فورم صرف دواء لمستشفى تخصصي ارادوا مني عمل تصفح في رقم المريض حتى 25 رقم مريض اني ما اعرف array حليتها بان عملت 25 text itemاعرف انه هذا مو حل بس كنت مصره اتعلم عمل type arr is table of number(10); x arr:=arr(); for i in 1..25 loop x.extend; x(x.count)=i; end loop; اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
ام طيبه بتاريخ: 4 فبراير 2010 تقديم بلاغ مشاركة بتاريخ: 4 فبراير 2010 ممكن خطوه خطوه تعلميني الي اسويه مع العلم انه اني قريت الملف المرفق الي حضرتج واضعته كلش مفيد بس اخر موضوع بيه وهو ربط nessted array with developerعن طريق set_block_property لم افتهمه typeيكون عام بس الvariable راح يكون وين اعرفه ويشوفه كل البرنامجبس لو ممكن تطولين بالج وتشرحيلي اولى الخطوات واني متاكده بانه راح اكدر اكمل وحدي وما ازعجج واستند على الملف الي رافقته حضرتج اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
Om MAriam بتاريخ: 7 فبراير 2010 تقديم بلاغ مشاركة بتاريخ: 7 فبراير 2010 ممكن توضيح اكثر للمطلوب فورم صرف الدواء لاني مش فاهماه كويس اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
ام طيبه بتاريخ: 7 فبراير 2010 تقديم بلاغ مشاركة بتاريخ: 7 فبراير 2010 عزيزتي ام مريم كنت انتظر ردك بفارغ الصبر والترقب المشكله الي عندي هي كالاتي فورم صرف الدواء فيها رقم المريض واسمه وعند ادخال رقم مريض جديد وضغط انتر المفروض يخزنه هذا الرقم ولح 25 رقم وهو ماسموه الي تصفح 25 id وفي اي لغه عاديه كان الحل بسيط بان اعمل arrayوتكون globalوكم مره يخزن فيها عند ضغط انتر بس الاوراكل يصعب الامور ويعقدها بان لايوجد arrayموجوده فيه بس موضوعج فتحلي باب الامل من جديد فلا تقطعي عن الامل بالاوراكل اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
Amgad بتاريخ: 7 فبراير 2010 تقديم بلاغ مشاركة بتاريخ: 7 فبراير 2010 السلام عليكم ورحمة الله الأخت / أم طيبةاذا كان المقصود من السؤال هو استخدام فكرة ال array لتخزين مجموعه من الارقام المختارة معا ... ثم تحريكها الى التقرير لاستخراج تقرير معين من خلال فكرة استخدام ال global values فيمكن الاطلاع على هذه المشاركة السابقة بالمنتدى ... لتحريك مجموعة الارقام المختارة بدون استخدام ال array وبدون استخدام ال global او للرد على السؤال التالي لدي form بها بعض بيانات الموظفين تظهر بطريقة ال tabular . اريد أن اختار بعض ارقام الموظفين من هذه الشاشة وارسلها الى report لطباعة بيانات تخص ارقام الموظفين المحددة والمختاره من الform. إضغط هنا : تحريك بيانات من الform الى الreportارجوا ان يكون هذا هو المطلوب اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
ام طيبه بتاريخ: 9 فبراير 2010 تقديم بلاغ مشاركة بتاريخ: 9 فبراير 2010 مشكور اخ اشرف هذا الموضوع الي ذكرته انهي قرأته وفادني كثيرا هذا الموضوع بس الي احتاجه هنا غير هذا الخزن الي اريده مو داتا بيس خزن خلال جلسه عمل ليتم تذكر كل المرضى الذين تم صرف العلاج لهم لهذا اليوم ومشكور امجد واني بانتظار رد ام مريم علي لانها هي طرحت هذا الموضوع وتعرف بيه اكيد اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
Om MAriam بتاريخ: 9 فبراير 2010 تقديم بلاغ مشاركة بتاريخ: 9 فبراير 2010 ممكن تبعتي الشاشة بتاعتك لاني مش قادرة افهم ايه المطلوب اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
ام طيبه بتاريخ: 12 فبراير 2010 تقديم بلاغ مشاركة بتاريخ: 12 فبراير 2010 هذه الفورمه لصرف ادويه للراقدين في مستشفى اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
ام طيبه بتاريخ: 12 فبراير 2010 تقديم بلاغ مشاركة بتاريخ: 12 فبراير 2010 هذه الفورمه لصرف ادويه للراقدين في مستشفى اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
Recommended Posts
انضم إلى المناقشة
يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.