الانتقال إلى المحتوى

مساعدة في ايجاد الكود المناسب


Saloooma

Recommended Posts

مساء الخير

 

عندي واجب في pl/sql و للحين مش عارفة أكمل االبلوك كامل

 

هذا السؤال

 

Consider the following STU table exist in a certain database:

Stu_Id                  Name                     Specialization

 

1                           mohammed ali                   1

 

2                          fatima abdullah                    2

 

3                          ahmed ali                             1

 

4                            badar saleh                        2

 

5                           marwa mohammed           1

 

6                            khuloud abdullah               3

 

 

 

Create a PL/SQL block to modify the records of the STU table based on the following criteria:

 Student Id must be in the format 14FXXXX e.g. 14F1001, 14F1002

 Student name must be in such a way that first letter of each word should be in upper case. E.g. Mohammed Ali, Fatima Abdullah etc.

 Specialization should be modified as follows:

o Software Technology for 1

o Hardware and Networking for 2

o Multimedia for 3

 Display the name of specialization having least number of students.

 

Note: The code must be written in one block only.

 

 

 

 

بليز ساعدوني فيه ضروري

رابط هذا التعليق
شارك

مبدئيا بالنسبة لحالة الاسماء فا ممكن تستخدم البلوك ده

declare
cursor c is select * from STU;
begin
for i in c loop
update STU set name = (select INITCAP(name) from stu where stu_id = i.stu_id)
where stu_id = i.stu_id;
end loop;
end;

ممكن نفكر بعد كده فى طريقة لحيث اننا نعدل فى نفس البلوك

رابط هذا التعليق
شارك

أنا استخدمت هذا الكود

و صارت مع التغيرات في stu_id and name

بس ما وصلت لطريقة تغير السبلايزيشن  المستر قال ممكن نستخدم فيها for loop  و بعدها ابديت :wacko:  بس ما عرفت الحل الصحيح

declare
stu varchar2(20);
begin
update student
set stu_id='14foo'||stu_id ;
update student
set Name= INITCAP (name);
end;

ولو في حد عنده طريقة ثانيه لإبديت الايدي ياريت يفيدني بيها

رابط هذا التعليق
شارك

البلوك مطلوب عند الاضافة ولا فحص وتعديل على البيانات الموجودة بالجداول

 تعديل في البيانات الموجودة

رابط هذا التعليق
شارك

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

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

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

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   تمت استعادة المحتوى السابق الخاص بك.   مسح المحرر

×   You cannot paste images directly. Upload or insert images from URL.

جاري التحميل
×
×
  • أضف...

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

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