Updated lines and default values.

This is my last thread for a while. My final problem with my apex application is related to the update of lines.

I have a tabular presentation to display several rows for a table and want to add a hidden 'updated_by' and 'last_updated' column. I put their default values such as user name and sysdate that work well for new records, but how each line to add these to existing records?

I use 4.02 on 11g.

Hi Craig,.

Have you considered using a trigger on the table instead of setting these values from the app? A few advantages are: less logical in the app, especially if these inserts/changes can come from several pages, and once the trigger is implemented it will define values independently from changes and insertions (your form, another form, a non-ApEx client app, etc.).

CREATE OR REPLACE TRIGGER biu_mytable
   BEFORE INSERT OR UPDATE
   ON mytable    REFERENCING NEW AS new OLD AS old
   FOR EACH ROW
BEGIN
   :new.updated_by := NVL(v('APP_USER'), USER);
   :new.last_updated := SYSDATE;
END biu_mytable;

Any insert or update triggers the shutter, define two columns. The NVL call handles the case when a customer non-ApEx brings the insert or update. If APP_USER has a value (ApEx logged-in user), the trigger uses it; Otherwise, it uses the database user ID.

Hope this helps,
John

If you find this information useful, please indicate the 'useful' or 'correct' post so that others benefit. *

Tags: Database

