Insert into a table using the check boxes

Hello

I want to insert into a table emp when I press a button "Insert" area of employee report. the SQL query for the report is

SELECT HTMLDB_ITEM. CheckBox(1,rowNum) "",
x.EmpNo,
x.Ename
de)
Select empno htmldb_item.hidden(2,empno),
htmldb_item. Text(3,Ename) ename from emp) x
order by 2

I created the following process:

declare
v_test varchar (10);
Start
BECAUSE me in 1.HTMLDB_APPLICATION. G_F01. COUNTY
LOOP
v_test: = HTMLDB_APPLICATION. G_F02 (HTMLDB_APPLICATION. G_F01 (i));
dbms_output.put_line (v_test);
insert into emp(empno,ename,job,mgr,hiredate,sal,comm,deptno)
values(v_test,'A','B',10,01-May-81,200,1,10)
WHERE empno = HTMLDB_APPLICATION. G_F02 (HTMLDB_APPLICATION. G_F01 (i));
END LOOP;
end;

But IT is not working properly, infact, it gives me errors like:

ORA-06550: line 9, column 47:
PL/SQL: ORA-00933: SQL not correctly completed command
ORA-06550: line 8, column 1:
PL/SQL: SQL statement ignored

7 dbms_output.put_line (v_test);
8 insert into emp (empno, ename, job, mgr, hiredate, sal, comm, deptno)
9 values(v_test,'A','B',10,01-MAY-81,200,1,10)
10 WHERE empno = HTMLDB_APPLICATION. G_F02 (HTMLDB_APPLICATION. G_F01 (i));
11. END OF LOOP;

Any help?
Additional info: table Emp is the default table in the database

This is an example showiing how such a process must be put in place:

http://Apex.Oracle.com/pls/OTN/f?p=31517:95

Denes Kubicek
-------------------------------------------------------------------
http://deneskubicek.blogspot.com/
http://www.Opal-consulting.de/training
http://Apex.Oracle.com/pls/OTN/f?p=31517:1
-------------------------------------------------------------------

Tags: Database

