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

تخزين وقت الخروج من النموذج

Featured Replies

بتاريخ:

السلام عليكم
عند دخول اي مستخدم الى الفورم يسجل وقت الدخول والتاريخ واسم الفورم والعمليات التي قام بها من حذف وتعديل واضافة ولما يخرج من الفورم انا كاتب كود في الترجر key-exit من اجل تخزين وقت الخروج وهذا الكود
update user_events
set log_out_time =v_log_out_time
where user_name=:global.user_name and login_date=v_login_date and log_in_time=v_log_in_time and form_name=v_form_name;
commit_form;
طبعا المتغيرات معرفة وقيمها موجودة ويعمل صح وعند الخروج يخزن
ولكن المشكلة هو انني في نفس هذا الترجر كاتب كود بحيث اذا دخل المستخد الفورم وعمل تغييرات وخرج دون ان يعمل commit يساله الفورم اذا اراد التخزين اذا اختار نعم يعمل commit ويخرج واذا اختار لا يخرج من دون commit
المشكلة : هو اذا عمل تغييرات وكبس خروج ينفذ الترجر key-exit ويسجل وقت الخروج ويعمل commit ولا يساله طبعا هل تريد حفظ التغييرات لانه يكون نفذ جملة commitفي الاعلى
كيف ممكن احل المشكلة او وين ممكن اكتب الكود الذي يسجل وقت الخروج من الفورم غير هذا المكان لتفادي هذه المشكلة
مع جزيل الشكر

بتاريخ:

هلا اخي مبدأ يوجد حل لمشكلتك ولكن لا تنسي ان هذه الفكره اصلا بها مشاكل في حالة حدوث انهاء غير طبيعي للديفلوبر مثل حدوث اغلاق مفاجئ للفورمز او للجهاز
اما الحل فيكمن في انشاء داله باستخدام
PRAGMA AUTONOMOUS_TRANSACTION;
وهذا شرح سريع لها من اوراكل هيلب

A transaction is a series of SQL statements that does a logical unit of work. Often, one transaction starts another. In some applications, a transaction must operate outside the scope of the transaction that started it. This can happen, for example, when a transaction calls out to a data cartridge. 

An autonomous transaction is an independent transaction started by another transaction, the main transaction. Autonomous transactions let you suspend the main transaction, do SQL operations, commit or roll back those operations, then resume the main transaction. Figure 5-1 shows how control flows from the main transaction (MT) to an autonomous transaction (AT) and back again. 

Figure 5-1 Transaction Control Flow


Advantages of Autonomous Transactions
Once started, an autonomous transaction is fully independent. It shares no locks, resources, or commit-dependencies with the main transaction. So, you can log events, increment retry counters, and so on, even if the main transaction rolls back. 

More important, autonomous transactions help you build modular, reusable software components. For example, stored procedures can start and finish autonomous transactions on their own. A calling application need not know about a procedure's autonomous operations, and the procedure need not know about the application's transaction context. That makes autonomous transactions less error-prone than regular transactions and easier to use. 

Furthermore, autonomous transactions have all the functionality of regular transactions. They allow parallel queries, distributed processing, and all the transaction control statements including SET TRANSACTION. 

Defining Autonomous Transactions
To define autonomous transactions, you use the pragma (compiler directive) AUTONOMOUS_TRANSACTION. The pragma instructs the PL/SQL compiler to mark a routine as autonomous (independent). In this context, the term routine includes 

top-level (not nested) anonymous PL/SQL blocks 

local, stand-alone, and packaged functions and procedures 

methods of a SQL object type 

database triggers 

You can code the pragma anywhere in the declarative section of a routine. But, for readability, code the pragma at the top of the section. The syntax follows: 

PRAGMA AUTONOMOUS_TRANSACTION;


In the following example, you mark a packaged function as autonomous: 

CREATE PACKAGE banking AS
  ...
  FUNCTION balance (acct_id INTEGER) RETURN REAL;
END banking;

CREATE PACKAGE BODY banking AS
  ...
  FUNCTION balance (acct_id INTEGER) RETURN REAL IS
     PRAGMA AUTONOMOUS_TRANSACTION;
     my_bal REAL;
  BEGIN
     ...
  END;
END banking;


Restriction: You cannot use the pragma to mark all subprograms in a package (or all methods in an object type) as autonomous. Only individual routines can be marked autonomous. For example, the following pragma is illegal: 

CREATE PACKAGE banking AS
  PRAGMA AUTONOMOUS_TRANSACTION; -- illegal
  ...
  FUNCTION balance (acct_id INTEGER) RETURN REAL;
END banking;


In the next example, you mark a stand-alone procedure as autonomous: 

CREATE PROCEDURE close_account (acct_id INTEGER, OUT balance) AS
  PRAGMA AUTONOMOUS_TRANSACTION;
  my_bal REAL;
BEGIN
  ...
END;


In the following example, you mark a PL/SQL block as autonomous: 

DECLARE
  PRAGMA AUTONOMOUS_TRANSACTION;
  my_empno NUMBER(4);
BEGIN
  ...
END;
مع تمنياتي بالتوفيق

