الانتقال إلى المحتوى
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.

مساعدة فى رسالة خطأ :ORA-06503: PL/SQL: Function returned without value

Featured Replies

بتاريخ:

create or replace function get_job(p_person_id  number ) return varchar2
is
cursor s is

select
   
   jbt.name
  
from   per_all_assignments_f asg,
   per_assignment_status_types ast,
   per_assignment_status_types_tl astl,
   hr_all_organization_units org,
   hr_all_organization_units_tl orgtl,
   pay_all_payrolls_f ppa,
   per_jobs_tl jbt,
   per_grades_tl gdt,
   pay_people_groups ppg,
/*	   hr_positions pos,*/
   hr_locations loc,
   per_all_people_f peo,
   hr_lookups hrl,
   hr_lookups hrl2,
   hr_lookups hrl3,
   hr_lookups hrl4
where  asg.assignment_status_type_id = ast.assignment_status_type_id
 and  ast.assignment_status_type_id = astl.assignment_status_type_id
 and  astl.language = userenv('LANG')
 and  asg.organization_id = org.organization_id
 and  org.organization_id = orgtl.organization_id
 and  orgtl.language = userenv('LANG')
 and  asg.payroll_id = ppa.payroll_id (+)
 and  asg.job_id = jbt.job_id (+)
 and  jbt.language(+) = userenv('LANG')
 and  asg.grade_id = gdt.grade_id (+)
 and  gdt.language(+) = userenv('LANG')
 and  asg.people_group_id = ppg.people_group_id (+)
/*  and  asg.position_id = pos.position_id (+)*/
 and  asg.location_id = loc.location_id (+)
 and  asg.supervisor_id = peo.person_id (+)


  --
 and  hrl.lookup_type (+) = 'FREQUENCY'
 and  hrl.lookup_code (+) = asg.frequency
 and  hrl2.lookup_type (+) = 'QUALIFYING_UNITS'
 and  hrl2.lookup_code (+) = asg.probation_unit
 and  hrl3.lookup_type (+) = 'YES_NO'
 and  hrl3.lookup_code (+) = asg.manager_flag
 and  hrl4.lookup_type (+) = 'YES_NO'
 and  hrl4.lookup_code (+) = asg.primary_flag
 and asg.person_id= p_person_id;

begin
for cur in s loop
return cur.name;
end loop;

end get_job;


لما بجى استخدمها فى اى كويرى بتطلعلى ora-06503
ومش عارف سببها
ممكن مساعدة

بتاريخ:

السلام عليكم
اخى يجب ان تحتوى ال function على جمله return statement
لان function يجب ان تسترجع بيانات وان كنت لا تريد استرجاع قيمه معينه استعمل ال procedure

بتاريخ:

السلام عليكم ورحمة الله

كما ذكر الأخ / احمد ... انه لا توجد قيمة ناتجة عن تنفيذ جملة ال select داخل ال cursor

سبب الرسالة : انه لا توجد قيمة ناتجة عن تنفيذ الأوامر الموجودة بالcursor
يمكنك اضافة شرط للتأكد من وجود قيمة ناتجة من تنفيذ اوامر ال select .... يمكن أن تضع قيمة ثابته مثل "9999" فى حالة عدم تحقق ناتج من تنفيذ الأوامر
ويمكنك استخدام ال EXCEPTION فى حالة وجود خطأ غير معرف اثناء تنفيذ أمر الselect داخل الcursor

اليك هذا المثال : منقول

Error:


ORA-06503: PL/SQL: Function returned without value



Cause:


You tried to call a PLSQL function, but the function was missing a RETURN statement.



Action:


The options to resolve this Oracle error are:

  1. Try re-writing the function to include a RETURN statement. Or if you don't want to return a value, re-write your function as a procedure .


Every function must return a value. The following is an example of a function called FindCourse that returns a number. The code "RETURN cnumber" ensures that a value is returned from this function



CREATE OR REPLACE Function FindCourse
  ( name_in IN varchar2 )
  RETURN number
IS
cnumber number;
cursor c1 is
select course_number
  from courses_tbl
  where course_name = name_in;

BEGIN
open c1;
fetch c1 into cnumber;

if c1%notfound then
 cnumber := 9999;
end if;

close c1;
RETURN cnumber;
EXCEPTION
WHEN OTHERS THEN
  raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);
END;



جرب واخبرنا

بتاريخ:

سؤال بس هو إيه معني
(+)

شكراً

