Writing an update statement in oracle forms 9i

Hi ,
I have a problem situation in which
I am fetching values from a cursor and a recod group into two data block items text box and combo box respectively .
Both the data is fetched from different tables .
Now based on the selection from combo box I have to update the selected value in another table by writing an update statemet .
I have created a button and on the trigger event of when button pressed I wrote a simple update statement but it's not working that way .
Kindly help me how to write manual update statements in oracle forms 9i
I can't used the update buil in of forms as I want to update in a table which is not mentioned in the property pallete of data block
please help

I just wrote a procedure
PROCEDURE update_current IS
BEGIN
update table abc set xculumn= :block_name.item_name2 where ycolumn = :block_name.item_name1 ;
commit;
and I called the procedure from a when button pressed trigger
it gave an error invalid identifier abc ( which is table name)
pls help
I am trying to do it with form_ddl(update_query)
but here I am facing another problem
I have update_query = 'update table abc set xculumn= ' || :block_name.item_name2 || 'where ycolumn = '||:block_name.item_name1
now since xculumn and y column are varchar type so I suppose while preparing the query I have to concatenate single quotes ( ' ) at the start and end
but i am facing problems in doing so
please tell me an alternative way or how to concatenate single quotes in the above update_query variable

Similar Messages

  • Please tell me the background proces of update statement in oracle

    1. user excuted update and inset statement from sqlplus ,
    please give me the flow in oracle architecture
    2. user excuted commit and roll back also
    please give me the flow in oracle architecture
    Thanks

    As Pierre Forstmann said answer can vary according the details you want. If you want it to be in four lines than I hope this it.
    For select
    search shared pool a copy of parsed sql
    validate statement
    validate data sources
    acquire locks
    check privileges
    prepare parse tree or execution plan and place in library cache
    execute statement - retrieve data form file to buffer cache
    fetch vales from the cursor
    For DML
    there are several differences between how Oracle executes select and DML
    however, they follow the same general pattern
    parse statement - create parse tree
    execute the statement - acquire locks on the data to be changed
    generate redo
    For commit or rollback
    release table/row locks acquired by statement
    release undo segment
    update redo with commit/rollback information
    flush the content from log buffer to redo files
    I suppose the documentation provided above is best place where you can find the details

  • For Update Query from ORACLE Forms

    Hi
    We are using Oracle Forms 10g running with 10g database 10.2.0.1.0. We happend to see a query which is getting generated in AWR report like Select rowid, all_columns from TableName for Update of C1 Nowait. But no such query is really written in forms and we are aware that, Any query prefixed with rowid is definitely executing from Forms. But how the ForUpdate and Nowait clause is appended to the query.
    We have checked the following properties in the database Block
    *1) Locking Mode is set to Automatic*
    *2) Update Changed Columns only is set to YES*
    *3) Query all records is set to No (Though this particular property may not be relevant to the issue)*
    What is the property or setting which might trigger such a query from ORACLE Forms with ForUpdate and Nowait clause.
    Any ideas/suggestions on why such behaviour. Please have a healthy discussion on this. Thanks in advance.

    you can't dynamically add a query to the data model in reports.
    You should look into the XML based customization of Oracle Reports. This will enable you to define a report dynamically by creating a definition in XML.
    Also another option is to have the report with a query in it and use lexical parameters in reports to pass the query definition or just the where part of it.
    Look at the reports online help for both of these solutions.

  • Convert a SQL Server Update Statement for Oracle

    Hi,
    i need to convert an update statement written for SQL Server to make it work on Oracle,
    the update is the following:
    UPDATE     TABLE1
    SET     CDate = TBL2.CDate
    FROM      TABLE1 TBL1
              JOIN TABLE2 TBL2 ON TBL2.Code = TBL1.TBL2Code
              JOIN TABLE3 TBL3 ON TBL3.Id = TBL1.Id
    WHERE     TBL3.TypeCode = '07'
    how can i make it compatible with oracle?
    thanks!!

    Billy  Verreynne  wrote:
    Karthick_Arp wrote:
    Try this
    <snipped>Dislike such an approach that requires multiple hits on the same tables. This is never scalable. A key performance issue is to do only one pass through a data set when possible and not do multiple passes.Yes i understand. But to do a update on a join the table must be a Key Preserved Table. And for a normal Update it is necessory to have an EXISTS clause so that we dont update the non-matching rows to NULL.

  • Update statement in Oracle Lite

    Hi
    I'm having a problem when I do an Update on the database.
    if I set a column which is a primary key in the table with the same value I get a foreign key error.
    Ex: update company set company_id = 1 where company_id = 1;
    in Oracle 8i there is no problem ,but when I run it in 8i Lite a get the foreign key error.
    I appreciate any help

    Is it necessary to update the entire record in Oracle Lite, or should it be possible to update select columns only when performing an update query?
    Thanks,
    Allen

  • Need help in writing an update statement

    Hi,
    my requirement is as follows..
    I have a simple table with just three fields in it
    Field_1 Field_2 Field_3
    A 1 2
    A 0 5
    A 2 1
    A 3 4
    B 1 3
    C 2 3
    given a value of field_1 i need to select a row that has min(field_2)
    in this case the 2nd row from the above table if the value given is "A".
    any help will be greatly appreciated.
    thanks.

    Your subject says "update" but your requirement was a "select" statement.
    Don't say I never give any options:
    sql>select * from x;
    F   FIELD_2   FIELD_3
    A         1         2
    A         0         5
    A         2         1
    A         3         4
    B         1         3
    C         2         3
    6 rows selected.
    sql>select *
      2    from x t1
      3   where field_1 = 'A'
      4     and field_2 = (select min(t2.field_2)
      5                      from x t2
      6                     where t2.field_1 = t1.field_1
      7                     group by t2.field_1);
    F   FIELD_2   FIELD_3
    A         0         5
    1 row selected.
    sql>select *
      2    from x
      3   where (field_1, field_2) in (select field_1, min(field_2)
      4                                  from x
      5                                 where field_1 = 'A'
      6                                 group by field_1);
    F   FIELD_2   FIELD_3
    A         0         5
    1 row selected.
    sql>select field_1, field_2, field_3
      2    from (select x.*, row_number() over (order by field_2) rn
      3            from x
      4           where field_1 = 'A')
      5   where rn = 1;
    F   FIELD_2   FIELD_3
    A         0         5
    1 row selected.
    sql>select *
      2    from (select *
      3            from x
      4           where field_1 = 'A'
      5           order by field_2)
      6   where rownum = 1;
    F   FIELD_2   FIELD_3
    A         0         5
    1 row selected.

  • Insert / Update from Oracle Forms -- URGENT Please thanks

    Hello All,
    I need to create form which can be use for two purposes. i.e insert and update
    I have one table called emp which has 50 columns.
    Only four columns has not null constraint.
    I need to insert values in only these columns.
    From SQLPLUS it can be cone as below:
    insert ito emp values ('333','2222','007','AA','01-JAN-2007','','','','','','','','','',........);
    After that I need to update one of the coulmn with the value as
    update emp
    set zipcode = 'Y'
    where empt# = 007;
    How could I achive this from Oracle form.
    Any help will be appricated.
    D

    Why handle updates in the On-Update trigger? Oracle Forms already handles this for you. You update a data value in a field and click on the SAVE button (assuming you have a Save button) and the Oracle Forms handles the Update. The On-Update trigger is provided so you can perform processing in addition to the default UPDATE.
    Craig...

  • How to use rownum=2 in update statement  ?

    Hi all,
    we are migrating the data from mainframe to oracle. migration team extracted the data into flat file. we are using this flat file to load in oracle.Finacle have menu option to load data from flat file to corresponding oracle tables.whenever i given this flat file to Menu it will give error report like below if any rows have error.
    here "A/c. Opening Matrix" is the error.
    error report:-
    A/c. Opening Matrix
    The Above Error Was For record No: 1
    A/c. Opening Matrix
    The Above Error Was For record No: 2
    we are extracting and storing all the error message and corresponding record no in shell script as below.
    err_msg=`echo ${error_msg[i]}`
    rec_num=`echo ${error_msg[i]}| cut -d: -f2`
    we need to update the upload status either upload success or failure and error message in upload history table. iam writing the update statement as below.
    update statement:-
    update upld_hist set upld_status='ERR' ,upld_err='$err_msg' where rownum=$rec_num;
    This is statement is updating only for rownum=1. other than this it is not updating the table. Please suggest me how to update the rows based on rownum?
    Thanks,
    Venkat Vadlamudi

    868591 wrote:
    Hi all,
    we are migrating the data from mainframe to oracle. migration team extracted the data into flat file. we are using this flat file to load in oracle.Finacle have menu option to load data from flat file to corresponding oracle tables.whenever i given this flat file to Menu it will give error report like below if any rows have error.
    here "A/c. Opening Matrix" is the error.
    error report:-
    A/c. Opening Matrix
    The Above Error Was For record No: 1
    A/c. Opening Matrix
    The Above Error Was For record No: 2
    we are extracting and storing all the error message and corresponding record no in shell script as below.
    err_msg=`echo ${error_msg[i]}`
    rec_num=`echo ${error_msg[i]}| cut -d: -f2`
    we need to update the upload status either upload success or failure and error message in upload history table. iam writing the update statement as below.
    update statement:-
    update upld_hist set upld_status='ERR' ,upld_err='$err_msg' where rownum=$rec_num;
    This is statement is updating only for rownum=1. other than this it is not updating the table. Please suggest me how to update the rows based on rownum?
    Thanks,
    Venkat VadlamudiUse Analytic ROW_NUMBER() ..
    http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions156.htm#i86310

  • JDBC , UPDATE STATEMENT

    I am writing a Update Statement as fllows
    String sql= "update users_login set user_temp_pass='"+null_value+"' and user_pass='" + inputPwd + "'where user_id='"+inputUserid"';";
    But is still showing error saying that
    the statement has to be terminated by a ';'
    Please help me writing the statement correctly.

    Thank you, I have one more question.
    I am writing the following code to erase the temporary password and put the user choosen password.Somehow this is returning TRUE but the same changes are not appearing in the database.Please help me solving that.
    try {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    // Connection con = DriverManager.getConnection("jdbc:oracle:thin:@wdcorcl01dev:1521:USAD", "osis", "iss");
    con = DriverManager.getConnection("jdbc:oracle:thin:@wdcon01dev:1521:USAD", "osis", "iss");
    if (con == null) {
    System.out.println("Connection not found");
    stmt = con.createStatement();
    con.setAutoCommit(false);
    String sql= "update isis_users_login set user_temp_pass='"+null_value+"',user_pass='" + inputPwd + "'where user_id='" inputUserid "'";
    stmt.executeUpdate(sql);
    con.commit();
    returnString= true;
    } catch(SQLException sqlex) {
    sqlex.printStackTrace();
    returnString=false;
    } catch(Exception ex) {
    ex.printStackTrace();
    } finally {
    stmt.close();
    con.close();
    stmt = null;
    rs = null;
    con = null;
    return returnString;

  • Update statement with many fields

    Hi,
    I am writing an update statement, in a php page, that is formed by many fields, about 80 fields and I would not specify all the fields, does it exist a way to write the update statement without specify all the fields of the record? (I want update all the fields of a record)
    Thanks, bye bye.

    One question here.
    when we give SET col1 = col1 the update will happen right?
    If my update is going to update 100000 rows of column 1 and column 1 also has an index then wont it be expensive to use such logic insted of just ignoring it from the list.
    Thanks,
    Karthick.

  • Sender JDBC: help to construct Update statement

    Hi,
    I need help in writing a update statement to DB2 database in sender JDBC adapter.
    The sender adapter picks up only few records say 10 at a time which match the Select query condition. So I would need to update only those selected "n" records and not all the records that match the Select query condition.
    Select looks like :
    Select * from <table> where <condition> fetch first <n> rows only.
    But it is not allowing the following update
    update <table> set <field> = <value> where <field> IN (Select * from <table> where <condition> fetch first <n> rows only)
    The above statement errors because DB2 does not allows u201CFetchu201D statement within the update sub query.
    Any pointers to a write update statement for n records is highly appreciatedu2026
    ~SaNvu2026

    Hi Santosh,
    In JDBC Sender Adapter provide the following select & update statements
    Select Statement:
    select * from <table> where <condition> AND ROWNUM<N (N==No.of Rows)
    Update Statement:
    update <table> set <field> = <value> where <field> IN (Select * from <table> where <condition> AND ROWNUM<N)
    (N==No.of Rows)
    And for the error you are facing is because of the server communication link failure between the two systems.
    Check the connections and try to stop & start communication channels once.
    Regards
    Venkat Rao .G

  • Update statement with Case syntax

    I want to put case statement in an update statement using Oracle 10g
    I'm getting a syntax error on the last line Ora-00933: SQL command not properly ended
    Help please
    UPDATE EMP a
    SET EMP.TYPE = CASE
    WHEN 'Y' = 'A' THEN 'DIV'
    WHEN 'Y' = '1' THEN 'DEF'
    END CASE;

    Hi,
    Samim wrote:
    I want to put case statement in an update statement using Oracle 10g
    I'm getting a syntax error on the last line Ora-00933: SQL command not properly ended
    Help please
    UPDATE EMP a
    SET EMP.TYPE = CASE
    WHEN 'Y' = 'A' THEN 'DIV'
    WHEN 'Y' = '1' THEN 'DEF'
    END CASE;The closing keyword that corresponds to "CASE" is "END", not "END *CASE* ".
    The string 'Y' is never equal to 'A', or to '1'.
    If you have a column named y in the table, then you might want to say:
    UPDATE EMP
    SET EMP.TYPE = CASE
                        WHEN Y = 'A' THEN 'DIV'
                        WHEN Y = '1' THEN 'DEF'
                  END;I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statemnts to re-create your emp table as it exists before the UPDATE), and the results you want from that data (that is, the contents of the emp table after the UPDATE).

  • How update statement works

    Hi all,
    can you guys help me in understanding how an update statement works in oracle...
    Thanks
    Rajesh

    i mean what happens in background in oracle server
    when i fire a update statement.The oracle server puts the old data (i.e before updation) into the RBS and then updates the rows with the new data.
    Regards
    Amit Raghuvanshi

  • Oracle forms 10g,multiple insert and update problem

    Hi,
    I have tabular form(4 records displayed) with one datablock(based on a view).
    After querying the form could not update all the records but only first record value can select from LOV.
    I called a procedure in in-insert and on-update
    The query is lik this
    PACKAGE BODY MAPPING IS
         PROCEDURE INSERT_ROW(EVENT_NAME IN VARCHAR2)
         IS
         BEGIN
              IF (EVENT_NAME = 'ON-INSERT') THEN
                   INSERT INTO XX_REC_MAPPING
                   (BRANCH_CODE,COLLECTION_ID,PAY_MODE_ID,RECEIPT_METHOD,CREATED_BY,
                   CREATION_DATE,LAST_UPDATED_BY,LAST_UPDATE_DATE,LAST_UPDATE_LOGIN)
                   VALUES
                   (     :XX_REC_MAPPING.OFFICE_CODE,
                        :XX_REC_MAPPING.COLLECTION_ID,
                        :XX_REC_MAPPING.PAY_MODE_ID,
                        :XX_REC_MAPPING.RECEIPT_METHOD,
                        :XX_REC_MAPPING.CREATED_BY,
                        :XX_REC_MAPPING.CREATION_DATE,
                        :XX_REC_MAPPING.LAST_UPDATED_BY,
                        :XX_REC_MAPPING.LAST_UPDATE_DATE,
                        :XX_REC_MAPPING.LAST_UPDATE_LOGIN);     
              ELSIF (EVENT_NAME = 'ON-UPDATE') THEN          
              UPDATE     XX_REC_MAPPING
              SET BRANCH_CODE=:XX_REC_MAPPING.OFFICE_CODE,
                        COLLECTION_ID=:XX_REC_MAPPING.COLLECTION_ID,
                        PAY_MODE_ID=:XX_REC_MAPPING.PAY_MODE_ID,
                        RECEIPT_METHOD=:XX_REC_MAPPING.RECEIPT_METHOD,
                        LAST_UPDATED_BY=:XX_REC_MAPPING.LAST_UPDATED_BY,
                        LAST_UPDATE_DATE=:XX_REC_MAPPING.LAST_UPDATE_DATE,
                        LAST_UPDATE_LOGIN=:XX_REC_MAPPING.LAST_UPDATE_LOGIN
                        WHERE ROWID=:XX_REC_MAPPING.ROW_ID;
              END IF;
         END INSERT_ROW;
    END MAPPING;
    Whether the table gets looked or sholud i use some other trigger or loops ?
    someone suggest me how to edit this query for multiple update.
    Thanks
    sat33

    I called a procedure in in-insert and on-updateWhy are you writing this code in the first place? If you have a block based on an updatable view, just let Forms do the inserts and updates.
    If it's not an updatable view, use instead of triggers on the view.
    See this current thread too:
    INSTEAD of Trigger View for an Oracle EBS New form development

  • Unable to do UPDATE in Oracle Form 10.1.2

    Hi,
    I am using an LOV to query data from a master-type table.
    -- WHEN-BUTTON-PRESSED in button Retrieve
    declare
      l_number number;
      a_value_chosen boolean;
    begin
      a_value_chosen := Show_LOV('LOV_CUSTOMER');
      if not a_value_chosen then
        message('No value selected');
        raise form_trigger_failure;
      end if;
    end;First, I choose a value from the LOV. The LOV showed the selected items in the Form.
    Next, I modified some values (not the Primary Key) in the Form text items.
    Finally, I tried to Save the modification into table, using
    -- WHEN-BUTTON-PRESSED in button Save
      commit_form;
      clear_form;Surprisely, it showed
    FRM-40508: ORACLE error, unable to INSERT record.
    BTW,
    Previuosly, I can do UPDATE if I use the Enter Query and Execute Query button.
    I did not attempt to do inserting, just updating.
    Could someone show where is the problem?
    Is the form status not changed by the query returned from LOV?
    Any help would be grateful.
    Many thanks,
    Imelda

    Hi,
    Glad I found all of you in this forum.
    Thanks for all of the explanations.
    I thought by using LOV would suppress the network traffic.
    If the use of LOV would give lots of drawbacks, then I should see the Enter_Query() Execute_Query() instead.
    BTW,
    I found the button Enter Query and Execute Query on the toolbar.
    (Seems that Oracle Form provides lots of help to simplify the programming)
    I have some sort of problems in using them :
    1. Well, they do the query and retrieve the records for a match query criteria.
    But it did not give any specific message if the record does not exist.
    The message bar (for unknown reason) is showing
    "Enter a query; press CTRL+F11 to execute, F4 to cancel."
    Can we change this behaviour?
    Perhaps, showing "No record(s) are retrieved for this query. Either change the query criteria; press CTRL+F11 to execute, F4 to cancel."
    2. I found the Count Hits from Query menu.
    Based on the documentation, the message line will show the records number returned based on query
    criteria, without actually retruning the records to the user.
    I am not sure whether this function has been removed for the Oracle Developer 10g (10.1.2), since
    there is nothing happen, and the message line keep showing
    "Enter a query; press CTRL+F11 to execute, F4 to cancel."
    Do we tho do some modification to the Forms to use Count Hits?
    3. I read on the documentation about Query Where dialog box.
    Query Where will be showed if user enter a colon ':' in a field in Enter Query mode for query criteria.
    Again, I am not sure whether this function has been removed too.
    the message line showed :
    FRM-40367: Invalid criteria in field <field_name> in example record.
    It happens if the criteria contains # or : or &
    Or is it done via another way?
    Any help would be grateful.
    Many thanks,
    Imelda.

Maybe you are looking for