Powered By Blogger

শনিবার, ১৭ জুন, ২০১৭

Procedure for System Record of Timestapping (created time)

PROCEDURE P_RecordHistory IS
  curr_block varchar2(30) := name_in('system.trigger_block');
  rec_status varchar2(10) := name_in('system.record_status');
BEGIN
    if rec_status = 'INSERT' then
        if not id_null(find_item(curr_block||'.'||'SS_CREATOR')) then
            copy(name_in('global.g_emp_no'), curr_block||'.'||'SS_CREATOR');
        end if;
        if not id_null(find_item(curr_block||'.'||'SS_CREATED_ON')) then
            copy(to_char(sysdate,'DD-MON-YYYY HH24:MI:SS'), curr_block||'.'||'SS_CREATED_ON');
        end if;
    elsif rec_status = 'CHANGED' then
        if not id_null(find_item(curr_block||'.'||'SS_MODIFIER')) then
            copy(name_in('global.g_emp_no'), curr_block||'.'||'SS_MODIFIER');
        end if;
        if not id_null(find_item(curr_block||'.'||'SS_MODIFIED_ON')) then
            copy(to_char(sysdate,'DD-MON-YYYY HH24:MI:SS'), curr_block||'.'||'SS_MODIFIED_ON');
        end if;
    end if;
    if not id_null(find_item(curr_block||'.'||'SS_OG_ON')) then
        copy(k_variable.og_no, curr_block||'.'||'SS_OG_ON');
    end if;
END;

Export Empty Table in Oracle 11G

/*ALLOCATE EXTENT  COMMAND TO EXPORT EMPTY TABLE*/ 
SELECT 'alter table ' ||  table_name || ' allocate extent;'
from dba_tables where SEGMENT_CREATED = 'NO';

বৃহস্পতিবার, ৮ জুন, ২০১৭

Record update with Timestamp

UPDATE table1 t1
   SET rec_sl =
          (SELECT rn
             FROM (SELECT ROWID,
                          ROW_NUMBER () OVER (ORDER BY ss_created_on) AS rn
                     FROM table1) t2
            WHERE t2.ROWID = t1.ROWID);

Row-level “Add” icon using a virtual column (APEX-safe)

1️⃣ Enable Insert in the Interactive Grid IG → Attributes Edit → Allowed Add Row → Yes 2️⃣ Add a New Column (Icon column) Column...