Similar Questions

  • Try to build the form using the check boxes - need help

    I am creating features using a region on the left to contain what I want (and it is stopped), an area on the right that contains all the rest I might add, with buttons in the middle to get things back (Add/Remove). I try to use the collections and APEX_ITEM. CHECKBOX and everything just do not have luck using the check boxes at all. Can someone tell me please a tutorial or an example that works in the way to read a collection by using the checkboxes and manipulate? Normally, I uses a FRONT of Validations process to update the collection with the changes that the user has provided, then follow up with any validations, then run any what DB written/modifications/deletions in a page AFTER VALIDATION process.

    Here's what I have so far:

    Area to the left (list of items already included in the package)

    (On the process of loading Page (before header) -: P182_PKG_ID is passed as input)
    apex_collection.create_or_truncate_collection
      (p_collection_name => 'DOCWIZ_CHKLST');
    
    declare
      v_lnid      NUMBER;
      v_ordr      NUMBER;
      v_pkg       NUMBER;
      v_type      NUMBER;
      v_typenm    VARCHAR2(47);
      cursor c_prepop is
        select a.ID, a.DOC_ORDER, a.DOC_PKG_ID, a.DOC_TYPE_ID, t.DOC_TYPE_NM
          from DOC_ASSIGN a, DOC_TYPE t
         where a.DOC_TYPE_ID = t.DOC_TYPE_ID
           and a.DOC_PKG_ID = :P182_PKG_ID
         order by a.DOC_ORDER;
    begin
      OPEN c_prepop;
        LOOP
          FETCH c_prepop into v_lnid, v_ordr, v_pkg, v_type, v_typenm;
          EXIT WHEN c_prepop%NOTFOUND;
          APEX_COLLECTION.ADD_MEMBER(
              p_collection_name => 'DOCWIZ_CHKLST',
              p_c001 => 0,          --CHKBX
              p_c002 => v_lnid,     --ID
              p_c003 => v_ordr,     --DOC_ORDER
              p_c004 => v_pkg,      --DOC_PKG_ID
              p_c005 => v_type,     --DOC_TYPE_ID
              p_c006 => v_typenm    --DOC_TYPE_NM
           );
        END LOOP;
      CLOSE c_prepop;
    end;
    Report area (column 2)
    SELECT apex_item.DISPLAY_AND_SAVE(1, SEQ_ID) SEQ_ID,
        apex_item.CHECKBOX(2, c001, 'UNCHECKED') CHKBX,
        apex_item.DISPLAY_AND_SAVE(3, c002) ID,
        apex_item.TEXT(4, c003, 3, 3) DOC_ORDER,
        apex_item.DISPLAY_AND_SAVE(5, c004) DOC_PKG_ID,
        apex_item.DISPLAY_AND_SAVE(6, c005) DOC_TYPE_ID,
        apex_item.DISPLAY_AND_SAVE(7, c006) DOC_TYPE_NM
      from APEX_COLLECTIONS
     where COLLECTION_NAME = 'DOCWIZ_CHKLST'
    Area to the right (complete list of topics already in the package possibilities)

    (On the process of loading Page (before header) -: P182_PKG_ID is passed as input)
    --Prep collection
    ---------------------------------------------
    apex_collection.create_or_truncate_collection
      (p_collection_name => 'DOCWIZ_TYPLST');
    
    declare
      v_lnid      NUMBER;
      v_ordr      NUMBER;
      v_pkg       NUMBER;
      v_type      NUMBER;
      v_typenm    VARCHAR2(47);
      cursor c_prepop is
        select 0, 0, :P182_PKG_ID, t.DOC_TYPE_ID, t.DOC_TYPE_NM
          from DOC_TYPE t
         where t.DOC_TYPE_ID not in (select DOC_TYPE_ID from DOC_ASSIGN
                where DOC_PKG_ID = :P182_PKG_ID)
           and t.DOC_TYPE_ID > 0;
    begin
      OPEN c_prepop;
        LOOP
          FETCH c_prepop into v_lnid, v_ordr, v_pkg, v_type, v_typenm;
          EXIT WHEN c_prepop%NOTFOUND;
          APEX_COLLECTION.ADD_MEMBER(
              p_collection_name => 'DOCWIZ_TYPLST',
              p_c001 => 0,          --CHKBX
              p_c002 => v_lnid,     --ID
              p_c003 => v_ordr,     --DOC_ORDER
              p_c004 => v_pkg,      --DOC_PKG_ID
              p_c005 => v_type,     --DOC_TYPE_ID
              p_c006 => v_typenm    --DOC_TYPE_NM
           );
        END LOOP;
      CLOSE c_prepop;
    end;
    Report area (column 2)
    SELECT apex_item.DISPLAY_AND_SAVE(1, SEQ_ID) SEQ_ID,
        apex_item.CHECKBOX(2, c001, 'UNCHECKED') CHKBX,
        apex_item.DISPLAY_AND_SAVE(3, c002) ID,
        apex_item.TEXT(4, c003, 3, 3) DOC_ORDER,
        apex_item.DISPLAY_AND_SAVE(5, c004) DOC_PKG_ID,
        apex_item.DISPLAY_AND_SAVE(6, c005) DOC_TYPE_ID,
        apex_item.DISPLAY_AND_SAVE(7, c006) DOC_TYPE_NM
      from APEX_COLLECTIONS
     where COLLECTION_NAME = 'DOCWIZ_TYPLST';
    Process - before validation page:
     Update Collection
    ---------------------------------------------
    declare
      i pls_integer := 0;
    begin
      for c1 in (
        select seq_id from apex_collections
         where collection_name = 'DOCWIZ_CHKLST'
         order by seq_id) loop
        i := i+1;
        --CHKBX
        apex_collection.update_member_attribute (p_collection_name=> 'DOCWIZ_CHKLST',
            p_seq=> c1.seq_id,p_attr_number =>1,p_attr_value=>wwv_flow.g_f02(i));
        --DOC_ORDER
        apex_collection.update_member_attribute (p_collection_name=> 'DOCWIZ_CHKLST',
            p_seq=> c1.seq_id,p_attr_number =>3,p_attr_value=>wwv_flow.g_f04(i));
      end loop;
    end;
    If anyone has a better way of doing things, I'm ready for it. The standard tabular forms appear not to be the right thing, because there will be TWO shapes on the page, that's why I went with a collection.

    Hello

    I just have a quick look and see what you're trying to do.

    One thing, you might want to consider, is that you use to identify each item (those who become G_F01, G_F02 etc.), index numbers can be any number you like up to a maximum of 50. So, your region on the left could use numbers from 1 to 25 and those rights could use 26 to 50 - little matter if there are gaps in the numbers.

    I'm actually about to close for the day because he went from 19:00 here now, so can't not consider this news right now - but if the above does not do, just update the thread and I'll have another look tomorrow.

    Andy

  • How to hide the false underscores (_) of af: table when you use the check boxes

    Greetings,

    I was wondering, how to hide the String _ of af: table when a checkbox control are false (0) in JDeveloper 11.1.2.4.0?

    If the box is true, then he have a symbol 'tick' and that was correct, but if its false (0) instead of projection

    nothing, it shows a string of underscore (_) and it looks bad.

    OK I found the solution after all.

    Was indeed a skin problem because I was using the default merge skin and he added this code:

    AF | selectBooleanCheckbox: {no selected icon

    Content: url(/afr/fusionFx-v2/checkMark_NS_readonly.png)

    }

    So, on my current skin, I replace it with this:

    AF | selectBooleanCheckbox: {no selected icon

    content: inhibit;

    }

    Thank you to notice me in the right direction.

  • Issue when inserting into a table using sequence in Oracle 11 g Rel 2

    Hi all

    I am facing problem when I insert sequence values in my table.
    When inserting, my sequence does not begin with the beginning with the value.
    Example Script

    CREATE SEQUENCE xyz_seq
    START WITH 1
    INCREMENT BY 1
    NOMAXVALUE
    MINVALUE 1
    NOCYCLE
    NOCACHE
    ALL;

    create table abc (a number not null);

    insert into abc (xyz_seq.nextval) values;

    Select *.
    ABC;

    xyz_seq sequence of fall;

    drop table abc;

    Output

    Order of creation.
    Table created.
    1 line of creation.

    ONE
    ----------
    2
    1 selected line.
    Sequence has fallen.
    Deleted table.

    I can't understand why this is inserting value 2, when my sequence should start at 1.


    To overcome that road, I implemented a different logic.
    Example of

    CREATE SEQUENCE xyz_seq
    START WITH 1
    INCREMENT BY 1
    NOMAXVALUE
    MINVALUE 1
    NOCYCLE
    NOCACHE
    ALL;

    create table abc (a number not null);
    declare
    x number (1): = xyz_seq.nextval;
    Start


    insert into abc (x) values.
    end;
    Select *.
    ABC;

    xyz_seq sequence of fall;

    drop table abc;

    Output

    Order of creation.
    Table created.
    PL/SQL procedure successfully completed.

    ONE
    ----------
    1
    1 selected line.
    Sequence has fallen.
    Deleted table.

    However, my question remains why referring to the sequence.nextval in my insert does not return me the beginning with the value.

    Kind regards
    Rishi

    That's what says the doc ;

     If you attempt to insert a sequence value into a table that uses deferred segment creation, the first value that the sequence returns will be skipped.
    

    It ignores the value 1 and returns 2.

  • Insert into a table using UNIX

    I have the Summary.txt file

    constants looks like this

    ./log_CS-185.lst:error detected, rollbacking
    ./log_CS-13603.lst:error detected, rollbacking
    ./log_CS-1002.lst:error detected, rollbacking

    now, I have to scan this file for (CS-185, CS-13603, CS-1002)

    and insert these raising into a table... How can I do this using unix script?...

    I have to scan this file for (CS-185, CS-13603, CS-1002)

    and insert these raising into a table... How can I do this using unix script?...

    Example:

    $ cat read_Sum.sh
    cat Summary.txt | while read LINE
    do
            VAR=`echo $LINE | awk -F_ '{print $2}' | awk -F. '{print $1}'`
            echo $VAR
            sqlplus -s test/test << EOF
            insert into summary values('$VAR');
            exit
    EOF
    done
    $ ./read_Sum.sh
    CS-185
    
    1 row created.
    
    CS-13603
    
    1 row created.
    
    CS-1002
    
    1 row created.
    
    $ sqlplus test/test
    
    SQL*Plus: Release 10.2.0.3.0 - Production on Thu May 19 13:32:40 2011
    
    Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.
    
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
    With the Partitioning, OLAP and Data Mining options
    
    SQL> select * from summary;
    
    CODE
    --------------------------------------------------
    CS-185
    CS-13603
    CS-1002
    
    SQL>
    
  • How to identify the name of the procedure that inserts into a table in the TRIGGER

    Hello
    There are several procedures in my DB that perform the INSERT operation on a main table - MYTAB say.

    I created a trigger on the table MYTAB, to follow closely, what procedure is insert data in there. Is there a function that captures the name of this object?

    For example: PROC_A, PROC_B, PROC_C insert into the table MYTAB. And my query is - the trigger on table MYTAB should document these object names where the lines fit.
    Please let me know your suggestions...

    SQL> create table t (no integer, dt timestamp, who_inserted varchar2(4000));
    
    Table created.
    
    SQL> create or replace procedure p
      2  as
      3  begin
      4    insert into t (no, dt) values (1, systimestamp);
      5  end;
      6  /
    
    Procedure created.
    
    SQL> show err
    No errors.
    
    SQL> create or replace trigger t_trig before insert on t for each row
      2  begin
      3     :new.who_inserted := dbms_utility.format_call_stack;
      4  end;
      5  /
    
    Trigger created.
    
    SQL> show err
    No errors.
    
    SQL> begin
      2    p;
      3  end;
      4  /
    
    PL/SQL procedure successfully completed.
    
    SQL> select * from t;
    
            NO DT                             WHO_INSERTED
    ---------- ------------------------------ ----------------------------------------
             1 31-OCT-14 04.58.53.668465 AM   ----- PL/SQL Call Stack -----
                                                object      line  object
                                                handle    number  name
                                              3a7ddbea0         2  KARTHICK.T_TRIG
                                              3ac979f30         4  procedure KARTHICK.P
                                              3a822deb8         2  anonymous block
    
  • Insert into multiple tables; Enter the id of the first

    I apologize if this has been answered elsewhere, but I tried searching and got no results.

    I try inserting the contents of a form in two tables. After you insert fields in a table, I want to enter the id of the first table key in the second table with the other fields.

    I tried a few different things, including trying to use SCOPE_IDENTITY(), but just kept a lot of mistakes.
    The current version of my code works perfectly, * except for the fact that it does not insert the ID *!

    Can someone tell me what I am doing wrong? or offer another way to do this?
    Thanks for your help, as usual.

    Very well! I got it to work. Thank you very much! Here's what I ended up doing (I write just the code for INSERTs). I'll play with cfqueryparam some more later - thanks a lot for the valuable info!

  • By selecting certain records by using the check box

    Hello

    I have a similar problem mentioned in this thread Re: select specific records using the checkbox I got if I have only one primary key value in the work table. I don't know how to handle it when I have several primary keys of the table I want to use for filtering?

    Thank you.

    Hello

    You can use rowid
    First report

    SELECT APEX_ITEM.CHECKBOX(1,e.rowid) chk,
    e.*
    FROM emp e
    

    Use even submit after processes.
    And target page report

    SELECT e.*
    FROM emp e
    WHERE EXISTS(
    SELECT 1
    FROM apex_collections c
    WHERE c.collection_name = 'P46COL'
    AND c.c001 = e.rowid)
    

    Kind regards
    Jari

    Published by: jarola on October 14, 2010 10:50

  • Using the check boxes

    Hi all

    I'm looking to use a number of checkboxes in a group, but I have a problem with the actionlistener.if the a has any ideas or a good tutorial, that would be greatly appreciated his knowledge

    Hello

    You can take a counter. And increase in value by an if the the checknox is checked.

    If (checkBox1.getChecked () == true)
    counter ++;

    Percentage = (counter * 100) / 18;

    Thank you

  • Using the check box to turn text input.

    Can someone help me with the Actionscript code to have a checkbox when CHECKED it allows some entries of text fields to be activated, and when UNCHECKED they are disabled?

    I make a request for delivery/billing and I want him to have a checkbox so if they information is the same as the previous one, they can check and disable fields.

    Sorry, I didn't, try:

    function clickHandler(event:MouseEvent):void {}
    inputtext. Selectable =! event.target.selected;
    }

    Although he should be selected until you have checked the box since nothing set to false before that.

  • Create a button for inserting into a table

    What I can't do, because I've never needed, is to create, in a page (where I have an interactive report), a button is clicked that once performs a simple sql (for example, an insert into a table using the values of page element).

    How can I do?

    Thank you

    Here are some of the steps:

    (1) create the button.

    (2) then right click on the name of the button and select Create Dynamic Action

    (3) give it to DA a name, click Next

    (4) on the 'when' step, event should already be "Click" and the name of the button must be filled

    (5) for the Condition, you would have a condition when you want that the display of the button.  Say, if your page elements have a certain range of values, and then display this button.  No condition means that the button is always displayed.

    (6) for the 'real Action' stage, action, select "run the Code in PL/SQL.

    [There are other ways to do this, but it's simple for me.]

    (7) in the Code PL/SQL block, enter says:

    Begin

    INSERT INTO EMP (EMPNO, ENAME, HIREDATE)

    VALUES (: P6_EMPNO, 'MARK1970',: P6_HIREDATE);

    COMMIT;

    END;   -You'd probably all the variables page element

    (8) here the part I'm not sure 100%.

    For items to submit "Page, name used in YOUR QUERY - in my example page elements, these are P6_EMPNO, P6_HIREDATE (don't note any use of & or: or here.)

    Hmm.  Start by putting nothing in "Page of elements to return.   If that fails, then try the same elements of page P6_EMPNO, it P6_HIREDATE as well.

    [I'm too lazy to go running at present].

    (9) I think that's it.

    Howard

  • Table multi-selection disabled the check boxes in ADF 10 g

    I think I met an obstacle when you work with a multi-selection table in 10 ADF.

    The selection itself works very well. However, my problem is to try to disable some of these boxes several selections. These boxes are disabled using the expression language. Once disabled, I can always choose these rows in the table using the button 'Select all' created by multiple selection facet. On the page sent, the disabled lines are not recognized as being selected, which is good. However, they always seem to be selected on the front-end server, which would be confusing for users.

    <af:table emptyText="No roles were found"
              binding="#{backing_userRoles.tableRoles}"
              id="tableRoles"
              value="#{backing_userRoles.userRoleList}"
              var="userRole">
                            <f:facet name="actions">
                              <af:commandButton text="Copy Roles"
                                                binding="#{backing_userRoles.cmdCopy}"
                                                id="cmdCopy"
                                                action="#{backing_userRoles.cmdCopy_action}"/>
                            </f:facet>
                            <f:facet name="selection">
                              <af:tableSelectMany text="Select items and ..."
                                                  binding="#{backing_userRoles.tableSelectMany1}"
                                                  id="tableSelectMany1"
                                                  rendered="#{backing_userRoles.managerFlag}"
                                                  disabled="#{userRole.role.autoGrantedFlag eq 'Y'}"/>
                            </f:facet>
    

    multiselecttable.PNG

    So as you can see, the disabled check box has been selected even when disabled. Any ideas on how to change this behavior? Or maybe just get rid of the default generated 'select all ' | 'Select none' orders?

    Thank you

    Cody

    Or, remove selection facet and make sure you have a selection logic - that is to say, some transient Boolean attribute of VO enabled/disabled state, and you have Select All/Select none

  • Select the check box for the table of the ADF

    Hi all

    I want to add the check box in front of each line. The user will select the row by clicking the box and going to treatment by clicking on a button.

    I just almost all possible discussions on OTN.

    What I've done so now
    1] added a transitional Boolean attribute in my VO. added as a selectBooleanCheckbox in .jspx page.
    [2] a button with backing bean that will do the processing. [He will pick up the attributes of all ranks and be written in a file]
    [* 3] it works fine if I use the default option of line by Ctel selection + A, or by pressing Ctrl + click or SHIFT + arrow key. Backing bean is not the issue.*
    [4] try to intercept the TableSelection Listner also.

    It comes

    When I select the check box, only the last selected line is processed and not all lines. How to make the selectable online by clicking on the checkbox.

    I use JDeveloper 11.1.1.5

    Refered links
    http://www.gebs.ro/blog/Oracle/Oracle-ADF-row-selection-using-checkboxes/
    http://technology.AMIS.nl/2010/07/29/ADF-11g-select-all-rows-in-an-ADF-table/
    http://Sameh-Nassar.blogspot.nl/2009/12/use-checkbox-for-selecting-multiple.html
    http://www.Oracle.com/technetwork/developer-tools/ADF/learnmore/99-checkbox-for-delete-in-table-1539659.PDF

    Mukesh.
    https://www.dropbox.com/s/1gqsaobgyjycie6/AddDeleteEmployees.rar
    
  • Any ideas how can I insert a pdf into word, by using the option object to insert. However, the pdf file that I want to insert text and annotated lines, but once inserted comments do not appear?  any help would be greatly appreciated.

    Any ideas how can I insert a pdf into word, by using the option object to insert. However, the pdf file that I want to insert text and annotated lines, but once inserted comments do not appear?  any help would be greatly appreciated.

    You will need to find a forum for MS Word, since it is the software you are trying to manipulate in the present.  If you think that the treatment/creation of the PDF file plays a role, then you should ask in the forum for the software that you use to create the PDF file.

    This forum is for a question about downloading and installing Adobe products test, so in all circumstances, your question does not fit in this forum.

  • How to get the numbers to remember a list of answers column on nine or more tables using the same format

    I'm new to numbers but were mainly use it to organize only a simple way to display the cases that arise in a criminal background check. So for a table, I can type driving while license revoked (DWLR) as the load and from there on the charge will fill itself or offer similar responses after typing a single key.  A well appreciated time saver but problems I can sort and summarize the criminal history for 10 people or more at a time and need to do it urgently often.   However when I opened a new table I have to cross and type a new the precise wording of a charge, its disposal (Guilty, voluntary dismissal etc.)  and just know that there is an easy way for the numbers to know in a new table that, if finished it is a list annoyingly long term broken criminal code list and do not have to do that in each new table so that it can take.  I know I'm missing something very basic, but any help would save hours for me and the other poor interns who spend twice as long just to undestand the case and troubleshoot.  Thanks for all the ideas!

    David

    Hi D,

    The AutoComplete feature provides suggestions picked on data entered in the cells above the one you are working in. You can automate the process by preparing a "full menu" table containing ALL the possible inputs for each column in the rows below the header lines.

    The checkbox in cell A1 is a switch, is used to insert the word HIDE in the cell that contains the list of AutoComplete terms. Cells in this area are filled with bright red to draw attention to them when indicated.

    A rule to reorganize (shown and applied below) hiding these lines when the box is checked.

    Hide the lines does not affect the operation of auto-complete, as shown in the table below:

    When the form is competed, action depends on how the result will be recorded and filed.

    If there is no need to edit/modify the file, it can be converted to a PDF using the print dialog. This produces a copy of the displayed part of the document only.

    If the document will require more editing, you can remove the lines containing AutoComplete suggestions. Clear the check box, select all the red lines filled, click the triangle in the row reference tabs and choose Remove.

    Formula in A2 - A10: = IF(A$1,"HIDE","")

    Kind regards

    Barry

Maybe you are looking for