Referencing the entire row in an insert trigger

I am trying to replace having to do the following sort of queries repeatedly by using a trigger to handle the second 2:
My first query inserts a row and the following 2 queries insert a reference to that row into 2 other tables
so I want to create a trigger which will insert the reference into the 2 other tables.
my problem: how do I get this reference in the trigger? I know I can get individual values using :NEW.Column but I can't seem to figure out how to get the whole row.
I can't select the row because its inside the trigger responding to it being inserted so I'd get that mutator error.

Not sure why I sql*plus gives those errors. I get the same.
When I tried to use
print_obj(:new.object_value);
heres the results
SQL> CREATE OR REPLACE TRIGGER TR_BOOKING_INS AFTER INSERT ON BOOKING
2 FOR EACH ROW
3 DECLARE
4 ecode NUMBER(38);
5 thisproc CONSTANT VARCHAR2(50) := 'trap_errmesg';
6
7 BEGIN
8 print_obj(:new.object_value);
9 EXCEPTION
10 WHEN OTHERS THEN
11 ecode := SQLCODE;
12 dbms_output.put_line(thisproc || ' - ' || ecode);
13 dbms_output.put_line('fucking errors');
14 END TR_BOOKING_INS;
15 /
Warning: Trigger created with compilation errors.
SQL> show err
Errors for TRIGGER TR_BOOKING_INS:
LINE/COL ERROR
6/5 PL/SQL: Statement ignored
6/5 PLS-00201: identifier 'PRINT_OBJ' must be declared
heres the results from 2 trigger attempts where I'm trying to do what I am wanting to do
SQL> CREATE OR REPLACE TRIGGER TR_BOOKING_INS
2 AFTER INSERT ON BOOKING
3 FOR EACH ROW
4 BEGIN
5 INSERT INTO TABLE(SELECT G.BOOKED_FOR FROM GUEST G WHERE G.GUEST_NO = :
NEW.GUEST_NO)
6 VALUES (:new.object_value);
7 EXCEPTION
8 WHEN OTHERS THEN
9 raise_application_error(-20001, 'Database Error');
10 END TR_BOOKING_INS;
11 /
Warning: Trigger created with compilation errors.
SQL> show err
Errors for TRIGGER TR_BOOKING_INS:
LINE/COL ERROR
2/5 PL/SQL: SQL Statement ignored
3/16 PL/SQL: ORA-00932: inconsistent datatypes: expected REF
DANIEL.BOOKING_TY got DANIEL.BOOKING_TY
SQL> CREATE OR REPLACE TRIGGER TR_BOOKING_INS
2 AFTER INSERT ON BOOKING
3 FOR EACH ROW
4 BEGIN
5 INSERT INTO TABLE(SELECT G.BOOKED_FOR FROM GUEST G WHERE G.GUEST_NO = :
NEW.GUEST_NO)
6 VALUES (REF(:new.object_value));
7 EXCEPTION
8 WHEN OTHERS THEN
9 raise_application_error(-20001, 'Database Error');
10 END TR_BOOKING_INS;
11 /
Warning: Trigger created with compilation errors.
SQL> show err
Errors for TRIGGER TR_BOOKING_INS:
LINE/COL ERROR
2/5 PL/SQL: SQL Statement ignored
3/19 PL/SQL: ORA-01747: invalid user.table.column, table.column, or
column specification
SQL>

