ledow2007 بتاريخ: 22 مارس 2010 تقديم بلاغ مشاركة بتاريخ: 22 مارس 2010 إلى أعضاء المنتدي الكراممحتاج مساعدة في شرح هذا الكودCopy specific columns (and rows) from one table to another: Insert into postables (postable_id, postable_name, dept, auth_name) VALUES( (Select postables_seq.nextval), (Select 'some static text' postable_name), (Select dept From cost_centres Where cc_code = 123), (Select auth_name From authorisers Where auth_code = 'Z5f') ) [b] -- The same as above written to select alias names:[/b] insert into postables (postable_id, postable_name, dept, auth_name) (select AA,BB,CC,DD from (Select postables_seq.nextval AA), (Select 'some static text' BB), (Select dept CC From cost_centres Where cc_code = 123), (Select auth_name DD From authorisers Where auth_code = 'Z5f')); اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
ledow2007 بتاريخ: 23 مارس 2010 كاتب الموضوع تقديم بلاغ مشاركة بتاريخ: 23 مارس 2010 معقول الكود صعب لدرجة ديبس أعتقد انه مش بالصعوبة على محترفي أوركل بالموقع ولكن أعتقد أنهم مشغولين........... منتظر الردود اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
oracleman2010 بتاريخ: 31 مارس 2010 تقديم بلاغ مشاركة بتاريخ: 31 مارس 2010 1- First the insert statements must be wrote as next to run successfully: INSERT INTO postables (postable_id, postable_name, dept, auth_name ) VALUES ((SELECT postables_seq.NEXTVAL FROM DUAL), (SELECT 'some static text' postable_name FROM DUAL), (SELECT dept FROM cost_centres WHERE cc_code = 123), (SELECT auth_name FROM authorisers WHERE auth_code = 'Z5f') ); INSERT INTO postables (postable_id, postable_name, dept, auth_name) (SELECT aa, bb, cc, dd FROM (SELECT postables_seq.NEXTVAL aa FROM DUAL), (SELECT 'some static text' bb FROM DUAL), (SELECT dept cc FROM cost_centres WHERE cc_code = 123), (SELECT auth_name dd FROM authorisers WHERE auth_code = 'Z5f')); 2-It is no difference between the 2 statements, their job is one and its inserting rows into a table. اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
Recommended Posts
انضم إلى المناقشة
يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.