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

هل هناك حل لهذة المشكلة


molazwm

Recommended Posts

يا جماعة عاوز اعرف ال procedure بتاعي حاليا بينفذ اية (علشان اعرف هو بيتاخر في انهي مرحلة)
ال procedure يتكون من عدة جمل تنفذ update , ال body يشبة الاتي

begin
update employees set sal=1000 where employee_id =100;
"اريد هنا ان تظهر الرسالة التي تبين ان عملية ال update علي جدول ال employees انتهت"
dbms_output.put_line('the table employees is updated successfully');
update departments set location_id=2000 where department_id=120;
dbms_output.put_line('the table departments is updated successfully');
;end



المشكلة ان الرسائل بتظهر بعد الكود مايتنفذ و يكون الشكل كالاتي:

the table employees is updated successfully

the table departments is updated successfully

pl/sql  completed successfully



اللي عاوزة ان ال procedure يطلع الرسائل اولا باول

طبعا انا بكتب set serveroutput on في ال sessionاللي بنفذ من خلالها ال procedure

"انا حاليا الفكرة اللي عندي اني اعمل variable يتم وضع ال sysdate فية بعد كل عملية و اقوم بطبعة بعد كل عملية
و الكود سيكون كالاتي

declare
(xx varchar2(200;
begin
update employees set sal=1000 where employee_id =100;
select to_char(sysdate,'yyyy-mm-dd  hh24:mi:ss') into xx from dual;
(dbms_output.put_line(xx;
dbms_output.put_line('the table employees is updated successfully');
select to_char(sysdate,'yyyy-mm-dd  hh24:mi:ss') into xx from dual;
update departments set location_id=2000 where department_id=120;
dbms_output.put_line(xx)
dbms_output.put_line('the table departments is updated successfully');
end;



أعتقد ان فية عند اخوانا ذوي الخبرة حلول افضل اتمني منكم ان تمدوني بها و لكم جزيل الشكر

و السلام عليكم

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


DECLARE
V_CHANGE NUMBER;
BEGIN
UPDATE STATMENT .................................;
V_CHANGE=SQL%ROWCOUNT;
DBMS_OUTPUT.PUT_LINE(TO_CHAR(V_CHANG));
UPDATE STATMENT ..................................;
V_CHANGE=SQL%ROWCOUNT;
DBMS_OUTPUT.PUT_LINE(TO_CHAR(V_CHANG));
END;
/
[sql/]
بالتوفيق
رابط هذا التعليق
شارك

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

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

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

×   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.

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

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

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