Similar Messages

  • How to return the entire row from a table

    Hi guys,
    Tabl A
    FirstName varchar2(10),
    Age Number,
    Add varchar2(100),
    Table B
    Filedname varchar2(200), -- contains all the fields of table A
    Datatype varchar2(100), -- Contains the datatypes of the filedname
    Length Number -- contains the length of the fileds
    Now how can i return the entire row from table A with the datatype and its length.
    Any help would be appreciated ?
    Here is the query I wrote but it how to take the datatype and its length..
    create or replace procedure disp_table_data
    as
    type r_cursor is REF CURSOR;
    c_A r_cursor;
    er A%rowtype;
    begin
    open c_A for select * from A;
    loop
    fetch c_A into er;
    exit when c_A%notfound;
    dbms_output.put_line(er.FirstName||'--'||er.Age);
    end loop;
    close c_A;
    END;
    /

    Guys,
    I want column value from table A and its corresponding data_type and length from table B. I think I cant do it through joins.
    Any idea would be appreciated ?.
    Example ..
    Tabl A
    FirstName varchar2(10),
    Age Number,
    Add varchar2(100)
    insert into A values('John',24,'Boston');
    Table B
    Filedname varchar2(200), -- contains all the fields of table A
    Datatype varchar2(100), -- Contains the datatypes of the filedname
    Length Number -- contains the length of the fileds
    insert into B values('FirstName','varchar2',10); -- this is coming from table A.
    Output should be like this...
    John,Varchar2,10
    Here (John is the FirstName - coming from table A, Varchar2 is a Datatype and 10 is the Length which are coming from table B ). Only column values are coming from table A , corresponding datatype and length are coming from B.
    Any idea would be appreciated ?
    Thanks.

  • How can we pass the entire rows of a table to a web service in a VC model ?

    Hi,
    On the click of the submit button, I have to pass the rows of two tables into an enterprise service. This service also takes other fields of a form as an input.
    How can we pass the entire rows of a table into a service ?
    Regards,
    Nitin

    Hi Nitin,
    It seems that you have two or three different structures to pass data using your webservice. In your main question, two tables, you can join both in one table and from there call the webservice. In order to pass the entire table you need:
    1. Draw a line between your joinned table and your service,
    2. Map the fields,
    3. Create a 'SUBMIT' in your table tool bar. Right click on your table and choose 'Create Toobar', '+', name and choose 'Submit' as your event.
    4. Go to Configure Element (Table View) 'Multiple' at Selection Mode.
    Reward points if helps you to solve your question.
    Regards,
    Gilson Teixeira

  • Can i search a document for text in column a to return the entire row if column a matches in a separate sheet?

    Can i search multiple sheets in a document for text in column a to return the entire row if column a matches in a
    separate sheet?

    Thank you, Barry. That was helpful, and am hopeful that what I want to do is possible.
    I am creating a spreadsheet that currently has 20 sheets, of which certain sheets have more than one table.  I will be adding more sheets.  I would like to return results for all occurences of the search string.  Preferably into a seperate spreadsheet.  It would be perfect if that seperate sheet updated whenever I update information in the first spreadsheet.  To give an example:
    Sheet:     baskets
         Tables:         straw
                             wire
    Sheet:      barware
         Tables:          glasses
                              decanters
                              coasters
    My tables all have the same titiels:
    Vendor      Description     Cost     Selling Price
    Since I will have upwards of 100 sheets, with multiple tables, and most of my vendors will fit into multiple sheet categories, it would be helpful if I could also see what my order will be from each vendor, not just who I will be ordering each item from.  How would I do that? 
    I hope I conveyed that properly. 
    Thank you in advance for your help,
    Rana

  • Search the xml node by attributes and display the entire row

    I am having a table with two columns say
    school_name string type
    student_notebookprice xmldata
    how do i search with oracle query having student_id=102 and schoolname="abc_school" with notebook price 20, how do i get only one single row
    abc_school,
    <students>
         <student id="101">
         <notebookprice>12</notebookprice>
         </student>
         <student id="102">
              <notebookprice>20</notebookprice>
              <notebookprice>30</notebookprice>
              <notebookprice>40</notebookprice>
    </student>
    </students>
    def_school,
    <students>
         <student id="301">
         <notebookprice>10</notebookprice>
         </student>
         <student id="302">
              <notebookprice>15</notebookprice>
              <notebookprice>16</notebookprice>
    </student>
    </students>

    yes . what i want based on search criteria i need to display that row . initially i have tried with the below query
    SELECT school_name,
    extractvalue(value(x), '//id') as student_id ,
    extractValue(value(x), '//teacher') AS teacher
    FROM school t ,
    TABLE( XMLSequence( Extract(t.obj_xml, '/students/student[id=101 and teacher="abc"]'))) x
    where existsNode(t.obj_xml, '/students/student[id=101 and teacher="abc"]') = 1
    but when i want to add the second student in the search , i am failed to produce the second student information in the output and i can able to add it to where clause and but how to display the student info in the output . The xmltable option that u have specified looks good but what i fear is , it produce multiple combination with all the tags in the xml with the other columns in the table . will it cause any performence issue .
    <students>
    <student >
    <id>101</id>
    <teacher>abc</teacher>
    </student>
    <student >
    <id>102</id>
    <teacher>xyz</teacher>
    <teacher>onp</teacher>
    <teacher>rsm</teacher>
    </student>
    </students>
    SELECT school_name,
    extractvalue(value(x), '//id') as student_id ,
    extractValue(value(x), '//teacher') AS teacher
    FROM school t ,
    TABLE( XMLSequence( Extract(t.obj_xml, '/students/student[id=101 and teacher="abc"]'))) x
    where existsNode(t.obj_xml, '/students/student[id=101 and teacher="abc"]') = 1
    and existsnode(t.obj_xml, '/students/student[id=102 and teacher="xyz"]') = 1

  • Retrieving the entire row from ResultSet

    Hi All,
    I am using SQL database and wants to get the data from tables as rows instead of columns. Please let me know if any of you know how to retrieve the rows from table using ResultSet.
    Thanks.

    you would need a loop like this:
    for( int i = 0; i < resultset.getMetadata().getColumnCount(); i++ )
      System.out.print( resultSet.getXXX( i ) );
    }That will print out the row

  • To insert a new row in a table control without affecting the other rows

    Halo experts,
    I have a Table control TCTRL in a program .
    The lt_tab contains two cols A and B
    In change mode of the transaction Col A is in display mode and Col B is in change mode
    When i press the + button to insert a new blank entry .I need a blank row with both col A and col B input enabled w/o affecting the display of above and below rows of table control
    In PBO module of subscreen 101
    LOOP AT lt_tab  WITH CONTROL tctrl.
    MODULE tctrl_status.
    endloop.
    In the user command of 0101
    i am writn
    When 'INS'.
    INSERT INITIAL LINE INTO itab.
    Inside MODULE tctrl_status.
    IF lt_tab IS INITIAL.
        LOOP AT SCREEN.
          IF screen-name = 'COLA'.
          screen-input = 1.
      ENDIF.
        ENDLOOP.
          MODIFY SCREEN.
    endif.
    but the problem here is still the Col A is in display mode and Col B is in change mode after output
    .Here modify statement is happening but it does not update the TCTRL-COLS-Screen structure for the col A ( which I have set statically while designing the screen ).I dont want to make the entire row in edit mode only the inserted row ( for both Col A and Col B) and the rest shud remain as it is
    Thanks
    Kallu

    hi Naveen
    I have made my tctrl input disabled for both the columsn and
    I have a module before the PBO loop where I set the like
    module set_tctrl_status.
    IF gv_ok_code NE gc_disp.
        LOOP AT tctrl-cols INTO gs_cols.
          IF gs_cols-screen-name = 'ColB'.
            gs_cols-screen-input = 1.
            MODIFY tctrl-cols FROM gs_cols INDEX sy-tabix.
          ENDIF.
        ENDLOOP.
    This is just to set the Col B in edit mode when in change and create status.
    But if i press the INS button for that change i am coding inside the loop endloop of the pBO like
    if itab is initial.
    LOOP AT tctrl-cols INTO gs_cols.
    gs_cols-screen-input = 1.
    MODIFY tctrl-cols FROM gs_cols INDEX sy-tabix.
    endloop.
    But the problems i it is setting the enite rows as input enabled . I want tos et only that row inpur enabled

  • How to change the semantic color of entire rows in a table.

    Hi, in the past I already managed to change the semantic color of a cell by a condition (for example all the cells with negative number -> I set negative semantic color)
    My question is how can I change the semantic color of the entire row where this cell belong, and not only the cell. Im using NW2004.
    BTW, Im not a java programmer, neither a Webdynpro expert, just an ABAP Programmer. So try to be very explicit, Thx.

    Rodrigo,
    You can just bind correspondign property of every cell editor (TextView) of every column to the very same context attribute. Next, when you change attribute value for certain elemnt, the whole row (every cell editor in row) will get same value.
    Valery Silaev
    SaM Solutions
    http://www.sam-solutions.net

  • Need help in SQL Query: Update a row in a table & insert the same row into another table

    I want to update a row in a table say Table A and the updated row should be inserted into another table say Table B. I need to do it in a single SQL query and i don't want to do it in PL/SQL with triggers. And i tried with MERGE statement but its working with this scenario. (Note: I'm using Oracle Database 10g Enterprise Edition Release 10.2.0.1.0).
    Thanks in Advance.

    Using Sven's code as an example, you could save the updated row in a sql plus variable. (also untested):
    SQL> var v_id number
    update tableA  
    set colB='ABC' 
    where colC='XYZ' 
    returning id into :v_id;
    insert into table A_History (ID, colA, colB, ColC)  
    select id, ColA, ColB, ColC  
    from tableA  
    where id = :v_id;   

  • How can i find the latest row inserted in a table

    i have a table with five columns and there is no primary key and everyday 100's of rows will be inserted to this table ,infact by mistake i have inserted a row and i just want to find out which is the last row i have inserted in to this particular table is there any way to find out this please......

    That's not guaranteed to give you the latest row added to the table. Oracle could place new rows anywhere depending on what happened to rows in the table previously, what space is available in the tablespace etc etc:
    SQL> create sequence dt_test_rowid_seq start with 1 increment by 1;
    Sequence created.
    SQL>--generate some test data
    SQL> CREATE TABLE dt_test_rowid as
      2  select     object_id,
      3     object_name,
      4     dt_test_rowid_seq.nextval ins_sequence
      5  from
      6     dba_objects
      7  where
      8     object_id is not null
      9  and
    10     rownum <10000;
    Table created.
    SQL>--here, the latest addition to the table....
    SQL> select max(ins_sequence) from dt_test_rowid;
    MAX(INS_SEQUENCE)
                 9999
    SQL>... reflects the highest rowid
    SQL> select ins_sequence from dt_test_rowid where rowid=(select max(rowid) from dt_test_rowid);
    INS_SEQUENCE
            9999
    SQL>--get rid of a load of rows
    SQL> delete from dt_test_rowid where mod(object_id,2)=0;
    2521 rows deleted.
    SQL>--insert a load more
    SQL> insert into dt_test_rowid
      2  select     object_id,
      3     object_name,
      4     dt_test_rowid_seq.nextval ins_sequence
      5  from
      6     dba_objects
      7  where
      8     object_id is not null
      9  and
    10     rownum <1000;
    999 rows created.
    SQL>--and here the latest addition to the table...
    SQL> select max(ins_sequence) from dt_test_rowid;
    MAX(INS_SEQUENCE)
                10998
    SQL>--...is NOT reflected by the highest rowid
    SQL> select ins_sequence from dt_test_rowid where rowid=(select max(rowid) from dt_test_rowid);
    INS_SEQUENCE
            9999

  • Spreadsheet question: How to apply formula to entire row?

    I am updating cells which already contain formulas. Can I select the entire row, and apply an additional formula (i.e.: 1.5*) or do I have to do it individually for each cell (there are hundreds)? I need the original formulas to stay in place, and they vary.

    Hi Pamela,
    Welcome to Apple Discussions and the AppleWorks forum.
    (The following was begun before Niel's post, and completed, with a few breaks, some time after it. It addresses a shortcoming with the solution suggested above, so I haven't altered it beyond adding this paragraph.)
    I'm not certain as to exactly what you're requesting here. Do you mean you currently have the same formula in these cells (eg. =(A1-A2) ) and you want to change all of those formulas to (same eg. =1.5*(A1-A2) ). That's cetainly possible if the formulas are in contiguous cells (or in separater groups of contiguoous cells). For the example, select the first cell containing the formula and all the others contiguous to it. Make the change in the entry box, then press command-R to fill the changed formula to selected cells in the same row and to the right, then command-D to fill the formula to all selected cells below the row containing the edited cell.
    OTOH, if you want to make the change to separate (ie. non-contiguous) cells, or to cells which do not contain what's essentially the same formula (with only the cell references changed to reference a cell located in the same relative position), I don't see any way to do it directly within the spreadsheet.
    If the existing formulas are such that you can write a description of where to insert the change, it may be possible to make such a global change through an AppleScript, or through transferring the spreadsheet content to a word processing document, using Find/Change to make the revisions there, then transferr the result back to the spreadsheet (or more cautiously, to a new spreadsheet).
    An AppleScript is someone else's territory. Here's how it could be done using the word processor.
    For the example, I'll assume you want to change ALL formulas in the spreadsheet by adding the instruction to multiply the (result of the) current calculation by 1.5.
    • Open the spreadsheet.
    • Go Options > Display...
    • Check the box "Formulas", Click OK.
    • Select ALL of the cells containing data or a formula.
    • Copy.
    • Open a new word processing document.
    • Paste.
    • Press command-F to open the Find/Change dialogue.
    • Enter "=" in the Find box, press tab, enter "=1.5*" in the Change box (no quotes in either case).
    • Click Change All. OK the two alerts that follow. Close the Find/Change dialogue.
    • Press command-A to Select All. Copy.
    • Open a new spreadsheet document.
    • Paste.
    • Done.
    Limitation: This will work only if the amended formula will give the expected result. Consider the example above, =(A1-A2) with 2 in A1 and 1 in A2.
    As written, the original formula ( =(A1-A2) ) returns a result of "1", and the amended formula ( =1.5*(A1-A2) ) returns the expected result 1.5.
    But it's unlikely the original will have included the parentheses,as they're not necessary to a correct result.
    If the original is =A1-A2, the result is still 1, but the amended formula ( =1.5*A2-A1 ) will return the result "2", not 1.5.
    Revising the beginning of the altered formula to add an opening parenthesis is easy. The difficulty here is telling Find/Change (or AppleScript) how to add the matching closing parenthesis to fomulas but not to the contents of cells containing labels, other text, or nothing at all..
    *An alternate approach:* Rather than revising the existing spreadsheet's formulas, this method transfers the labels and results to a new section of the spreadsheet, multiplies the original results by 1.5, and displays the new result.
    For discussion purposes, I'll assume the current spreadsheet contains 25 columns (A..Y) and 100 rows (1..100) of data and labels.
    • Go Format > Document...
    • Change the default 40 cells wide to 52 (or enough to accomodate twice as many columns as you have containing data now).
    • Click OK
    • Select a cell to the right of the cells containing data in the current spreadsheet. (For the example, choose cell AA1)
    • Enter the following formula:
            =IF(ISTEXT(A1),A1,IF(ISBLANK(A1),"",A1*1.5))
    • Select the block of cells extending right and down from AA1 that matches the size of the original block (for the example, AA1..AY100).
    • Fill the formula Right (command-R) and Down (command-D).
    The formula will copy the text from cells containing text, keep cells blank ("") where the originals were blank, and enter the results, multiplied by 1.5, for cells where the originals contain a formula with a numerical result or a number.
    Limitation: The formula does not distinguish between an entered number and one generated by a formula contained in the referenced cell. All numeric values will be multiplied.
    Regards,
    Barry

  • How to delete the committed row from a table from its VOImpl class ??

    I am new to ADF and I have problem to solve. To perform roll back I am using fetching key before roll back and setting it after undo operation, so that I can stay back in the currently selected row. But in my case I am using application model commit for one LOV attribute selection in the row. So when ever I am performing roll back operation after inserting a row, the values other than this committed LOV attribute gets roll backed, but I need remove the entire row from table. Does there any option to remove a row based on the attribute values of a row from VO's row implementation or from bean class in a performance optimized way ?
    Thanks in advance..........

    http://java.sun.com/javase/6/docs/api/javax/swing/table/DefaultTableModel.html#removeRow(int)
    Why did you mark it answered but gave no dukes to finalight? That's not how it works.
    You should mark his answer as correct and give him at least one duke, for the effort!

  • Problems copying a row and pasting it in the following row

    Hi all,
    In a Numbers table I have 400 rows with data separated each one by a blank row
    row 2 has data
    row 3 is blank
    row 4 has data
    row 5 is blank ... and so on.
    I have prepared a small script to copy row 2 into row 3, row 4 into row 5,... as follows:
    set dName to "Conta"
    set sName to "Movis"
    set tName to "Pruebas"
    set row_ini to 2
    tell application "Numbers" to tell document dName to tell sheet sName to tell table tName
    set selection range to row row_ini
    repeat
    if value of first cell of selection range = 0 then
    exit repeat
    else
    tell application "System Events"
    keystroke "c" using {command down}
    keystroke return
    keystroke "v" using {command down}
    end tell
    tell first cell of the selection range to set rowNum to address of its row
    set selection range to row (rowNum + 1)
    end if
    end repeat
    end tell
    The idea is:
    1 select the initial row (in this case row 2)
    2 check if the value of first cell of the row is cero, then exit the repeat loop
    3 else
    4 copy the entire row, move down a row and paste.
    5 move to the next row
    6 repeat
    The first time I run the script it worked until the row 124 and stopped. I tried again changing the inicial row and it worked only for 7 rows. The third time it erased all the cells with data. I've tried closing both the table and the script but the problems persists: in this case it stops after replacing 5 rows.
    Where am I wrong?
    Thank you in advance
    Ratz

    KOENIG Yvan wrote:
    There is not such a book.
    There is just on short chapter dedicated to iWork in :
    Hanaan Rosenthal & Hamish Sanderson, Learn AppleScript: The Comprehensive
    Guide to Scripting and Automation on Mac OS X, Third Edition, Apress (2010);
    ISBN 978-1-4302-2361-0
    You may find useful infos in my idisk :
    <http://public.me.com/koenigyvan>
    Scan the contents of the folder :
    For_iWork:iWork '09:for_Numbers09.
    I guess the problem is for using the tell application block without telling the process Numbers.
    No, I had to change a lot of things.
    the name of the document was wrong (at least on my machine on which I always use the name extension.
    set selection range … was wrong.
    Yvan KOENIG (VALLAURIS, France) dimanche 20 février 2011 23:02:35
    Thank you.
    Visiting your idisk I realise how much work I must do to become a decent scripter!
    The book you mention looks interesting. I'm going to include it in my bookcase (and read it, of course).
    Ratz

  • How to highlight the entire folder with the tag color, as before?

    I've always highlighted important folders with colors, so that they stand out among others in a list for quicker access. Now in Mavericks list view, there is only a small color dot to the right of the folder's name (sometimes very far from the folder's name if the column is large). As a result, it is much harder to pick important folders. Is there any way to apply the tag color to the whole folder, as it used to be in all previous systems? Or at the very least, to move the dot to the left of the folder name within lists, as in Icon view? I really hope Apple did not remove this feature simply for the sake of design. Thanks.

    mistersquid, S. G. is actually referring to the new Tags feature in Mavericks. This replaces entirely the Labels feature in previous versions of the OS, as far as I can tell.
    Labels would let you apply a color highlight to a folder. It would appear as a color behind the entire row.
    With Mavericks, however, Labels are gone and are replaced with Tags, which just puts a small colored dot off to the right of the folder name (and it's always like this, not just when you click on the folder), and some of these aren't distinct enough from one another (i.e. purple and gray look almost identical if you're scrolling through a series of "gray" folders pretty quickly—you may miss that one purple dot). Also, like S. G. mentioned, these can be pretty far off in your periphery if you've got long folder names, so this just adds another level of "hard-to-see-ness" (it's a technical term ).
    I'm a graphic designer and I have been using Labels to colorize my job folders according to their current status. For example:
    No label = job is open/in progress.
    The next color schemes were more of a "stop light" effect, going from red to green:
    Red = job is approved. Prep final files and send to printer/client.
    Yellow = job is done. Prepare job ticket/calculate time for billing.
    Green = job is done and job ticket is ready to go (hence the green color) to my co-worker for billing/invoicing.
    Gray = job is finished/billed/closed (i.e., I've "grayed it out").
    Purple = job transferred to another co-worker (i.e., I got too busy and they're working on it now). This one is a rarer color, and with Tags it's a bit difficult to discern one or two purple (more like a light lavender) dots in a sea of gray ones.
    I agree with S. G. and would love to see a stronger means of identifying the status of a project at a glance reappear—perhaps as a selectable alternative to Tags in the Finder preferences (because I can definitely see how the two means of colorizing a folder could compete with one another), like a checkbox to the effect of "Use Labels instead of Tags," similar to the "Open folders in tabs instead of new windows" option.
    Feedback submitted. Thanks, yodathejedi, for the link.
    Message was edited by: Xiebinrui -- oops, duplicated word. Fixed!

  • I need to add the Dynamic rows in the Jform

    {color:#800000}*I have used Jform in the net beans... when the submit button i clicked then the dynamic rows should be inserted.. how can do that... i have used DefaulttableModel but in netbeasns it is not supporting i dont know how to add please tell me where i have to add the changes*{color}

    vidhyaprakash wrote:
    I have used Jform in the net beans... What is a Jform?
    when the submit button i clicked then the dynamic rows should be inserted.. Is this Swing coding? When I think of submit buttons, I usually think of Java Server Pages.
    In other words, if possible, please clarify your question as details matter here. Also, showing the code you've tried would help too.
    Good luck.

Maybe you are looking for