Get the primary key of entry just created by submitting the form

Hi guys,.

I have a form built in APEX based on a table. The PK is generated by the sequence and the values of the form are recorded by DML (insert).

Do I have to do is once I have create a new entry with my, I need to update a whole bunch of other tables with the new PK that I can easily do this by creating a process of PL/SQL after DML.



However, I need the primary key generated by the new entry (created by filling out the form + submit).

One way around it is
Select max(userid) from user
to retrieve it, but I don't know if it's a good idea/practice.

Any idea guys? See you soon.

Taepodong wrote:
Hi guys,.

I have a form built in APEX based on a table. The PK is generated by the sequence and the values of the form are recorded by DML (insert).

Do I have to do is once I have create a new entry with my, I need to update a whole bunch of other tables with the new PK that I can easily do this by creating a process of PL/SQL after DML.

However, I need the primary key generated by the new entry (created by filling out the form + submit).

One way around it is

Select max(userid) from user

to retrieve it, but I don't know if it's a good idea/practice.

This will only give the maximum ID and not currently generated ID

Any idea guys? See you soon.

Use this feature APEX
Change your page > change you the DTF process for the form > Enter you page back key point in the element (this returns the new pk value generated by this form)

Tags: Database

Similar Questions

  • After installing acrobat DC... Get the form of acceptance of the user... It's long, I can't bring up the line ACCEPT... I'm doing the smaller characters, and so I can't read it!  Help

    After the upgrade and installation of acrobat DC... Get the form of acceptance of the user that is long enough.  I need to indicate that I AGREE to the terms, but in order to get at the end of the form, I do feel so small, I don't see the I AGREE button.  Help

    Hello

    The agreement is a bit long, are you not able to scroll down?

    Not even arrow keys on the keyboard?

    Concerning

    Sukrit diallo

  • How to refer to the primary key column of newly inserted rows of tabular form

    Hello

    I use APEX 4.2.0.00.27 with Oracle DB 11.2.0.3.0.

    I work with a tabular presentation wizard-created for insert and update a table using the integrated SRM process (sequence 10).  I'm trying to use a process of anonymous block of PL/SQL (sequence 30) to make another manipulation of table after the records were inserted or updated.  The manual process is associated with my tabular form and I use the variables of name of column binding in my program block.

    My (rsn_test) table has 3 columns: test_id (number), test_nbr (number), test_id2 (number).  Test_id column is identified as the primary key and the type of the source already exists a sequence rsn_test_seq.  Column test_id2 gets its default value 0 to a hidden page element.

    I would use my manual process for updating the value of the test_id2 column.  If it's 0 then I want to put the value of the column test_id.  If it is any other value, then it must remain at this value.  My logic works very well for an existing line, but I'm running into a problem with the newly added lines.  The new lines get inserted, but the test_id2 column remains the default value 0.  I can tell the debugger that the SRM process is triggered first and inserts the line, then my manual dealing with fires.  The problem seems to be that the connection variable: TEST_ID for the primary key column remains NULL after insertion.  I don't know how to get the value of the column test_id of my newly created line to use in my PL/SQL block to my update.

    Process of PL/SQL:

    DECLARE
    BEGIN
       :P7_SHOW := NULL;
       :P7_SHOW := NVL(:TEST_ID2,555) || ' and ' || NVL(:TEST_ID,787) || ' and ' || NVL(:TEST_NBR,9999);
       IF :TEST_ID2 = 0 AND :TEST_ID IS NOT NULL THEN
          UPDATE rsn_test
             SET test_id2 = :TEST_ID
           WHERE test_id = :TEST_ID;
       ELSE
          :TEST_ID2 := :TEST_ID2;
       END IF;
    END;
    
    

    Excerpt from the debugger:

    0.01625 0.00010 Processes - point: ON_SUBMIT_BEFORE_COMPUTATION
    0.01635 0.00008 Branch point: Before Computation
    0.01643 0.00003 Process point: AFTER_SUBMIT
    0.01646 0.00022 Tabs: Perform Branching for Tab Requests
    0.01668 0.00008 Branch point: Before Validation
    0.01676 0.00024 Validations:
    0.01700 0.00135 Perform basic and predefined validations:
    0.01835 0.00020 Perform custom validations:
    0.01855 0.00049 ...Validation "TEST_NBR must be numeric" - Type: ITEM_IS_NUMERIC
    0.01904 0.00007 ......Skip for row 1 because row hasn't changed
    0.01911 0.00016 ......Skip for row 2 because row hasn't changed
    0.01927 0.00012 ...Validation "TEST_ID2 must be numeric" - Type: ITEM_IS_NUMERIC
    0.01939 0.00007 ......Skip for row 1 because row hasn't changed
    0.01945 0.00018 ......Skip for row 2 because row hasn't changed
    0.01964 0.00005 Branch point: Before Processing
    0.01968 0.00004 Processes - point: AFTER_SUBMIT
    0.01972 0.00588 ...Process "ApplyMRU" - Type: MULTI_ROW_UPDATE
    0.02560 0.00154 ...Execute Statement: declare function x return varchar2 is begin begin for c1 in ( select "RSN_TEST_SEQ".nextval pk from sys.dual ) loop return c1.pk; end loop; end; return null; end; begin wwv_flow.g_value := x; end;
    0.02714 0.00140 ......Row 3: insert into "APPPCSRSN"."RSN_TEST" ( "TEST_ID", "TEST_NBR", "TEST_ID2") values ( :b1, :b2, :b3)
    0.02854 0.00011 ...Process "ApplyMRD" - Type: MULTI_ROW_DELETE
    0.02865 0.00004 ......Skip because condition or authorization evaluates to FALSE
    0.02869 0.00015 ...Process "Process Submit" - Type: PLSQL
    0.02884 0.00007 ......Skip for row 1 because row hasn't changed
    0.02891 0.00012 ......Skip for row 2 because row hasn't changed
    0.02903 0.00012 ......Process row 3
    0.02915 0.00429 ...Execute Statement: begin DECLARE BEGIN :P7_SHOW := NULL; :P7_SHOW := NVL(:TEST_ID2,555) || ' and ' || NVL(:TEST_ID,787) || ' and ' || NVL(:TEST_NBR,9999); IF :TEST_ID2 = 0 AND :TEST_ID IS NOT NULL THEN UPDATE rsn_test SET test_id2 = :TEST_NBR WHERE test_id = :TEST_ID; ELSE :TEST_ID2 := :TEST_ID2; END IF; END; end;
    0.03344 0.00013 ...Session State: Saved Item "P7_SHOW" New Value="0 and 787 and 1300"
    0.03356 0.00004 Branch point: After Processing
    0.03360 0.00048 ...Evaluating Branch: "AFTER_PROCESSING" Type: REDIRECT_URL Button: (No Button Pressed) Condition: (Unconditional)
    0.03407 0.00013 Redirecting to f?p=290:7:8717971109610:::::&success_msg=0%20row(s)%20updated%2C%201%20row(s)%20inserted.Success%2FEBD244168556408CBA714E3974918C09%2F
    0.03420 0.00012 Stop APEX Engine detected
    0.03432 0.00007 Stop APEX Engine detected
    0.03439 - Final commit
    
    

    Any suggestions?

    I have run tests on

    https://apex.Oracle.com/pls/apex/f?p=83488:1 demo/demo

    to see your problem.

    I have 2 solution for your problem.
    I add trial NOT tabular just usual block of PL/SQL

    BEGIN
    I'm IN (SELECT TEST_ID FROM RSN_TEST WHERE TEST_ID2 = 0)
    LOOP
          UPDATE RSN_TEST
             SET test_id2 = TEST_ID
           WHERE test_id = i.TEST_ID;
      END LOOP;
    END;

    and works very well, you can see in the sample.

    The other solution is to show new generated TEST_ID

    Adding a sequence as a default value for a column in a table field

    And to execute your procedure.

    I get how is with the good luck of time.

    By

  • How can I get the Form Server 5.0 / LiveCycle software license key?

    I have the Form Server 5.0 software and need to get my license key to install on a different server. I looked at the LWS site and found a 2003 dated maintenance renewal. How can I get the license for this product?

    Please contact the customer service

  • Get the former locations of the data files and Redo logs

    Version: 11.2
    Platform: Solaris 10

    When we manage hundreds of DBs, we do not know the locations of all DB files these allows DBs. say a DB goes down and you have all the required RMAN backups.

    When you restore the DB in a new location in the path of the new server, you must run the commands for the data files and ORLs below. But how do we know

    The former location of the data files.

    B. the old location of redo online stores that I can run

    run
    alter database rename file 'oldPath_of_OnlineRedoLogs' to 'newPath_of_OnlineRedoLogs' ;  --- Without this command , the restored control file will still reflect the old control file location
    run {
    set newname for datafile 1 to '/u04/oradata/lmnprod/lmnprod_system01.dbf' ;
    set newname for datafile 2 to '/u04/oradata/lmnprod/lmnprod_sysaux01.dbf' ;
    set newname for datafile 3 to '/u04/oradata/lmnprod/lmnprod_undotbs101.dbf' ;
    set newname for datafile 4 to '/u04/oradata/lmnprod/lmnprod_audit_ts01.dbf' ;
    set newname for datafile 5 to '/u04/oradata/lmnprod/lmnprod_quest_ts01.dbf' ;
    set newname for datafile 6 to '/u04/oradata/lmnprod/lmnprod_yelxr_ts01.dbf' ;
    .
    .
    .
    .
    .
    }

    Hello

    With the help of Oracle 11.2, you can use feature 'set newname for database' using OMF.

    SET NEWNAME FOR DATABASE TO '/oradata/%U';
    RESTORE DATABASE;
    SWITCH DATAFILE ALL;
    SWITCH TEMPFILE ALL;
    RECOVER DATABASE;
    

    After the restore and recover databases (i.e. before resetlog open) you can do to rename redolog. Just a query column member from v$ logfile and deliver ' alter database rename file 'oldPath_of_OnlineRedoLogs' to 'newPath_of_OnlineRedoLogs ';

    When we use the DSO is much easier to use OMF because Oracle automatically creates the directory structure.
    But when we use the file system that the OMF does not serve due DBA dislikes system generated on file system names.

    If you don't like OMF file system, you can use the script on thread below to help restore you using readable for datafile names, tempfile, and redo.

    {message: id = 9866752}

    Kind regards
    Levi Pereira

  • Cannot get the form online to display the symbol '%' or correct precision - 11.1.2.3

    Hello

    I have a member in Sun accounts is just a pilot.   It has the property of "percentage" tag to it.  In the online form on the "other Options tab in the section of precision, I have values of percentage of value: Minimum = 0 = 6 Maximum."

    When I goto the online form, I enter 2.123456.  He appears in the form 2.   It should be view 2.123456%

    Is this a bug or I do something wrong?

    You have defined the order of evaluation? Classic > Administration > manage Dimensions > evaluation order > dimension of shifting to the right > save

    See you soon

    John

    http://John-Goodwin.blogspot.com/

  • Need JavaScript to get the forms box size

    Hello

    I need a JavaScript to get the box size. For example, I have a 100 boxes in a PDF form, and according to our concept, the size of appearance of checkboxes must be 10. and if I check one by one, then it is a tedious process. So I have a java Script to which I get all the box size of appearance in a console.

    Try this:

    for (var i = 0; i)

    var f = this.getField (this.getNthFieldName (i));

    If (f == null) continue;

    "If (f.type! ="checkbox) ' continue;

    Console.println (f.name + ":" + f.textSize);

    }

  • How can I get the form of circle on my brush tool?

    My brush tool became a little focus and cannot return to a circle. How can I reset?

    Press the "Caps Lock" key while using one of the brushes. It alternates between a circle and a view in the form of cross.

    If it's always bad when opening Photoshop change in the default behavior in Edit--> preferences--> cursors. Here, you can select 'normal brush tip.

  • Difficulties in getting the forms of work

    Can someone help me understand why my forms do not work on this new site? http://www.philasecurities.com/membership.html

    I can not even open the files PHP of test on the server: http://www.philasecurities.com/cgi-bin/php_mail_test.php

    I asked the host if they have special requirements, but since it is a revision of a previous site where the forms worked very well I don't know what is happening. If all goes well, he will miss just something simple.

    Thank you

    John

    Think it has something to do with trying to navigate in the cgi file?

  • How to get the form online to send e-mail?

    Hello

    I have a bit of HTML knowledge and trying to learn more through tutorials... but I can't find the flaw in this piece of code:

    < FORM METHOD = POST ACTION = "mailto: " [email protected] "ENCTYPE =" text/plain"> "

    < class p = "bodytext" > name

    < input type = "text" name = "name" / >

    < br / >

    < br / >

    E-mail

    < input type = "text" name = "email" / >

    < /p >

    < p > < span class = "bodytext" > phone

    < input type = "text" name = "phone" / >

    < br / >

    < br / >

    Address

    < input type = "text" name = "address" / >

    < br / >

    < br / >

    Zip code

    < input type = "text" name = "PostalCode" / >

    < br / >

    < br / >

    Inquiry details < br / >

    < br / >

    < name = textarea rows 'COMMENTS' '3' = >

    < / textarea >

    < input name = "redirect" type = "hidden" value = "index.php" / > "

    < input name = "NEXT_URL" type = "hidden" value = "index.php" / > "

    </span > < br / >

    < br / >

    < input type = "submit" value = "Send" / >

    < input type = "reset" value = "Clear" / >

    < /p >

    < / make >

    I want this e-mail comment to the email... but instead it opens just the client of e-mail with the text in it?

    I didn't do this kind of form for years because I can just never get to work, but I think it's time I learned what I am doing wrong!

    "mailto:" is a command for your operating system open the default e-mail program.

    Contact forms are better handled by a PHP script or CGI - BIN script on the server.

    In addition, a "mailto:" is an open invitation to "spammers" who hit your site and suddenly you get all offers of credit to "good male enhancement drugs" report

    Check with your hosting service to see what they offer for contact forms. Most offer PHP or CGI - BIN form processing or support them as part of your package.

    You can also check out services like mycontactform.com dealing with PHP and the CAPTCHA for free or for a small fee if you have a lot of traffic.

  • How to get the form background to display on the desktop to 100%

    Hello

    I'm building a site with Muse and although I chose px width 1330, but when I saw on my desk the blue form does not extend to 100%.

    Is there a way I can apply this?  Is it possible I can insert a CSS command which will set the background to the car on both sides?

    window spread.JPG

    According to your design just drag your right and left edges of your box from the edges of design view until you see a red line. Or select your blue square, and then click the button to the entire width of the toolbar.

  • How can I get the forms to print on the site of State tax?

    I upgraded my Firefox this morning. My forms don't print the reporting pages state that I use on a daily basis. What has changed?

    Hello, when printed pdf files come out white for your printer, it's currently a bug in firefox's built-in pdf viewer that is studied by our developers. in the meantime, you can use a plugin third pdf as Adobe that you can enable in the firefox options > applications -scroll down and set the default action for the portable document (pdf) format.

    How to disable the built-in PDF Viewer and use another Viewer

  • How to get the form of Boolean control LED (round or square) in Labview 8.6?

    Well, it's pretty simple...

    Can be any kind of response, error, errors, Style ID anything.

    But I can't seem to find an answer.

    Help, please

    Running of the tests here there seems to work

    Thanks for the help

    For one who also has to wonder how do:

    -First download the script from this link and follow the instructions to activate scripiting.

    https://decibel.NI.com/content/docs/doc-4973

    -After that, the Style ID will appear as a property on the property node

    -ID 21012 style is round LED and the 21013 is the square LED

    Also even if you do not have the active script and you have a VI recorded with the property Style ID node, you can copy and paste into your VI and who still works

  • Need to create a new line in the table with the same data as the primary key, but new PK

    Hello gurus,

    I have a table with a column as a primary key, I need to create a new row in the table, but with the same data in one of the lines, but with different primary keys, focus a double row with key primary diferent...

    Any ideas of how it can be done without much complication?

    Thanks in advance for your answer.

    Agress,
    Karim idrissi

    user9970447 wrote:
    Hello gurus,

    I have a table with a column as a primary key, I need to create a new row in the table, but with the same data in one of the lines, but with different primary keys, focus a double row with key primary diferent...

    Any ideas of how it can be done without much complication?

    Thanks in advance for your answer.

    Agress,
    Karim idrissi

    something like

    insert into mytable values ('literal for new pk',
                                           select non-pk-1,
                                                    non-pk-2,
                                                    non-pk-n
                                           from mytable
                                           where pk-col = 'literal for existing pk')
    
  • How to specify the tablespace for a India primary key in create table statement

    How to specify the storage space for a primary key index in a create table statement?
    Does the following statement is true?
    CREATE TABLE 'GPS'||TO_CHAR(SYSDATE+1,'YYYYMMDD')
                ("ID" NUMBER(10,0) NOT NULL ENABLE, 
                "IP_ADDRESS" VARCHAR2(32 BYTE), 
                "EQUIPMENT_ID" VARCHAR2(32 BYTE), 
                "PACKET_DT" DATE, 
                "PACKET" VARCHAR2(255 BYTE), 
                "PACKET_FORMAT" VARCHAR2(32 BYTE), 
                "SAVED_TIME" DATE DEFAULT CURRENT_TIMESTAMP, 
                 CONSTRAINT "UDP_LOG_PK" PRIMARY KEY ("ID") TABLESPACE "INDEX_DATA"
                 )            
                 TABLESPACE "SBM_DATA";   
    Thank you

    Published by: qkc November 9, 2009 13:42

    As orafad noted, you can use the documentation using ESCALATION clause, i.e.

    SQL> ed
    Wrote file afiedt.buf
    
      1  CREATE TABLE GPS
      2              ("ID" NUMBER(10,0) NOT NULL ENABLE,
      3              "IP_ADDRESS" VARCHAR2(32 BYTE),
      4              "EQUIPMENT_ID" VARCHAR2(32 BYTE),
      5              "PACKET_DT" DATE,
      6              "PACKET" VARCHAR2(255 BYTE),
      7              "PACKET_FORMAT" VARCHAR2(32 BYTE),
      8              "SAVED_TIME" DATE DEFAULT CURRENT_TIMESTAMP,
      9               CONSTRAINT "UDP_LOG_PK" PRIMARY KEY ("ID") USING INDEX TABLESP
    ACE "USERS"
     10               )
     11*              TABLESPACE "USERS"
    SQL> /
    
    Table created.
    

    Justin

Maybe you are looking for