Trigger on update which delete updated record

Hello,
First I'm french so my english isn't very good.
I use an Oracle8i database with a VB program.(This program run also with SQL Server)
When a specific field is updating, I would like deleting the record updated, but only when this specific is updated. In other case, I would like to have the update statement.
I made a trigger "after update".
When I tried to do this , I had the message that "table or record is in "mutation" (in french) : his state is changing.
So I created a view on table as "select * from table where ...." and I used a trigger "instead of update" on the view. It works when I update the specific field but in the other case the update command don't work (it's normal).
Is it possible to make a "generic" update statement (as I have this functionality on every table of my database) ?
=> I tried to write the update command in a variable with a loop on user_tab_columns table to have the list of columns and "EXECUTE variable" but it doesn't work.
=> I don't find the possibility to activate a trigger "instead of" only when some columns are updated.
=> ..... ???? If some one have an idea ?????
Stephane Doussiere

The best you can do is put this code in a procdeure. Pass in the tablename as a parameter and use EXECUTE IMMEDIATE to action the delete.
Then you can generate the triggers (and views) using the data dictionary.
In passing I have to say this strikes me as a bizarre way of doing things. This is why many of us regard the INSTEAD OF trigger as a bad thing; because it's not intuitive - I update a record I expect it to be updated, not deleted. Mind you, at least it's all the tables in the database, so you are consistent, which helps.
Cheers, APC