Similar Questions

  • updated line and insert them into another table with trigger.

    Hi guys I have a table that looks like this.
    CREATE TABLE TEST
      (
        "COL1" VARCHAR2(20 BYTE),
        "COL2" VARCHAR2(20 BYTE),
        "COL3" VARCHAR2(20 BYTE)
      )
    I'm going to insert the col1 and col2 values, but I need to get the value of column 3 of table 2 and then insert the complete record in table 3. I love doing that with a trigger. I get an error message and I can't for the life of me figuere out what im doing wrong.
    So here is my nonfunctional trigger.


    Here are the two table

    CREATE TABLE TESTTABLE
      (
        "COLUMN1" NUMBER(15,0),
        "COLUMN2" NUMBER(15,0)
      )
     
    
    Insert into TESTTABLE (COLUMN1,COLUMN2) values (1,5);
    HERE IS THE CODE OF THE TRIGGER
    CREATE OR REPLACE TRIGGER TRIGGER1 
    AFTER INSERT ON TEST 
    FOR EACH ROW 
    BEGIN
      update TEST
      SET COL3 = (SELECT COLUMN2 FROM TEST, TESTTABLE WHERE COLUMN1 = :new.COL1);
    END
    I get an error of trigger mutation that I tried the other iterations of the above but I'm not getting anywhere. I have dumb down my problem at these 3 table.
    Can someone point me in the right direction.

    You'll have to do some reading, but it comes down to process the data on education instead of line level.
    You may even be not at all a trigger.
    See:
    http://www.Oracle-base.com/articles/9i/mutating-table-exceptions.php
    http://asktom.Oracle.com/pls/asktom/asktom.download_file?p_file=6551198119097816936

  • line and the value of manual entry of a heat question

    I have a manual, I try to grab the empno in 1 column.and another question, I try to add as many lines one by one line, but could not draw.

    application:https://apex.oracle.com/pls/apex/f?p=70785:1:130100846235621:ADD_ROWS:NO:

    Details of the workspace: ram_r & d

    username/password: test/test

    Hi rihab,.

    I try to enter the empno in the 1st column

    You must use APEX_ITEM. TEXT to make your editable empno.

    Editing your app and now you can change the value.

    I think you have some trigger on empno auto generate the empno, who first then remove your value will be inserted.

    Also create a validation to check the unique number of the employee.

    and another question, I try to add as many lines as a rank but could not draw.

    You cannot add more than one column at a time according to your current code.

    First, you must present the new line, and then you can add the new line, you can't add more than one line at a time.

    Hope this helps you,

    Kind regards

    Jitendra

  • motion presets, the size of the stage and default values - help?

    Hello

    I put a predefined query (zoom in 3D) on the movie symbol instance. It worked great - it zooms well, and the body remained at the center of the stage for the entire animation, which is what I wanted.

    I realized that I needed to change the size of the stage, for reasons that I won't go into. I've converted the measure from the scene of the pixels in inches and resizes.

    Of course, all my graphics and authorities were now out of the Center. Realign and resizing of everything, I discovered that my instance with the preset of the motion had gone down is more centered on the stage. Now, he moves diagonally right down to the right of the scene when played. In fact, now whenever I use this particular preset on anything whatsoever, in this file, and again those, the same thing happens. It's as if the preset was changed permanently on my computer and go back to the default value.

    I tried to change the path image by image, but it makes a mess. I tried using the Subselection tool to change the path, but it is imprecise and does not work well.

    Does anyone have words of wisdom for me?

    Either way, I loaded that particular file on another laptop here at work who also has Flash Pro. Until I opened my file on this new computer, this predefined query worked well. Now that I opened this file in the new computer, this preset is messed up, even when I start a new file.

    I am really confused and frustrated; I'd be very happy any idea that anyone could offer me.

    Thanks in advance!

    Hi Quynh,

    Thanks for your response! I finally realized that I was wrong. Obviously, the preselections of movement (or less than for the zoom in 3D) are only designed to work with the default stage size. I had changed my stage size, so the screened numbers were all off. But that's okay - I used it as a template to create my own, and it came out great.

    Thank you!

    Holly

  • Ridge line with default values

    Hi friends I am using JDeveloper 11.1.1.3.I want to create a new line in a table .but this line must have some default values. As an attribute username, still need to show a default name. I need to write the ViewImpl method.

    According to [url http://download.oracle.com/docs/cd/E17904_01/apirefs.1111/e10653/oracle/jbo/server/ViewRowImpl.html#create (oracle.jbo.AttributeList documentation)] the, really want to do this by overriding the method create of the ViewRowImpl class (that is, assuming that in the VO is the right place).

    The Fusion developer [url http://download.oracle.com/docs/cd/E17904_01/web.1111/b31974/bcrules.htm#sthref794] Guide also shows you how to proceed at the level of the OS

    John

  • HierNodePropValue and default values

    New Local derived that inherits the property created for another hierarchy that makes reference to another local property in a different hierarchy of primary using HierNodePropValue. The alternative hierarchy contains nodes that do not exist in the primary. Why the default value of the new Local property does not override the default value of the property referenced if the node does not exist in the hierarchy of the primary?

    HierNodePropValue (PrimaryHier, PropValue (Core.Abbrev), Custom.TargetSystemMembership)

    Hello

    You will need to write a condition to manage, what happens is that when the node is not present in the primary it automatically will take the default value of the property available for the node in the hierarchy to spare.

    Also, since it is a derived local, I'm not sure if the legacy won't really make any sense. Or does?

    Thank you

    Denzz

  • update line and reset the value of the column

    I have table (CORS_MTR) with 3 columns...

    SEQ ID of the EPR the ID of the child / / desc
    100221one
    101222two

    new entry as 1 number , that means change the flow of child #

    102223three

    When I enter the new line in number of children 1 instead of 2 and then the values of the column (child id, desc) another need to be reset as...

    SEQ ID of the EPR the ID of the child / / desc
    100222two
    101221one
    102223three
    103224four
    SEQ PRT_ID CHILD_ID DESC_
    100 22 1 one
    101 22 2 two
    102 22 3 three

    declare

    number of p_seq: = 103;

    number of p_prt_id: = 22;

    number of p_child_id: = 1;

    p_desc varchar2 (25): = 'a ';

    Start

    Update cors_mtr

    set seq = case when child_id = p_child_id

    then seq + 1

    other seq - 1

    end

    where prt_id = p_prt_id

    and child_id (p_child_id, p_child_id + 1);

    insert into cors_mtr (seq, prt_id)

    values(p_seq,p_prt_id);

    Update cors_mtr

    Set child_id = (select max (child_id) + 1 of the cors_mtr).

    desc_ = (select to_char (to_date (max (child_id) + 1, 'J'), 'jsp') of cors_mtr)

    where child_id is null.

    end;

    SEQ PRT_ID CHILD_ID DESC_
    100 22 2 two
    101 22 1 one
    102 22 3 three
    103 22 4 four

    Concerning

    Etbin

  • HP Officejet Pro 8600 and default values of Open Office

    I bought this printer about 18 months ago and have used it several times to scan documents and convert them into editable text. Output to MS Word and was brilliant.

    I was recently required to install Open Office and since then, the printer ran out of this program. The result is a confused mess.

    How can I tell the printer to use MS Word and not Open Office?

    Thanks for your help.

    Hello

    Locate a document scanned with HP software in your Documents folder.

    Right-click on this file and select open with and click on choose the program by default, and then select the word in this list.

    If she's not licted, click on the browse option and choose WinWord.exe in the Program Files folder.

    Hope that helps,

    Shlomi

  • Want to change the WordPad default values for font size and line spacing

    I use WordPad quite heavily because it is simple and fast.  But the new version of W - 7 seems to not allow you to change the default values for the font, size and line spacing.  The default values are not suitable for a large part of what I do and I'd like to find a way of quickly and easily, either make the changes permanent or change this to open with a single click of mouse or at most two.  Any suggestions?

    It is the "best" solution to workaround.  After you change your Default.rtf custom, simply move it to your system32 directory and add the "Default.rtf" at the end of the location of your target on the property sheet for your file WordPad.exe.

    Every time that you open its default location in the directory c:\program files\windows NT\Accessoires WordPad.exe, it defaults to now your Default.rtf custom.

  • Permanantly disabling "Install Google Toolbar" and change the default value for future updates

    I use Adobe products for years and, in general, is that Adobe produces some really useful tools for users of computers and productivity.  Thereby, ever time I get notice of an 'Adobe Flash Player' update I have to answer the same questions during the update / install process.  During the installation of the installation application ask if I want to install the toolbar 'Google', and the default value is Yes, then I have to uncheck the box before installation or I receive the software on my system I do not want or do not want.  In addition, towards the end of the update, the installation application provides three options on future updates:

    (1) download and install automatically

    (2) ask before installing

    (3) never install...

    And each installation I have to uncheck the installation of "Google Toolbar" and tell them that Adobe 'ask me... ' "before you download and install future updates.

    Is it possible permanently disable toolbar Google and by default my response to the update download and install question to always be 'Ask Me' first?  Adobe's witnesses crossing the machine during this process, so please do not suggest that it is not possible.  Adobe simply needs to modify the setup package to find these cookies and apply preferences users for the installation process instead of constantly trying to push unwanted applications and choices to the user.

    The displayed offers are based on the OS and the browser used.  If the two of you are essentially correct, for the browsers you use.

    If you opt in background updates, update option = allow Adobe to install updates (recommended), Flash Player will be updated within 24 hours of a new version is released.  If you use several browsers that use different types of Flash Player (for example, IE & Firefox) all drive types are updated within 24 hours of the new versions available.

    If you opt in notification updates, update = option Notify me when updates are available, the update notification generally appears within 7 days of an update is available and it is after that the system was restarted or that you log on/off voltage.   Opting to put up-to-date will launch the browser to a download page to download and install Flash Player.  If you use several browsers that use different types of Flash Player (for example, IE & Firefox) as the type of player who set the notification of update is updated.  The other type of player is not updated.

    Essentially, opting in the background updates will update all types of drive on the system within 24 hours and avoids downloading accidentally offers from third-party vendors.

    Note: there are slight differences for OS X updated behaivour but since you have Windows I described the behavior under Windows.

  • I'm on Windows 10. A works fine until the update. How can I make Adobe Acrobat Reader (free verision) my default DC? Seems that the default value is E pdf and when I change the default in the flashes of screen reader and forms are in the same format. I ha

    I'm on Windows 10. A works fine until the update. How can I make Adobe Acrobat Reader (free verision) my default DC? Seems that the default value is E pdf and when I change the default in the flashes of screen reader and forms are in the same format. I rather Acrobat format if possible. Thank you

    Hello

    Could a right click on the PDF file > open with > choose program by default and select CD player as default PDF Viewer.

    You can do it from the control panel as well.

    This would make CD player as default PDF Viewer.

    Concerning

    Sukrit diallo

  • Default values for Insert and Update

    What is the default way the current sysdate to a date on one column table when you perform an insert or update via a form? And related to this, what is the best way by default of the current user (APP_USER) for a varchar2 column when you perform an insert or update via a form?

    For these columns, I want to display in a report, but they must be hidden on the form, because I have the default app to sysdate and APP_USER values. However, when I tried to use the default values in table in 'the default UI settings' and using either: APP_USER or & APP_USER or SYSDATE, it shows that this literal value on the form (element is not hidden while to debug it). It does not show the actual value, I would, like "user1". Does make sense?

    Thanks for your help.
    -Reid

    I think that the triggers are the best device.

    Scott

  • Mr President, how can I enter two rows at the same time with different default values that only the first line to use see?

    Mr President.

    My worm jdev is 12.2.1

    How to enter two rows at the same time with different default values that only the first line to use see?

    Suppose I have a table with four fields as below

    "DEBIT" VARCHAR2(7) , 
      "DRNAME" VARCHAR2(50),
      "CREDIT" VARCHAR2(7) , 
      "CRNAME" VARCHAR2(50),
    

    Now I want that when I click on a button (create an insert) to create the first line with the default values below

    firstrow.png

    So if I click on the button and then validate the second row with different values is also inserted on commit.

    The value of the second row are like the picture below

    tworows.png

    But the second row should be invisible. It could be achieved by adding vc in the vo.

    The difficult part in my question is therefore, to add the second row with the new default values.

    Because I already added default values in the first row.

    Now how to add second time default values.

    Concerning

    Mr President

    I change the code given by expensive Sameh Nassar and get my results.

    Thanks once again dear Sameh Nassar .

    My code to get my goal is

    First line of code is

        protected void doDML(int operation, TransactionEvent e) {    
    
            if(operation != DML_DELETE)
                 {
                     setAmount(getPurqty().multiply(getUnitpurprice()));
                 } 
    
            if (operation == DML_INSERT )
                       {
                               System.out.println("I am in Insert with vid= " + getVid());
                           insertSecondRowInDatabase(getVid(),getLineitem(),"6010010","SALES TAX PAYABLE",
                            (getPurqty().multiply(getUnitpurprice()).multiply(getStaxrate())).divide(100));      
    
                           }
    
            if(operation == DML_UPDATE)
                              {                                                    
    
                                 System.out.println("I am in Update with vid= " + getVid());
                             updateSecondRowInDatabase(getVid(),
                                 (getPurqty().multiply(getUnitpurprice()).multiply(getStaxrate())).divide(100));      
    
                              }                      
    
            super.doDML(operation, e);
        }
        private void insertSecondRowInDatabase(Object value1, Object value2, Object value3, Object value4, Object value5)
                  {
                    PreparedStatement stat = null;
                    try
                    {
                      String sql = "Insert into vdet (VID,LINEITEM,DEBIT,DRNAME,AMOUNT) values " +
                 "('" + value1 + "','" + value2 + "','" + value3 + "','" + value4 + "','" + value5 + "')";  
    
                      stat = getDBTransaction().createPreparedStatement(sql, 1);
                      stat.executeUpdate();
                    }
                    catch (Exception e)
                    {
                      e.printStackTrace();
                    }
                    finally
                    {
                      try
                      {
                        stat.close();
                      }
                      catch (Exception e)
                      {
                        e.printStackTrace();
                      }
                    }
                  }  
    
                  private void updateSecondRowInDatabase(Object value1, Object value5)
                  {
                    PreparedStatement stat = null;
                    try
                    {
                      String sql = "update vdet set  AMOUNT='"+ value5+"' where VID='" + value1 + "'";                     
    
                      stat = getDBTransaction().createPreparedStatement(sql, 1);  
    
                      stat.executeUpdate();
                    }
                    catch (Exception e)
                    {
                      e.printStackTrace();
                    }
                    finally
                    {
                      try
                      {
                        stat.close();
                      }
                      catch (Exception e)
                      {
                        e.printStackTrace();
                      }
                    }                  
    
                  }
    

    Second line code is inside a bean method

        public void addNewPurchaseVoucher(ActionEvent actionEvent) {
            // Add event code here...
    
            BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
                   DCIteratorBinding dciter = (DCIteratorBinding) bindings.get("VoucherView1Iterator");
                   RowSetIterator rsi = dciter.getRowSetIterator();
                   Row lastRow = rsi.last();
                   int lastRowIndex = rsi.getRangeIndexOf(lastRow);
                   Row newRow = rsi.createRow();
                   newRow.setNewRowState(Row.STATUS_NEW);
                   rsi.insertRowAtRangeIndex(lastRowIndex +1, newRow);
                   rsi.setCurrentRow(newRow);
    
                   BindingContainer bindings1 = BindingContext.getCurrent().getCurrentBindingsEntry();
                   DCIteratorBinding dciter1 = (DCIteratorBinding) bindings1.get("VdetView1Iterator");
                   RowSetIterator rsi1 = dciter1.getRowSetIterator();
                   Row lastRow1 = rsi1.last();
                   int lastRowIndex1 = rsi1.getRangeIndexOf(lastRow1);
                   Row newRow1 = rsi1.createRow();
                   newRow1.setNewRowState(Row.STATUS_NEW);
                   rsi1.insertRowAtRangeIndex(lastRowIndex1 +1, newRow1);
                   rsi1.setCurrentRow(newRow1);
        }
    

    And final saveUpdate method is

        public void saveUpdateButton(ActionEvent actionEvent) {
            // Add event code here...
    
            BindingContainer bindingsBC = BindingContext.getCurrent().getCurrentBindingsEntry();      
    
                   OperationBinding commit = bindingsBC.getOperationBinding("Commit");
                   commit.execute(); 
    
            OperationBinding operationBinding = BindingContext.getCurrent().getCurrentBindingsEntry().getOperationBinding("Commit");
            operationBinding.execute();
            DCIteratorBinding iter = (DCIteratorBinding) BindingContext.getCurrent().getCurrentBindingsEntry().get("VdetView1Iterator");// write iterator name from pageDef.
            iter.getViewObject().executeQuery();  
    
        }
    

    Thanks for all the cooperation to obtain the desired results.

    Concerning

  • HPMINI 110-3030NR UPDATE BIOS. "Sum of CMOS is invalid health check", check if the bios setings can change. ' RESET CMOS < 502 > reset to the default values.

    I; m getting this message during the installation of the new bios. my touch pad is going crazy, then I was told by hp to update bios F 0.6 to F06 f. However when I turn the computer back lights are not flashing and I get this message "CMOS is invalid health check sum", check if the bios setings can change. reset to default values". HP doesn't seem to know what the problem is. can anyone help. It's a netbook new, purchased in the States but in Malaysia now and he cannot return as too costly. Help, please...

    Please repost your request to the experts in the Forum for HP laptopcomputer laptop HP.  Thank you! Carey Frisch

  • What should I do for default values when a new line is created in a tabular presentation?

    Hello all-

    I have a tabular presentation that requires a few columns to be entered by the user when he or she creates a new line, but other fields in the column can just default to certain values.  How to set these values by default so that the user doesn't have to be bothered with enter no data except those which MUST be entered?

    An example:

    Form1

    CITY OF COUNTRIES IN THE REGION

    APAC JAPAN TOKYO

    SIDNEY AUSTRALIA, APAC

    APAC KOREA-SEOUL

    REGION is almost always APAC, then I want that by default.  The user can always adjust if necessary, but I want to put it to the user, only to save having to enter a value.  When the user clicks on the button to add a line, that I want to load this value immediately and leave the two empty fields so the user can enter what they want.

    Thank you!

    John

    Hello

    Go change this column.

    Under attributes of tabular form, you will find options to set the default value

    Kind regards
    Jari

Maybe you are looking for