This discussion is archived
3 Replies Latest reply: Jun 15, 2013 11:49 PM by jariola RSS

apex WHO columns

kp2000 Newbie
Currently Being Moderated

Hello

I have a simple apex application.It is a user entry form. User enters the 2 fields. The other 4 fields are WHO columns. I have the following update statement.

 

User enters the value in the first 2 fields. Then when User clicks on SUBMIT button, underlying logic(as below) will insert 2 user entered columns and other 4 WHO columns in the table.

I can successfullyt enter first 2 columns but not the WHO columns.

 

UPDATE table t1 A

SET

--LOCATION_NUM=apex_application.g_f02(i)

CREATED_BY=HTMLDB_CUSTOM_AUTH.GET_USERNAME,

CREATION_DATE=SYSDATE,

LAST_UPDATED_BY=HTMLDB_CUSTOM_AUTH.GET_USERNAME,

LAST_UPDATED_DATE=SYSDATE

WHERE

A.LOCATION_NUM=:P2_LOCATION_NUM;

 

 

In specific, i want to know how to enter WHO columns along with the other 2 columns when i click SUBMIT button

please advise

 

thanks

kp

  • 1. Re: apex WHO columns
    jariola Guru
    Currently Being Moderated

    Hi,

     

    It might be best create database trigger to populate created_by and last_updated_by columns.

     

    CREATE OR REPLACE
    TRIGGER CFAWEB_PORTAL_EXCEPTIONS_TRG BEFORE
      INSERT OR
      UPDATE ON CFAWEB_PORTAL_EXCEPTIONS FOR EACH ROW
    BEGIN
      IF INSERTING THEN
       :NEW.CREATED_BY            := COALESCE(V('APP_USER'),USER);
       :NEW.CREATION_DATE        := SYSDATE;
       :NEW.LAST_UPDATED_BY        := COALESCE(V('APP_USER'),USER);
       :NEW.LAST_UPDATED_DATE    := SYSDATE;
      END IF;
      IF UPDATING THEN
        :NEW.LAST_UPDATED_BY        := COALESCE(V('APP_USER'),USER);
       :NEW.LAST_UPDATED_DATE    := SYSDATE;
      END IF;
    END;

     

    Regards,
    Jari

  • 2. Re: apex WHO columns
    kp2000 Newbie
    Currently Being Moderated

    Hi Jari

    Thanks a lot for the response.It helps me.

     

    One small help..please update table name to t1 in your reply.Hope you understand why i request this.

     

    thanks

    kp

  • 3. Re: apex WHO columns
    jariola Guru
    Currently Being Moderated

    kp2000 wrote:

     

    Hi Jari

    Thanks a lot for the response.It helps me.

     

    One small help..please update table name to t1 in your reply.Hope you understand why i request this.

     

    thanks

    kp

    Hi,

     

    Sorry, but I do not understand why.

     

    Regards,

    Jari