بتاريخ:

الاخ الكريم :

في مثل هذه الحالة يفضل ان تجرب ناتج تعليمة الاستعلام لوحدها ونتاكد انه تعيد نتيجة ام لا (واعتقد من ان تعليمة الاستعلام معقدة جدا فهي تقوم بالربط بين أكثر من جدول وهناك ربط خارجي لذا فأحتمال كبير أنها لا تعيد أي قيمة ) .

والامر الثاني هو وضع تعليمة return ضمن الحلقة لا فائدة منه لأن الخرج هنا سيكون دائما هي آخر عملية fetch , أي أنه هنا لن يتم إعادة كل قيمة من المشيرة فقط آخر عملية إحضار ستم إعادتها .لذا فوضع التعليمة داخل الحلقة او خارجها له نفس النتيجة ( مع ملاحظة في حال وضع التعليمة خارج الحلقة يجب تعريف متحول جديد لأن السجل cur معرف بشكل ضمني صمن الحلقة )
لذا فإن التابع هنا بأحسن الاحوال لن يعيد اكثر من قيمة واحدة

بتاريخ:

سؤال بس هو إيه معني
(+)

شكراً

هو كده عامل right outer join
بتاريخ:

سؤال بس هو إيه معني
(+)

شكراً



and

asg

.

payroll_id

=

ppa

.

payroll_id

(+)


هو كده عامل left outer join
والright العكس
http://www.java2s.com/Tutorial/Oracle/0140__Table-Joins/0080__Outer-Joins-Left-Right.htm

بتاريخ:


سؤال بس هو إيه معني
(+)

شكراً



and


asg


.


payroll_id


=


ppa


.


payroll_id


(+)



هو كده عامل left outer join
والright العكس
http://www.java2s.co...-Left-Right.htm


يا باشا متشكر علي الرد و التوضيح جداً
  • بعد 4 أسابيع...
بتاريخ:
  • كاتب الموضوع

function get_job(p_person_id  number ) return varchar2
is
cursor s is

select distinct
   
   nvl(jbt.name,'')job
  
from   per_all_assignments_f asg,
   per_assignment_status_types ast,
   per_assignment_status_types_tl astl,
   hr_all_organization_units org,
   hr_all_organization_units_tl orgtl,
   pay_all_payrolls_f ppa,
   per_jobs_tl jbt,
   per_grades_tl gdt,
   pay_people_groups ppg,
/*	   hr_positions pos,*/
   hr_locations loc,
   per_all_people_f peo,
   hr_lookups hrl,
   hr_lookups hrl2,
   hr_lookups hrl3,
   hr_lookups hrl4
where  asg.assignment_status_type_id = ast.assignment_status_type_id
 and  ast.assignment_status_type_id = astl.assignment_status_type_id
 and  astl.language = userenv('LANG')
 and  asg.organization_id = org.organization_id
 and  org.organization_id = orgtl.organization_id
 and  orgtl.language = userenv('LANG')
 and  asg.payroll_id = ppa.payroll_id (+)
 and  asg.job_id = jbt.job_id (+)
 and  jbt.language(+) = userenv('LANG')
 and  asg.grade_id = gdt.grade_id (+)
 and  gdt.language(+) = userenv('LANG')
 and  asg.people_group_id = ppg.people_group_id (+)
/*  and  asg.position_id = pos.position_id (+)*/
 and  asg.location_id = loc.location_id (+)
 and  asg.supervisor_id = peo.person_id (+)


  --
 and  hrl.lookup_type (+) = 'FREQUENCY'
 and  hrl.lookup_code (+) = asg.frequency
 and  hrl2.lookup_type (+) = 'QUALIFYING_UNITS'
 and  hrl2.lookup_code (+) = asg.probation_unit
 and  hrl3.lookup_type (+) = 'YES_NO'
 and  hrl3.lookup_code (+) = asg.manager_flag
 and  hrl4.lookup_type (+) = 'YES_NO'
 and  hrl4.lookup_code (+) = asg.primary_flag
 and asg.person_id= p_person_id;
j varchar2(300);
begin
open s ;
fetch s into j;
if s%notfound
then
j:='no';
end if;
close s;


انا استخدمت الحل المكتوب وحاولت اعمل exceptionاو استخدم nvl وبرضه نفس المشكلة ارجو المساعدة
ضرورى جدا

بتاريخ:
  • كاتب الموضوع

ارجو المساعدة

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

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

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

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

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

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.