بسم الله الرحمن الرحيم , الحمد لله و الصلاة و السلام على رسول الله
تعديل الجدول
ALTER TABLE demo_products ADD ( last_updated_by varchar2 (35), last_updated_on timestamp (4) with local time zone )
إنشاء القادح
CREATE OR REPLACE TRIGGER "BI_product_info"
BEFORE INSERT OR UPDATE ON demo_product_info
FOR EACH ROW
BEGIN
IF (inserting) THEN
BEGIN
:new.Last_updated_by := nvl(v('APP_USER'), 'user');
:new.last_updated_on := systimestamp;
END;
ELSIF (updating) THEN
BEGIN
:NEW.Last_updated_by := nvl(v('APP_USER'), 'user');
:NEW.last_updated_on := systimestamp;
END;
END IF;
END;
** Attributes
Region Attributes: style=width:300px
** HTML Table Cell Attributes
style="color:#800517; font-weight: bold"
*** Do not forget to disable the tigger if you are going to upload data to your table:
ALTER TRIGGER bi_products DISABLE
APP_USER Syntax
Reference Type Syntax
- Bind variable
:APP_USER
- PL/SQL
V('APP_USER')
- Substitution string
&APP_USER.
Consider the following examples:
From within an HTML region:Hello you are logged in as &APP_USER.
Using PL/SQL:
htp.p('Hello you are logged in as'||V('APP_USER'));
As a bind variable:
SELECT * FROM some_table WHERE user_id = :APP_USER
No comments:
Post a Comment