Similar Messages

  • Error while updating or deleting a record

    Hi to all...
    i have created atable group_master with 2 fields Group_id and Group_name
    the user will specify a group_name in a text box and press save. Before commiting a seq number will be generated
    inside the form procedure and it will be inserted.
    The insert is working fine.
    But when i select a record i.e a group_name and change it contents and commit it, it is not commiting.
    when i checked the display error it showed Ora-01400 cannot insert null values into the table.
    Iam not inserting a value here iam updating the group name only.
    even when i delete a record it shows same error....
    can any one help to solve this....
    thanx in advance........

    I have when button pressed trigger whick helps to show the lov which contains the group_id and group_name;
    a := show_lov('lov27');
    if a then
    go_block('group_master');
    execute_query;
    end if;
    it is correctly fetching the delected data. but propmpts a message box asking Do u want to save the record?
    if i ignore it n modify the group_name and save it,still it shows unable to insert null value.
    i jus want a simple way to solve this....
    i want to fetch that particular record and modify or delete it.
    group_id n group_name cannot be null.
    i will be using Buttons for add,delete,update and save record. i will be using lov to fetch records for modification or deletion.
    how to avoid the message box which prompts when i call lov with execute_query.....
    * I tried Key-listval...but i didnt get any solution. i will try again....
    thanx for ur replies....

  • Query for deleting the minimum updated record.

    Hello Everybody,
    I have table USER_RECENT_PROJECTS which has SIX columns USER_NAME,PROJECT_ID,CREATED_BY,CREATED_ON,UPDATED_BY
    and UPDATED_ON.The purpose of having this table to get 5 recent PROJECTS
    on which user has worked on.
    I have trigger called RECENT_PRJ_TRIGG which IS FIRED when the data is inserted or updated on PROJECT table.After this trigger calls procedure PROC_USER_RECENT_PRJ and that procedure puts the data in this table.
    It is inserting the data upto 5 records when the six records comes it deleting the record which is least UPDATED_ON from the table USER_RECENT_PROJECTS but the problem is it is deleting
    the record from other user that i don't want.I want to delete the the record which is
    least UPDATED_ON from particular user.
    Please help me on this issue.
    Here is the trigger
    CREATE TRIGGER RECENT_PRJ_TRIGG
    AFTER INSERT OR UPDATE ON PROJECT
    FOR EACH ROW
    DECLARE
    NUMBER_OF_PROJECTS NUMBER:=0;
    EXISTING_PROJECT_ID NUMBER:=0;
    BEGIN
    SELECT COUNT(*) INTO NUMBER_OF_PROJECTS FROM USER_RECENT_PROJECTS WHERE USER_NAME=:NEW.UPDATED_BY;
    SELECT PROJECT_ID INTO EXISTING_PROJECT_ID FROM USER_RECENT_PROJECTS WHERE PROJECT_ID=:NEW.PROJECT_ID AND USER_NAME=:NEW.UPDATED_BY;
    NVLX.PROC_USER_RECENT_PRJ(NUMBER_OF_PROJECTS,:NEW.PROJECT_ID,EXISTING_PROJECT_ID,:NEW.UPDATED_BY,:NEW.CREATED_BY,:NEW.CREATED_ON);
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NVLX.PROC_USER_RECENT_PRJ(NUMBER_OF_PROJECTS,:NEW.PROJECT_ID,0,:NEW.UPDATED_BY,:NEW.CREATED_BY,:NEW.CREATED_ON);
    END;
    And this is the procedure which is inserting the data
    CREATE OR REPLACE PROCEDURE PROC_USER_RECENT_PRJ (
                   NUMBER_OF_PROJECTS IN NUMBER,
                   NEW_PROJECT_ID IN PROJECT.PROJECT_ID%TYPE,
                   EXISTING_PROJECT_ID IN USER_RECENT_PROJECTS.PROJECT_ID%TYPE,
                   USER_NAME IN CONTENT_USER.USER_NAME%TYPE,
                        CREATED_BY IN PROJECT.CREATED_BY%TYPE,
                        CREATED_ON IN PROJECT.CREATED_ON%TYPE)
              IS
                                  MAX_RECENT_PROJECTS NUMBER := 5;
              BEGIN
                        IF NUMBER_OF_PROJECTS<=MAX_RECENT_PROJECTS AND EXISTING_PROJECT_ID=NEW_PROJECT_ID THEN
                             UPDATE USER_RECENT_PROJECTS SET USER_RECENT_PROJECTS.UPDATED_ON=SYSDATE,USER_RECENT_PROJECTS.UPDATED_BY=USER_NAME WHERE PROJECT_ID=EXISTING_PROJECT_ID
                             AND USER_RECENT_PROJECTS.USER_NAME=USER_NAME;
                        ELSE IF NUMBER_OF_PROJECTS<MAX_RECENT_PROJECTS AND EXISTING_PROJECT_ID!= NEW_PROJECT_ID THEN
                        INSERT INTO USER_RECENT_PROJECTS VALUES (USER_NAME,NEW_PROJECT_ID,CREATED_BY,CREATED_ON,USER_NAME,SYSDATE);
                        ELSE IF NUMBER_OF_PROJECTS=MAX_RECENT_PROJECTS AND EXISTING_PROJECT_ID!= NEW_PROJECT_ID THEN
                        DELETE FROM USER_RECENT_PROJECTS WHERE USER_RECENT_PROJECTS.PROJECT_ID IN(
                                       SELECT PROJECT_ID FROM USER_RECENT_PROJECTS
                                                 WHERE UPDATED_ON=(SELECT MIN(UPDATED_ON) FROM USER_RECENT_PROJECTS
                                  WHERE USER_RECENT_PROJECTS.USER_NAME=USER_NAME));
                   INSERT INTO USER_RECENT_PROJECTS VALUES (USER_NAME,NEW_PROJECT_ID,CREATED_BY,CREATED_ON,USER_NAME,SYSDATE);
                        END IF;
                        END IF;
                        END IF;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NVLX.PROC_USER_RECENT_PRJ(NUMBER_OF_PROJECTS,NEW_PROJECT_ID,0,USER_NAME,CREATED_BY,CREATED_ON);
    END PROC_USER_RECENT_PRJ;
    Please help me on this issue.
    Thanks in advance.....

    Thanks for your suggestion....
    I am using the trigger for populating the data in USER_RECENT_PROJECTS.This
    trigger is fired when data is INSERTED or UPDATED in PROJECT table.And that trigger will call the procedure PROC_USER_RECENT_PRJ.This is used
    to put data in USER_RECENT_PROJECTS table.I am getting the problem in procedure the problem is upto five records it is inserting the record when i go for insert sixth record it should delete least UPDATED_ON and insert new record.But it is deleting the record from other user that i don't want.I want to delete the record from the paarticular user.I am using this query for deleting the record..
                   DELETE FROM USER_RECENT_PROJECTS WHERE USER_RECENT_PROJECTS.PROJECT_ID=(
         SELECT PROJECT_ID FROM USER_RECENT_PROJECTS
                        WHERE UPDATED_ON=(SELECT MIN(UPDATED_ON) FROM USER_RECENT_PROJECTS WHERE USER_RECENT_PROJECTS.USER_NAME=USER_NAME)
                             AND USER_RECENT_PROJECTS.USER_NAME=USER_NAME
                   ) AND USER_RECENT_PROJECTS.USER_NAME=USER_NAME;
    when i fire this query individually it is deleting the proper record,but when i use it
    inside procedure it is creating the problem it is deleting the record from other user.
    Please suggest me other query for deletion.
    Thanks in advance.......

  • Update and delete a record

    Hi all
    I have a requirement in oracle forms 6i
    I have a data block which is tabular
    there are 5 columns
    1 column is display only and other 4 are normal text fields where we can insert update and delete those records
    My requirement is when a user updates a record an alert must fire and the alert should ask whether the user wants to update that particular record
    if the user presses yes then the record should be updated else the record should show as it was previously shown
    Similarly in case of delete an alert should fire where it should be asked for confirmation if the user presses yes then the record should be deleted from the data base
    else the record should be again visible on the form as earlier
    also my 3rd requirement is that
    i have a item field which is normal text and the display only field is the description
    when entering a new record when i enter the item field and press tab or navigate out of the item field then the description of the item should be pouplated into the decsription read only field
    Please help me in the above 3 cases
    I am new to forms
    I am using a friends ID which has many posts
    Thanks in advance

    1)
    your first requirement i'd do in the PRE-UPDATE trigger of the block:
    DECLARE
        v_alert_button NUMBER;
    BEGIN
        v_alert_button := SHOW_ALERT('your_alert'); -- "Do you want to update?"
        IF v_alert_button = ALERT_BUTTON1 -- assuming "No"
        THEN
            -- reset value:
            :YOUR_BLOCK.YOUR_ITEM1 := GET_ITEM_PROPERTY('YOUR_BLOCK.YOUR_ITEM1', DATABASE_VALUE);
            -- optionally set item to valid if you don't want validations to fire:
            SET_ITEM_PROPERTY('YOUR_BLOCK.YOUR_ITEM1', ITEM_IS_VALID, PROPERTY_TRUE);
            -- do this for every item:
            :YOUR_BLOCK.YOUR_ITEM2 := GET_ITEM_PROPERTY('YOUR_BLOCK.YOUR_ITEM2', DATABASE_VALUE);
            -- finally reset record status:
            SET_RECORD_STATUS(:SYSTEM.CURSOR_RECORD, STATUS, QUERY_STATUS);
            -- interrupt PRE-UPATE trigger:
            RAISE FORM_TRIGGER_FAILURE;
        END IF;
    END;(not tested, please try for youself)
    2)
    raise the alert in PRE-DELETE trigger.
    3)
    you can do this within the WHEN-VALIDATE-ITEM trigger or a List-of-value (LOV) that returns the description values.

  • How can i display recent update/delete/insert records in form

    Hai !!!!
    i am new for forms,.......any body tell me, how can i display recent no of records updated or no of records deleted or no of records are inserted in a form. these records count are display in display items....give me detail explination......
    Subbu.....

    the easiest way is copy and paste the oracle-forms example from the OU.
    You need form-level-trigger ON-ERROR + ON-MESSAGE, POST-INSERT, POST-UPDATE, POST-DELETE, three global variables and a procedure:
    ON-ERROR
    handle_message( error_code, 'ERROR: ' || ERROR_TYPE || '-' || TO_CHAR(ERROR_CODE) ||': '|| ERROR_TEXT );
    ON-MESSAGE
    handle_message( message_code, MESSAGE_TYPE || '-' || TO_CHAR(MESSAGE_CODE) || ': ' || MESSAGE_TEXT );
    PROCEDURE handle_message( message_number IN NUMBER, message_line IN VARCHAR2 ) IS
    BEGIN
        IF message_number IN ( 40400, 40406, 40407 )
        THEN
          DEFAULT_VALUE( '0', 'GLOBAL.insert' );
          DEFAULT_VALUE( '0', 'GLOBAL.update' );
          DEFAULT_VALUE( '0', 'GLOBAL.delete' );
          MESSAGE('Save Ok: ' ||
            :GLOBAL.insert || ' records inserted, ' ||
           :GLOBAL.update || ' records updated, ' ||
           :GLOBAL.delete || ' records deleted !!!' );
          ERASE('GLOBAL.insert'); 
          ERASE('GLOBAL.update');
          ERASE('GLOBAL.delete');
        ELSE
             MESSAGE(message_line );
              END IF;
    END;
    POST-INSERT
    DEFAULT_VALUE('0', 'GLOBAL.insert');
    :GLOBAL.insert := TO_CHAR( TO_NUMBER( :GLOBAL.insert ) + 1 );
    POST-UPDATE
    DEFAULT_VALUE('0', 'GLOBAL.update');
    :GLOBAL.update := TO_CHAR( TO_NUMBER( :GLOBAL.update ) + 1 );
    POST-DELETE
    DEFAULT_VALUE('0', 'GLOBAL.delete');
    :GLOBAL.delete := TO_CHAR( TO_NUMBER( :GLOBAL.delete ) + 1 );try it
    Gerd

  • Delete and update records in Stored procedures

    I AM NOW STUDYING A STORED PROCEDURE ,AND I ENCOUNTER SOME PROBLEM WITH
    UPDATE AND DELETE SOME RECORD WHICH ONE IS UPDATED OR DELETED,
    THIS IS MY CODE:
    PACKAGE table_of_array IS
    type emp_rec is record(
         empno emp.empno%type,
         ename emp.ename%type,
         sal          emp.sal%type,
         deptno emp.deptno%type
    type arr is table of emp_rec
    index by binary_integer;
    procedure get_data(a in out table_of_array.arr);
    procedure do_insert(a in out table_of_array.arr);
    procedure do_update(a in out table_of_array.arr);
    procedure do_delete(a in out table_of_array.arr);
    END;
    PACKAGE BODY table_of_array IS
    procedure get_data(a in out table_of_array.arr)
    is
    i number:=0;
    begin
         for cur in (select empno,ename,sal,deptno from emp) loop
              a(i):=cur;
              i:=i+1;     
         end loop;
    end;
    procedure do_insert(a in out table_of_array.arr)
    is
         i number:=0;
         cnt number:=a.count;
    begin
         for i in 1..cnt loop
              insert into emp(empno,ename,sal,deptno)
              values(a(i).empno,a(i).ename,a(i).sal,a(i).deptno);
         end loop;
    end;
    procedure do_update(a in out table_of_array.arr)
    is
    begin
         /* WHICH RECORD AND ITEM HAD BEEN UPDATED */
    end;
         procedure do_delete(a in out table_of_array.arr)
         is
         begin
         /* WHICH RECORD HAD BEEN DELETED */      
         end;
    END;

    when you want to update, delete or insert records with a stored procedure you have to provide a procedure that locks the records
    i'll send you an example of an update procedure and a lock procedure
    PROCEDURE p_upd_devices ( resultset IN devtab) IS
    BEGIN
    FOR i IN 1..resultset.COUNT LOOP
              IF resultset(i).zone <> resultset(i).zone_ref THEN
              p_update_zone(resultset(i).zone, resultset(i).mdv_seq);
              END IF;
         END LOOP;
    EXCEPTION WHEN OTHERS THEN
    mecoms_general.logging(0, sqlerrm, 'pck$fill_error_devices.p_upd_devices');
    END; -- p_upd_devices
    PROCEDURE p_update_zone (pi_zone in metering_devices.zne_code%type, pi_device in metering_devices.seq%type) IS
    PRAGMA AUTONOMOUS_TRANSACTION;
    BEGIN
              UPDATE metering_devices
                   SET zne_code = pi_zone
                   WHERE seq = pi_device;
                   commit;
    EXCEPTION WHEN OTHERS THEN
    mecoms_general.logging(0, sqlerrm, 'pck$fill_error_devices.p_update_zone');
    END;
    PROCEDURE p_lock_devices( resultset IN OUT devtab) IS
    BEGIN
    null;
    END;

  • SUN TEAM: Bugs in update and delete a record with long query

    Creator Team,
    In my opinio there is a bug issue with update and delete a record with a complex sql query. I�m using oracleXE and ojdbc14.ar with tomcat
    In just two page I�m receving the following msg (I have 12 pages doing the same thing with less complex queries)
    * Number of conflicts while synchronizing: 1 SyncResolver.DELETE_ROW_CONFLICT row 2 won't delete as values in database have changed: 2006-11-29
    * Cannot commit changes: Number of conflicts while synchronizing: 1 SyncResolver.UPDATE_ROW_CONFLICT row 0 values changed in database
    when i tried to delete or commit the updated changes in the register...
    The interesting is that this code function with jdbc of jsc...
    My query is bellow:
    SELECT ALL PATRIMONIO.TB_BEM.INCODIGOBEM,
    PATRIMONIO.TB_BEM.VATOMBAMENTO,
    PATRIMONIO.TB_BEM.VAMATERIAL,
    PATRIMONIO.TB_BEM.INCODIGOSETOR,
    PATRIMONIO.TB_SETOR.VANOME AS NOMESETOR,
    PATRIMONIO.TB_BEM.INCODIGOFORNECEDOR,
    PATRIMONIO.TB_FORNECEDOR.VANOME AS NOMEFORNECEDOR,
    PATRIMONIO.TB_BEM.DACHEGADA ,
    PATRIMONIO.TB_BEM.DASAIDAPREVISTA,
    PATRIMONIO.TB_BEM.DASAIDAEFETIVA,
    PATRIMONIO.TB_BEM.VAMARCA,
    PATRIMONIO.TB_BEM.VAMODELO,
    PATRIMONIO.TB_BEM.VADESBAIXABEM,
    PATRIMONIO.TB_BEM.INCODIGOTIPOAQUISICAO,
    PATRIMONIO.TB_TIPOAQUISICAO.VANOME AS NOMETIPOAQUISICAO
    FROM PATRIMONIO.TB_BEM , PATRIMONIO.TB_TIPOAQUISICAO, PATRIMONIO.TB_SETOR, PATRIMONIO.TB_FORNECEDOR
    WHERE PATRIMONIO.TB_BEM.INCODIGOTIPOAQUISICAO = PATRIMONIO.TB_TIPOAQUISICAO.INCODIGOTIPOAQUISICAO
    AND PATRIMONIO.TB_BEM.INCODIGOSETOR = PATRIMONIO.TB_SETOR.INCODIGOSETOR
    AND PATRIMONIO.TB_BEM.INCODIGOFORNECEDOR = PATRIMONIO.TB_FORNECEDOR.INCODIGOFORNECEDOR
    AND PATRIMONIO.TB_BEM.INCODIGOBEM LIKE ?
    AND PATRIMONIO.TB_BEM.VATOMBAMENTO LIKE ?
    AND PATRIMONIO.TB_BEM.VAMATERIAL LIKE ?
    AND PATRIMONIO.TB_SETOR.VANOME LIKE ?
    AND PATRIMONIO.TB_FORNECEDOR.VANOME LIKE ?
    ORDER BY PATRIMONIO.TB_BEM.VATOMBAMENTO ASC
    Why this problem is happing? Did you had some solution for that? Is the problem because the query is too long?!
    please help me!
    Gustavo Callou

    Hello people,
    I�m doing this to try to solution that bug:
    This code is working fine... but I do not understand why I�m receiving the nullpointer exception!??!!?
    // create a new rowset
    CachedRowSetXImpl pkRowSet = new CachedRowSetXImpl();
    try {
    RowKey rk = tableRowGroup1.getRowKey();
    if (rk != null) {
    // set the rowset to use the Patrimonio database
    pkRowSet.setDataSourceName("java:comp/env/jdbc/Patrimonio");
    String query = "DELETE FROM TB_BEM WHERE INCODIGOBEM = "+tb_bemDataProvider.getValue("INCODIGOBEM", rk).toString();
    pkRowSet.setCommand(query);
    pkRowSet.setTableName("TB_BEM");
    // execute the rowset -- which will contain a single row and single column
    pkRowSet.execute();
    pkRowSet.next();
    info("Apagado");
    } catch (Exception ex) {
    log("ErrorDescription", ex);
    error(getApplicationBean1().trateException(ex.getMessage()));
    } finally {
    pkRowSet.close();
    Please someone help me!!!
    Gustavo Callou

  • Update new records and delete old record? Urgent

    Iam updating some records from internal table to Data base table.
    Please suggest me
    INSERT DBTable FROM TABLE itab.     
    UPDATE DBTable FROM  itab.
    Delete existing records.
      DELETE  DBTable FROM TABLE itab_old.
    Please suggest me

    Got you..
    Iam colecting some records to internal table from Data base table
    based on year and month.
    Then changing the date and months in interenla table
    then inserrting this modified records of internal table into datta base table.
    Finaly delete the old records with old dates.
    Here is the suggestion..This is a logic and not the exact code..
    DATA: ITAB TYPE STANDARD TABLE OF ZTABLE WITH HEADER LINE.
    DATA: ITAB_OLD TYPE STANDARD TABLE OF ZTABLE WITH HEADER LINE.
    SELECT * FROM ZTABLE
           INTO TABLE ITAB.
    ITAB_OLD = ITAB.
    ITAB-NEW_DATE = SY-DATUM.
    MODIFY ITAB TRANPORTING NEW_DATE WHERE KEY_FIELD = 'DS'.
    Deletion part.
    DELETE ZTABLE FROM TABLE ITAB_OLD.
    Insertion part
    INSERT ZTABLE FROM TABLE ITAB.
    Thanks,
    Naren

  • CS5 Update Record behaior deletes the record

    Hello
    I am having an issue that I just cant seem to understand or resolve.
    I am using the CS5 Update Record Server Bahavior to update the user table for a website, but instead if updating the record, it deletes the entire record.
    I look at the SQL and it is definately an Update, so I dont see how it deleting the entire record.
    What I did:
    Passed in record ID through querystring to get the filtered recordset
    Created update form for dynamic data (the corrent data is filling form from recoredset)
    Created hidden field to hold ID
    Clicked the Update Record Server Behavior and matched form variables to appropriate DB fields
    Set it to go to page to list all users
    Saved page
    Run on local server (php/MySQL)
    When I edit the user  data in the update form and click submit, the record is deleted.
    * I checked the MySQL DB and the entire recored has been deleted
    Anyone have a clue on why this is happening?
    Here's the code from the page:
    <?php require_once('../Connections/localconn.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "updateuser")) {
      $updateSQL = sprintf("UPDATE users SET fname=%s, lname=%s, uname=%s, password=%s, ulevel=%s WHERE id=%s",
                           GetSQLValueString($_POST['fname'], "text"),
                           GetSQLValueString($_POST['lname'], "text"),
                           GetSQLValueString($_POST['uname'], "text"),
                           GetSQLValueString($_POST['pword'], "text"),
                           GetSQLValueString($_POST['ulevel'], "int"),
                           GetSQLValueString($_POST['id'], "int"));
      mysql_select_db($database_localconn, $localconn);
      $Result1 = mysql_query($updateSQL, $localconn) or die(mysql_error());
      $updateGoTo = "users.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
        $updateGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $updateGoTo));
    $colname_Recordset_users = "-1";
    if (isset($_GET['id'])) {
      $colname_Recordset_users = $_GET['id'];
    mysql_select_db($database_localconn, $localconn);
    $query_Recordset_users = sprintf("SELECT * FROM users WHERE id = %s", GetSQLValueString($colname_Recordset_users, "int"));
    $Recordset_users = mysql_query($query_Recordset_users, $localconn) or die(mysql_error());
    $row_Recordset_users = mysql_fetch_assoc($Recordset_users);
    $totalRows_Recordset_users = mysql_num_rows($Recordset_users);
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Title</title>
    <meta http-equiv="Content-Language" content="English" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <META NAME="ROBOTS" CONTENT="NOINDEX, FOLLOW">
    <link rel="stylesheet" type="text/css" href="style.css" media="screen" />
    </head>
    <body>
    <div id="wrap">
    <div id="top"></div>
    <div id="content">
    <div class="header">
    <h1><a href="#">FENA </a></h1>
    <h2>Content Management System (CMS)</h2>
    </div>
    <div class="breadcrumbs">
    <a href="#">Home</a> &middot; Edit User
    </div>
    <div class="middle">
    <h2>Edit User - <?php echo $row_Recordset_users['lname']; ?>, <?php echo $row_Recordset_users['fname']; ?></h2>
    <form method="POST" action="<?php echo $editFormAction; ?>" name="updateuser"> 
    <table>
    <tr>
         <td>Last Name</td>
            <td><input name="lname" type="text" value="<?php echo $row_Recordset_users['lname']; ?>" /></td>
        </tr>
        <tr>
         <td>First Name</td>
            <td><input name="fname" type="text" value="<?php echo $row_Recordset_users['fname']; ?>" /></td>
        </tr>
        <tr>
         <td>Username</td>
            <td><input name="uname" type="text" value="<?php echo $row_Recordset_users['uname']; ?>" /></td>
        </tr>
        <tr>
         <td>Password</td>
            <td><input name="pword" type="text" value="<?php echo $row_Recordset_users['password']; ?>" /></td>
        </tr>
        <tr>
         <td>User Level</td>
            <td>
             <select name="ulevel">
                 <option value="<?php echo $row_Recordset_users['ulevel']; ?>"><?php echo $row_Recordset_users['ulevel']; ?></option>
                    <option value="1">Admin</option>
                    <option value="2">Editor</option>
                </select>
            </td>
        </tr>
        <tr>
         <td colspan="2" align="right"><input name="id" type="hidden" value="<?php echo $row_Recordset_users['id']; ?>" /><input name="submit" type="submit" value="Submit" /></td>
        </tr>
    </table>
    <input type="hidden" name="MM_update" value="updateuser" />
    </form>
    </div>
    <div class="right">
    <h2>Navigation</h2>
    <ul>
    <li><a href="index.php">Home</a></li>
    <li><a href="users.php">Users</a></li>
    <li><a href="users_add.php">Add User</a></li>
    </ul>
    </div>
    <div id="clear"></div>
    </div>
    <div id="bottom"></div>
    </div>
    <div id="footer">
    Developed by Me
    </div>
    </body>
    </html>
    <?php
    mysql_free_result($Recordset_users);
    ?>

    Hi Paul,
    I am actually try to a create a submit a process and have it to update the DB.
    Thanks,
    Han

  • TS4062 ive recently updated my IOS, which deleted my music and apps, and it is now not allowing me to press sync, any help?

    ive recently updated my IOS, which deleted my music and apps, and it is now not allowing me to press sync, any help?

    The next iOS update won't change this.
    Are you able to transfer anything else from your iTunes library and computer via the iTunes sync process such as a movie, TV show, podcast, audio or print book, apps, and photos from your computer?
    What is selected under the Music tab for your iPhone sync preferences with iTunes.

  • Deleting/Updating records from an object table in PL/SQL

    Hello All,
    VER:
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE     11.2.0.3.0     Production
    TNS for Linux: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    I have created an object and inserted records in it. Is there any way we can delete/update records from it. I do not want to delete based on iteration like delete.collection but I would like to know if we can delete directly from obj like delete from table...
    CREATE OR REPLACE TYPE test_type AS OBJECT
    col1 number,
    col2 varchar2(100)
    CREATE OR REPLACE TYPE tab_type is table of test_type;
    DECLARE
    test_tab tab_type;
    l_cnt NUMBER;
    BEGIN
    select test_type(col1,col2) bulk collect
    into test_tab from (select 1 as col1,'test1' as col2 from dual
                        union all
                        select 2,'test2' from dual);
    IF test_tab.count>0
    THEN
    DELETE FROM TABLE(CAST(test_tab as tab_type)) a
    where a.col1=1;
    END IF;
    l_cnt := test_tab.count;
    END;Thx
    Shank.

    SB,
    I have a scenario wherein I insert few records into a collection table. I'm gonna filter few records from collection table based on the filter.
    I want to delete the records that didn't match the filter. Right now, I'm inserting the records into a physical table and deleting from there. I do no want to use a physical table. Trying to avoid it.
    Would like to delete from collection itself.
    DELETE FROM TABLE(CAST(lv_attr_filter_tab as EDMS_CSPP_DISC_REQ_TAB_TYPE))
                                 WHERE NOT EXISTS (SELECT 1
                                       FROM edms_disc_lines_stg edls
                                       WHERE edls.req_id = edrg.request_id
                                          AND edls.disc_line_id = edrg.discount_id
                                          AND UPPER(edls.disc_status) IN ('ACTIVE');

  • How to change the status of updated record?

    Hi All,
    how to change the status of updated record?
    new record should be active version(X) and old version will be deleted.
    Plz suggest..
    Thanks in advance...

    Steve,
    In the actual question, you mentioned that the old record needs to be deleted and hence the solution provided.
    Now, you are talking about field. May I know which field are you talking about??
    Jst get in to ABAP Editor and try debugging the code with the solution provided and let us know if that is working fine or not.
    Also, I recommend you to take a look at the transaction ABAPDOCU. There you wil find hell lot of examples explaining all the scenarios. You will get a good idea .
    Please check that and try to implement it yourself. You will be able to make it after doing mistakes.
    If you stuck up again after many attempts, paste your code here. We will help you out
    Hope you got my concern.
    Thanks,
    Babu Kilari

  • Unable to update record in web Form

    Hi, i am unable to update record in a form. I am building a custom form using forms 6i and putting it on the web in oracle applications 11.5.9
    I used template.fmb as a starting point for my form. I have one datablock based on a table. Insert, update and delete properties are set to yes on the property pallete of data block. The table against which i am running the form has a primary key which is a combination of two fields. I am able to update a record with pure SQL running against the table.
    My form now brings back a record from the db like it should but whenever I try to update that record either by pressing Action Save or by clicking button that has update statement in it, instead of doing an update, it does an insert and tells me that this record already exists and that i entered value(s) that must be unique for each record. It thinks I want to insert but I want to update. What am i doing wrong???
    Update allowed value is set to Yes in all the items in the data block and at the data block level as well. Querly_only is set to no.
    What's even more frustratinng is that I've ran the form manually before starting with template.fmb and have been able to update the table but when I put it on the web and used template.fmb it stopped working!
    I am very new to forms, can anybody suggest anything? Please help!!!

    When you populate the 2nd block with a select into query, it's the same as just typing the data into the block. The record is treated as one needing to be inserted, not as one that is queried.
    To populate it using a true query, but with data from the LOV, you can do this:
    Programmatically set the default_where clause of the block based on the LOV. For example, if a name is chosen from the LOV in an item called LOV1, you could do:
    set_block_property('block2','default_where','name='''||:block1.lov1||'''');
    or if the LOV is a number, like a department number:
    set_block_property('block2','default_where','deptno='||:block1.lov1);
    The tricky part when you build your where clause is that you must surround strings with single quotes, and the way to do this is to use two single quotes to represent an actual single quote in the where clause. Otherwise a single quote is interpreted as part of the PL/SQL syntax.
    Then, just navigate to block 2 and execute a query:
    go_block('block2');
    do_key('execute_query');
    I hope this works for you. I didn't have time to test this, so I hope I didn't make any syntax errors when typing.

  • Creating a Trigger for Deleting the records from a parent Table

    I am new to creating Trigger
    We will need several small tables that will be used to store any records that are deleted by the owner of the table. These will likely need a trigger where we would Delete from the parent table and on that Delete populate the child table with the previous record's data.
    Please give me a pseudo code for this
    Thanks
    John
    Edited by: user10750995 on Dec 30, 2008 9:06 AM

    Something like this:
    CREATE OR REPLACE TRIGGER trg_my_table_hist
    AFTER DELETE
    ON my_table
    FOR EACH ROW
    BEGIN
    INSERT INTO Hist_MyTable
    ( column1, column2, ..., DELETION_DATE)
    VALUES
    (:OLD.column1, :OLD.column2, ...., SYSDATE);
    END;
    /My_Table is your main table. When a row is deleted, the trigger will be fired and copy the deleted row to another table called Hist_My_Table. I'm supposing that the history table has all columns as they are defined in main tables plus a column named DELETION_DATE.
    My experience indicates that, probably, it's a good idea maintain update history and the user. But it depends on your requests.
    Regards,
    Miguel

  • Update record in Pre-update

    Hi all,
    I got the master-detail block, where only certain field in child block for which are allow to updated. Hence, i have the update statement in pre-update trigger.
    UPDATE OT_PO_ITEM_DEL SET PID_UPD_UID = 'BC'
    WHERE PID_PI_SYS_ID = :OT_PO_ITEM.PI_SYS_ID;
    :ot_po_item[ block name].pi_sys_id[FK to pid_pi_sys_id]
    I am not sure why the above simple statement does not work ? But if I click on the default save button in form. The records being saved however the field i am try to update is not visible from user and I need to pass the default paramenter via pre-update which is without user's entry.
    Please helps. Thanks.

    May be that:
    loop
       v_name := :system.cursor_item;     
       v_r := name_in(v_name);     
       -- you check, you have name item and value
       exit when replace(v_name, 'BLOCK1.', '') = Get_Block_property('BLOCK', Last_Item);     
       next_item; 
    end loop;    

Maybe you are looking for

  • Purchasing: Restriction of creation of PO's on the basis of buyer / user

    Hi, We are currently working on a requirement in which the business is expecting to restrict the buyers / users from creating Purchase Orders of some specific GL natural accounts. Is there any functionality using which we can provide lock / check on

  • QM02 long text without log

    Hi All, I was trying to get the Notification long text from QM02 transaction into my script.So,the client requirement was not to get the auto generated lof text.I have tried if it is stored in any table but could not find it.If I write the include st

  • Video Tab in Itunes missing!!!  Where did it go??

    I just recently got an iPod Video and installed Itunes and have spent the past few days getting it loaded with stuff. I have some small videos that were suitable to play on it so I installed those and things were good. Tested them, they installed fin

  • New glitches in FCP 7

    New glitches are showing up in FCP 7 after I add a transition or layer to my videos that look like a split-second zoom in/out. I can't see them moving frame-by-frame but I can in playback AND after exporting. I'm not doing anything new. What's going

  • Does Adobe officially support running Photoshop on VMware?

    I need to convert from discrete servers running Photoshop for an image resizing function to a VMware/blade server environment. Does Adobe officially support running Photoshop on VMware? Also, what versions of ESX are currently tested and supported? I