Restriction: You cannot mark a nested PL/SQL block as autonomous. 

In the example below, you mark a database trigger as autonomous. Unlike regular triggers, autonomous triggers can contain transaction control statements such as COMMIT and ROLLBACK. 

CREATE TRIGGER parts_trigger
BEFORE INSERT ON parts FOR EACH ROW
DECLARE
  PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
  INSERT INTO parts_log VALUES(:new.pnum, :new.pname);
  COMMIT;  -- allowed only in autonomous triggers
END;

Autonomous versus Nested Transactions
Although an autonomous transaction is started by another transaction, it is not a nested transaction for the following reasons: 

It does not share transactional resources (such as locks) with the main transaction. 

It does not depend on the main transaction. For example, if the main transaction rolls back, nested transactions roll back, but autonomous transactions do not. 

Its committed changes are visible to other transactions immediately. (A nested transaction's committed changes are not visible to other transactions until the main transaction commits.) 

بتاريخ:

السلام عليكم
هقولك فكرة بس موش جربتها بصراحة يعني ممكن تشتغل و ممكن لا
ضع الكود الذي يشيك ااذ كان عمل تغييرات فيسأل اذا كان يريد الحفظ ام لا قبل الكود الذي يسجل وقت الخروج
فاذا كان يريد الحفظ اعمل كوميت اما اذا كان لايردي الحفظ فاعمل rollback او clear_form; بدلا من الخروج من الفورم
قبل ان تسجل وقت الخروج و سيكون قد تم مسح التغييرات
ثم سجل وقت الخروج بعد هذه العملية
قولي لو جربتها كدة اشتغلت و لا لا
بالتوفيق

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

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

بتاريخ:

اخي الكريم
جرب كود تخزين الخروج في ترريجر post-logout
هذا التريجر ينفذ عند الخروج نهائيا من الفورم او لحظة الخروج
طبعا جرب التريجر على مستوى الفورم

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

السلام عليكم
اخي الكريم admin
وضعت كود التخزين على الترجر post-logout وما زبط اي ما خزن وقت الخروج
اما عندما كان في الترجر ke y-exit كان يخزن

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

مشكيرون يا شباب
نجت الطريقة اللي نصحني بها الاخ mustafa76 وهي اعادة ترتيب الكود كالتالي
declare
alert_number number;
v_login_date date;
v_log_out_time varchar2(100);
v_log_in_time varchar2(100);
v_form_name varchar2(100);

begin
global_pkg.set_log_out_time(to_char(SYSDATE,'hh24:MI:ss'));
v_log_out_time:=global_pkg.get_log_out_time;
v_login_date:=global_pkg.get_login_date;
v_log_in_time :=global_pkg.get_log_in_time;
v_form_name :=global_pkg.get_form_name;


------------------------------------------
if :system.form_status ='CHANGED' THEN
alert_number:=show_alert('exit_alert');
if alert_number=alert_button1 then
alert_number:=show_alert('save');
if alert_number=alert_button1 then
update user_events
set log_out_time =v_log_out_time
where user_name=:global.user_name and login_date=v_login_date and log_in_time=v_log_in_time and form_name=v_form_name;
commit_form;
exit_form;

elsif alert_number=alert_button2 then
update user_events
set log_out_time =v_log_out_time
where user_name=:global.user_name and login_date=v_login_date and log_in_time=v_log_in_time and form_name=v_form_name;
forms_ddl('commit');
exit_form(no_validate);
else
null;
end if;--end of save alert
end if;--end of exit alert

elsif :system.mode = 'ENTER-QUERY' then
Set_Block_Property(:system.cursor_block,CURRENT_RECORD_ATTRIBUTE ,'default');
exit_form;

else
update user_events
set log_out_time =v_log_out_time
where user_name=:global.user_name and login_date=v_login_date and log_in_time=v_log_in_time and form_name=v_form_name;
forms_ddl('commit');
exit_form;
end if;


end ;



/*declare
alert_number number;
v_login_date date;
v_log_out_time varchar2(100);
v_log_in_time varchar2(100);
v_form_name varchar2(100);

begin
global_pkg.set_log_out_time(to_char(SYSDATE,'hh24:MI:ss'));
v_log_out_time:=global_pkg.get_log_out_time;
v_login_date:=global_pkg.get_login_date;
v_log_in_time :=global_pkg.get_log_in_time;
v_form_name :=global_pkg.get_form_name;

update user_events
set log_out_time =v_log_out_time
where user_name=:global.user_name and login_date=v_login_date and log_in_time=v_log_in_time and form_name=v_form_name;

commit_form;

------------------------------------------
if :system.form_status ='CHANGED' THEN
alert_number:=show_alert('exit_alert');
if alert_number=alert_button1 then
alert_number:=show_alert('save');
if alert_number=alert_button1 then
commit_form;
exit_form;
elsif alert_number=alert_button2 then
exit_form(no_commit);
else null;
end if;
end if;

elsif :system.mode = 'ENTER-QUERY' then
Set_Block_Property(:system.cursor_block,CURRENT_RECORD_ATTRIBUTE ,'default');
exit_form;

else
exit_form;

end if;
end ;

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

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

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

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

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

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.