Inserting Record with database block (with contorl block)

In my application I have a form in which i have button when pressed a record should be entered in database that this button has been pressed.
Whether it should have database block or not.
when i wrote the pl/sql in the wbp trigger
insert into xyz values ('Add Button Purchase Order');
commit
Message appears
FRM-40401 No changes to Save
How to conrol this message.
Thanks
MAQ

hi there
i managed to remove this message by putting the following
if error_code=40401 then
null ;
else
message(error_text) ;
message(error_text) ;
raise form_trigger_failure ;
end if ;
on ON-ERROR trigger at form level
hope it helps !

Similar Messages

  • How to insert records with LONG RAW columns from one table to another

    Does anybody know how to use subquery to insert records with columns of LONG RAW datatype from one table to another? Can I add a WHERE clause in the subquery statement? Thanks.

    Insert into ... Select statements are not supported for long or long raw. You will have to either use PL/SQL or convert your long raw to blobs.

  • Retrive last inserted  record  from database table

    Hi,
    some body inserting a record into table 'A' through some procedure/java program.i want to retrive the last inserted record from database table.records are not stored in order.Can any body help me.

    In general, unless you are storing a timestamp as part of the row or you have some sort of auditing in place, Oracle has no idea what the "first" or "last" record in a table is. Nor does it track when a row was inserted.
    - If you have the archived logs from the point in time when the row was inserted, you could use LogMiner to find the timestamp
    - If the insert happened recently (i.e. within hours), you may be able to use flashback query to get the value
    - If you're on 10g or later and the table was built with ROWDEPENDENCIES and the insert happened in the last few days and you can deal with a granularity of a few seconds and you don't need 100% accuracy, you could get the ORA_ROWSCN of the row and convert that to a timestamp.
    If this is something you contemplate needing, you need to store the data in the row or set up some sort of auditing.
    Justin

  • Validations when inserting records into database using table control?

    hi , guru's.
          iam inserting records into database table through table control when i press insert i want check which record is existing and which is not . so please give me any sample code
    regards,
    satheesh.

    hi , arjun.
    please check this code.
        WHEN 'INSERT'.
        data: g_vcontrol_itab1 like table of zcust_call_rec,
              g_vcontrol_wa1 like g_vcontrol_wa.
         SELECT *  FROM zcust_call_rec
                   INTO CORRESPONDING FIELDS OF TABLE g_vcontrol_itab1
                   FOR ALL ENTRIES IN g_vcontrol_itab
                   WHERE kunnr = g_vcontrol_itab-kunnr AND budat = g_vcontrol_itab-budat.
            loop at g_vcontrol_itab into g_vcontrol_wa.
               read table g_vcontrol_itab1 into g_vcontrol_wa1
                    with table key  g_vcontrol_wa-kunnr = kunnr and g_vcontrol_wa-budat = budat.
                     if sy-subrc = 0.
                       delete g_vcontrol_itab.
                     endif.
            endloop.
          LOOP AT g_vcontrol_itab INTO g_vcontrol_wa.
            INSERT into zcust_call_rec values g_vcontrol_wa.
          ENDLOOP.
    with this iam getting error message like this.
              <b>g_vcontrol_wa-budat is not expected.</b>

  • How to write code to insert record in database programtically in Jdev rel

    Hi Experts,
    Please tell me how to write code to insert record in database programtically in Jdev rel .2.
    Thanks
    Shiv Naresh

    To insert the record programmatically i will provide you some sample below
    ViewObject vo = this.getVoXXXX();
    Row vor = vo.getCurrentRow();  // get the current row of the record
    ViewObject vo1 = this.getvoYYYY();
    Row vor1 = vo1.createNewRow(); //creating new row in the table
    vor1.setAttribute("aaaaa",vor.getAttribute("ttttt")) // In this we are getting the current row value of "ttttt" and inserting into "aaaaa"Hope this could help you!

  • Primary key violation when inserting records with insert_identity and ident_current+x

    My problem is this: I have data in a couple of temporary tables including
    relations (one table referencing records from another table by using
    temporary keys).
    Next, I would like to insert the data from the temp tables to my productive tables which have the same structure but their own identity keys. Hence, I need to translate the 'temporary' keys to regular identity keys in my productive tables.
    This is even more difficult because the system is highly concurrent, i.e. multiple sessions may try to insert
    data that way simultaneously.
    So far we were running the following solution, using a combination of
    identity_insert and ident_current:
    create table doc(id int identity primary key, number varchar(100))
    create table pos (id int identity primary key, docid int references doc(id), qty int)
    create table #doc(idx int, number varchar(100))
    create table #pos (docidx int, qty int)
    insert #doc select 1, 'D1'
    insert #doc select 2, 'D2'
    insert #pos select 1, 10
    insert #pos select 1, 12
    insert #pos select 2, 32
    insert #pos select 2, 9
    declare @docids table(ID int)
    set identity_insert doc on
    insert doc (id,number)
    output inserted.ID into @docids
    select ident_current('doc')+idx,number from #doc
    set identity_insert doc off
    -- Since scope_identity() is not reliable, we get the inserted identity values this way:
    declare @docID int = (select min(ID) from @docids)
    insert pos (docid,qty) select @docID+docidx-1, qty from #pos
    Since the request to ident_current() is located directly in the insert statement, we always have an implicit transaction which should be thread safe to a certain extend.
    We never had a problem with this solution for years until recently when we were running in occasional primary key violations. After some reasearch it turned out, that there were concurrent sessions trying to insert records in this way.
    Does anybody have an explanation for the primary key violations or an alternative solution for the problem?
    Thank you
    David

    >> My problem is this: I have data in a couple of temporary tables including relations (one table referencing records [sic] from another table by using temporary keys [sic]). <<
    NO, your problem is that you have no idea how RDBMS and SQL work. 
    1. Rows are not anything like records; this is a basic concept.
    2. Temp tables are how old magnetic tape file mimic scratch tapes. SQL programmers use CTEs, views, derived tables, etc. 
    3. Keys are a subset of attributes of an entity, fundamental characteristics of them! A key cannot be temporary by definition. 
    >> Next, I would like to insert the data from the temp tables to my production tables which have the same structure but their own IDENTITY keys. Hence, I need to translate the 'temporary' keys to regular IDENTITY keys in my productive tables. <<
    NO, you just get worse. IDENTITY is a 1970's Sybase/UNIX dialect, based on the sequential file structure used on 16-bit mini computers back then. It counts the physical insertion attempts (not even successes!) and has nothing to with a logical data model. This
    is a mag tape drive model of 1960's EDP, and not RDBMS.
    >> This is even more difficult because the system is highly concurrent, i.e. multiple sessions may try to insert data that way simultaneously. <<
    Gee, that is how magnetic tapes work, with queues. This is one of many reasons competent SQL programers do not use IDENTITY. 
    >> So far we were running the following solution, using a combination of IDENTITY_INSERT and IDENT_CURRENT: <<
    This is a kludge, not a solution. 
    There is no such thing as a generic “id” in RDBMS; it has to be “<something in particular>_id” to be valid. You have no idea what the ISO-11179 rules are. Even worse, your generic “id” changes names from table to table! By magic, it starts as a “Doc”,
    then becomes a “Pos” in the next table! Does it wind up as a “doc-id”? Can it become a automobile? A squid? Lady Gaga? 
    This is the first principle of any data model; it is based on the Law of Identity; remember that from Freshman Logic 101? A data element has one and only one name in a model. 
    And finally, you do not know the correct syntax for INSERT INTO, so you use the 1970's Sybase/UNIX dialect! The ANSI/ISO Standard uses a table consrtuctor: 
    INSERT INTO Doc VALUES (1, 'D1'), (2, 'D2'); 
    >> We never had a problem with this solution for years until recently when we were running in occasional PRIMARY KEY violations. After some research it turned out, that there were concurrent sessions trying to insert records [sic] in this way. <<
    “No matter how far you have gone down the wrong road, turn around.” -- Turkish proverb. 
    You have been mimicking a mag tape file system and have not written correct SQL. It has caught up with you in a way you can see. Throw out this garbage and do it right. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Unable to insert record in child block

    Dear all,
    I am facing a very strange problem.
    Actually i have a master-detail form where i need to insert master record as well as child records for the corresponding master item.
    For this i have a LOV in master block which populate the master item and execute the coresponding child records.
    so first time when i load the form i select a item from master block through a LOV this time :SYSTEM.BLOCK_STATUS is NEW and i populate a item from LOV then :SYSTEM.BLOCK_STATUS is NEW changed to query and i have inserted a next record in child block pressed F10 and it saved very well.
    But the problem is when i again select another item from master block through LOV and again tried to insert a record in child record this time it won't saved and the very stragly the cusor moved to master item showing the FRM-40600'Record has already been inserted'
    Please help why is it happening ?
    Need yours help.

    But the problem is when i again select another item from master block through LOV and again tried to insert a record in child record this time it won't saved and the very stragly the cusor moved to master item showing the FRM-40600'Record has already been inserted'When you select a new record in the Master block through the LOV, make sure you clear your form before you query the selected record. Forms thinks you are modifying the same master record and not a new record.
    Hope this helps,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • Query Based VO Can insert record (With out EO)

    I have question.
    I have Query Based VO (Not belongs to any EO).
    I need insert record using that.
    Is it possible?
    Hope quick response.

    No.

  • How to Insert Record with multiple rows

    Hello alls,
    i want to ask something... how to use insert record server behavior -  php myysql, to insert multiple rows from textfiled?
    thanks.

    It would have been more helpful if you had shown me your existing code. However, this shows the basic principles.
    First of all, the name of each input field in the form needs to end in an empty pair of square brackets like this:
    <input type="text" name="field_name[]" . . .
    This results in $_POST['field_name'] being treated as an array of the values in each input field. Change field_name to the actual name of the input field. Without the square brackets, only the last value is submitted by the form.
    The Insert Record server behavior code looks like this:
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
      $insertSQL = sprintf("INSERT INTO my_table (field1, field2) VALUES (%s, %s)",
                           GetSQLValueString($_POST['field1'], "int"),
                           GetSQLValueString($_POST['field2'], "text"));
      mysql_select_db($database_connAdmin, $connAdmin);
      $Result1 = mysql_query($insertSQL, $connAdmin) or die(mysql_error());
      $insertGoTo = "another_page.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $insertGoTo));
    You need to amend it like this:
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
      mysql_select_db($database_connAdmin, $connAdmin);
      // loop through the input values
      for ($i = 0, $len = count($_POST['field1']); $i < $len; $i++) {
          $insertSQL = sprintf("INSERT INTO my_table (field1, field2) VALUES (%s, %s)",
                                GetSQLValueString($_POST['field1'][$i], "int"),
                                GetSQLValueString($_POST['field2'][$i], "text"));
          $Result1 = mysql_query($insertSQL, $connAdmin) or die(mysql_error());
      } // end loop
      $insertGoTo = "another_page.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $insertGoTo));
    This uses a for loop (see http://docs.php.net/manual/en/control-structures.for.php) to access each element of the $_POST['field1'] and $_POST['field2'] arrays (see http://docs.php.net/manual/en/language.types.array.php).

  • Can not insert record into database

    Hi:
    I have problem with inserting a record into oracle database .
    can some one please give some help?
    I created a project which connected to a external database. My project is on one of the tables called family.
    I followed the steps in the example "TwoPageCrudTable" from "Technical Articles & Tips". I have 3 pages: family,
    family_create and family_update.
    In page family: I have one table which bound to family table in db.
    In page family_create, I have a bunch of text fields
    In page family_update, I also have a lot of text fields which are bound to the fields of the family table.
    In each of the page, there is a dataprovider, they all refer to the same rowset in the sessionbean.
    Here is my code of create button:
    public String create_action() {
    if ( familyDataProvider.canAppendRow() ) {
    try {             
    RowKey rowKey = familyDataProvider.appendRow();
    familyDataProvider.setCursorRow(rowKey);
    familyDataProvider.setValue("family.familyID", rowKey, fid.getText());
    // familyDataProvider.setValue("family.countryoforigin", rowKey, counOrigin.getText());
    // familyDataProvider.setValue("family.ELOD", rowKey, elod.getValue());
    // familyDataProvider.setValue("family.power", rowKey, power.getValue());
              familyDataProvider.commitChanges();
    } catch (Exception e) {
    error("Cannot append new family: " + e);
    } else {
    error("Cannot append a new row");
    return "created";
    FamilyID is the primary key of the family table which is type of String. There are also some other
    fields with String or Number. I tried to insert a new record with value in all the fields and with
    only some of the fields, neither succeeded. I also did a search in this forum and tried some of the
    suggestions, no help. So could anybody help me to find the problem? Thanks in advance.

    It keeps giving me the error:
    java.lang.IllegalArgumentException: FAMILY.FAMILYID
    Does anybody know what is the problem? Thanks!

  • How to insert records in database from a dataset with multiple tables

    Hi,
    I'm struggling with the following problem:
    I have saved a dataset to an XML file by executing the following statement:
       ds.WriteXml( "Export\\ModuleChain_Mdata.xml" );The dataset, ds, includes records from several tables.
    Is there an easy way to retrieve those records to the database, I.E inserting them again?
    regards Peter

    you can try Associative Arrays:
    http://www.oracle.com/technology/oramag/oracle/07-jan/o17odp.html
    you need to convert yore DataTables to array first and than pass them in to the associative array procedure.

  • Insert Record with Parent/Child Tables doesn't work with Oracle - unlike AC

    Hi,
    I just Migrated a MS Access 2010 Database to an Oracle 11g Backend with the SQL Developer Tool.
    The Migration went fine, all the Tables and Views are migrated.
    I'm working with MS Access as Frontend.
    The application has some Datasheets with Subdatasheets with Parent/Child Relationship. (1-n Relationship)
    After changing to Oracle, it's not possible, to Insert a new Record in a Subdatasheet I always get the following Error Message:
    "The Microsoft Access database engine cannot find a record in the table 'xxxx' with key matching field(s) 'zzzzz'"
    It used to work perfect with the MS Access Backend, do I need a trigger which first adds the child Record ?
    Or what should I do?
    Thank you

    Hi Klaus,
    Thanks for your answer. I still haven't solved my problem. The only way would be to use a singel 1:n Relationship, but in fact I need a n:m Relationship.
    I tried the same scenario with a new Access Application, same result.
    To clearify my problem.
    Goal: Parent Form with Parent Records, Linked Child Form with Child Records in a Datasheet View => Insert of a NEW Child Record.
    I have 3 Tables (table1 = Parent tabel, table2 = Child Table, table12 = n:m Tabel with PK and two FK)
    The Recordsource of the Parent Form is Tabel1
    The Recordsource of the Child Form is Table2 joined with Table12.
    In my Old Access Project, Access Triggered the Insert and filled Table12 with the NEW PK of Table2.
    It seems like Access can't do that anymore....
    I'm pretty desperate and I'm sure it is just a litte thing to fix.....

  • Best logic to insert records with constant set of values.

    hi all,
    i am using Forms [32 Bit] Version 6.0.8.24.1 (Production).
    i have process type 'I' and 'E'.
    if process type = 'I' then i have to insert five records into table.
    "company,job type,serial,process type,value,created by,created on"
    here all columns will be having same value except value column what i have mentioned.
    that means for
    first record the valuecolumn = 'emp code',
    second record value = 'con no',
    third record value = 'weight',
    fourth record value = 'volume'
    fifth record value = 'pack type'
    Right now i am planning to do like
    k= 5--if process = 'I' else k = 6.
    n := 0;
    for 1..n loop
    n := n + 1;
    exit when n = k;
    if n = 1 then
    insert with value = 'emp code'
    elsif n = 2 then
    value = 'con no'
    end if;
    end loop
    n  := 0;
    k := 0;Is this is the best way or i do we have any better logic to do this?
    Please advise.
    Thanks..
    Edited by: GD on Sep 17, 2011 8:59 PM

    I have successfully inserted seven records in one form submit operation by looping through the command object execute method.
    However, the data that is being inserted by the command object is repetition of the first record and the command object is not taking any data from the text boxes for the second record onwards. In this I had used the isert record behavious generated by DW CS4 and modified it to suit my requirement. However, the data inserted in the first row is getting repeated in all the seven rows.
    Please help.
    Also advise if there are any free dreamweaver server side validation extensions available.

  • Delete Multiple record in database block

    hi to all,
    i have one button. what i want if i press this button all the records that i selected from detail blocks will be deleted.
    i used this code but i always received an error : FRM-40102: record must be entered or deleted first.
    DECLARE
    Num_Total_Records NUMBER;
    Num_Loop_I NUMBER;
    BEGIN
    GO_BLOCK(<BLOCK_NAME>);
    FIRST_RECORD;
    LAST_RECORD;
    Num_Total_Records := TO_NUMBER(NAME_IN('SYSTEM.CURSOR_RECORD'));
    FIRST_RECORD;
    FOR Num_Loop_I IN 1..Num_Total_Records LOOP
    IF <CHECKBOX> = 1 THEN
    if <condition> then
    else
    if <condition> then
    else
    end if
    --condition is satisfied...deleted the selected record
    delete_record;
    commit;
    end if
    END IF;
    NEXT_RECORD;
    END LOOP;
    <................................................>
    END;

    baguhan,
    by this if u have selected all records, some records will won;t delete.
    because as poelger said, delete_record will already skip 1 record.
    so instead of the code u gave , its beter to all else portion in the condition and in the else portion gave the next record.
    this is the your code modified
    DECLARE
    Num_Total_Records NUMBER;
    Num_Loop_I NUMBER;
    BEGIN
    GO_BLOCK(<BLOCK_NAME>);
    FIRST_RECORD;
    LAST_RECORD;
    Num_Total_Records := TO_NUMBER(NAME_IN('SYSTEM.CURSOR_RECORD'));
    FIRST_RECORD;
    FOR Num_Loop_I IN 1..Num_Total_Records LOOP
    IF <CHECKBOX> = 1 THEN
    --condition is satisfied...deleted the selected record
    delete_record;
    commit;
    else
    NEXT_RECORD;
    END IF;
    END LOOP;
    <................................................>
    END;
    Regards,
    Manu

  • Error while inserting record into database using BPEL

    I am trying to read from an xml file using a File Adapter and insert the values read into a database (by invoking a database adapter).
    I formed the BPEL Process in the following manner:
    1.Receive activity to receive the values read from the file
    2.Assign activiuty to assign the values read to the Database input variable
    3.Invoke activity to invoke the Database adapter.
    The process deploys fine although with a warning : Trying to assign incompatible types.
    But when the process is executed, it is faulting at the invoke stage.
    The error i am getting is :
    <messages><input><InvokeDBInput><part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="EmployeesCollection"><EmployeesCollection xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/top/SaveToDB">
    <ns0:Employees xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/filetoDB D:\Smita\Software\jdevstudio10133\jdev\mywork\FileToDatabase\filetoDB\emp.xsd" xmlns="http://xmlns.oracle.com/filetoDB" xmlns:ns0="http://xmlns.oracle.com/pcbpel/adapter/db/top/SaveToDB">
         <Name>John Smith</Name>
         <Email>[email protected]</Email>
         <Department>Finance</Department>
         <Designation>Accountant</Designation>
         <Grade>5</Grade>
    </ns0:Employees>
    </EmployeesCollection>
    </part></InvokeDBInput></input><fault><bindingFault xmlns="http://schemas.oracle.com/bpel/extension"><part name="code"><code>null</code>
    </part><part name="summary"><summary>file:/D:/product/10.1.3.1/OracleAS_1/bpel/domains/default/tmp/.bpel_FileToDBTest1_3.5_1558cd90a5c3c9708cd747f1b3638054.tmp/SaveToDB.wsdl [ SaveToDB_ptt::insert(EmployeesCollection) ] - WSIF JCA Execute of operation 'insert' failed due to: Mapping Not Found Exception.
    The mapping [Name] for descriptor [class bpel___localhost_default_FileToDBTest1_3_5__MD5_02e1d439ab7f9c7430b64c2a306ee77c_.SaveToDB.Employees] could not be found. The input xml record had an element [Employees/Name].
    ; nested exception is:
         ORABPEL-11627
    Mapping Not Found Exception.
    The mapping [Name] for descriptor [class bpel___localhost_default_FileToDBTest1_3_5__MD5_02e1d439ab7f9c7430b64c2a306ee77c_.SaveToDB.Employees] could not be found. The input xml record had an element [Employees/Name].
    Make sure that the input xml is valid relative to the xsd and that the mapping exists in the Mappings.xml. If an old version of the descriptor without this mapping has been loaded by the database adapter, you may need to bounce the app server. If the same descriptor is described in two separate Mappings.xml files, make sure both versions include this attribute/mapping.
    </summary>
    </part><part name="detail"><detail>null</detail>
    </part></bindingFault></fault></messages>
    The xml and xsd files i have used are these:
    XML File (Employee.xml ) :
    <?xml version="1.0" encoding="UTF-8"?>
    <person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/filetoDB D:\Smita\Software\jdevstudio1013\jdev\mywork\FileToDatabase\filetoDB\emp.xsd" xmlns="http://xmlns.oracle.com/filetoDB">
         <Name>John Smith</Name>
         <Email>[email protected]</Email>
         <Department>Finance</Department>
         <Designation>Accountant</Designation>
         <Grade>5</Grade>
    </person>
    Schema file : (emp.xsd) :
    <?xml version="1.0"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://xmlns.oracle.com/filetoDB"
    xmlns="http://xmlns.oracle.com/filetoDB"
    elementFormDefault="qualified">
    <xs:element name="person">
    <xs:complexType>
    <xs:sequence>
         <xs:element name="Name" type="xs:string"/>
         <xs:element name="Email" type="xs:string"/>
         <xs:element name="Department" type="xs:string"/>
         <xs:element name="Designation" type="xs:string"/>
         <xs:element name="Grade" type="xs:integer"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element></xs:schema>
    can someone help me out?

    I figured where i was going wrong...added a transform activity after the assign activity to map the file input fieds to the database columns. Now it works fine.

Maybe you are looking for