How to update the value of a column when a row is deleted

Hi,
My requirement is basically i have a table .Below is a sample data along with sample data
Column A Column B ColumnC
1 SAM 0
2 RAM 0
Now if i run a delete statement saying
delete from Table where ColumnA =1 then i want to see the value of ColumnC to be updated as 1.The row shouldnt be deleted however the value of ColumnC should be changed to 1.
Can someone please help me with any suggestions? I can create a trigger but i havent worked with triggers so not sure on how to use it.
Please let me know if i am unclear or if you need any details.
Thanks

As I understand what you need is an INSTEAD OF DELETE trigger like below
CREATE TRIGGER Trg_TableName
ON TableName
INSTEAD OF DELETE
AS
BEGIN
UPDATE t
SET ColumnC = 1
FROM TableName t
WHERE EXISTS (SELECT 1
FROM DELETED
WHERE ColumnA = t.ColumnA
END
this will set ColumnC to 1 and will not do an actual delete of the row.
Please Mark This As Answer if it solved your issue
Please Mark This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page

Similar Messages

  • How to display the value of a column in a chart at the top of each column

    How to display the value of each column in a chart at the top of each column?

    Like this?
    Done using chart Inspector.
    For details, see Chapter 7,  Creating Charts from Numerical Data in the Numbers '09 User Guide. The guide may be downloaded via the Help menu in Numbers.
    Regards,
    Barry

  • How to fix the value of first column in the JTable in java swing for every

    Hi ,
    I have a swing page that have table panel in which there is a table of size 7x4 now when I click on the perticulat row then that row data will displayin the table like that the selected row become the second column in the new table and the fist column of this table will remain constant for all the entry but the second column update according to the roe which is selected .How it is possible .
    Thanks in Advace,
    anu

    One thing you can do is to prevent the user from editing that column and programatically supply the values of that column yourself.
    JTable table = new JTable() {
       public boolean isCellEditable(int row, int col) {
           if(col == 0) {
              return false;
           return super.isCellEditable(row, col);
    };This allows you to prevent the user from editing the column information so you can supply some sort of a default value for the column always
    ICE

  • How to update the value in xml file using transformer after setNodeValue

    Hi,
    This is my code
    I want to set update the values in xml file using transformer..
    Any one can help me
    This is my Xml file
    <?xml version="1.0" encoding="UTF-8"?>
    <place>
    <name>chennai</name>
    </place>
    Jsp Page
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@ page import="javax.xml.parsers.DocumentBuilderFactory,
    javax.xml.parsers.DocumentBuilder,org.w3c.dom.*,org.w3c.dom.Element"
    %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
    </head>
    <body>
    <% String str="";
    String str1="";
    try
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    Document doc = db.parse("http://localhost:8084/XmlApplication1/sss.xml");
    out.println("Before change");
    NodeList n11 = doc.getElementsByTagName("name");
    Node n22= n11.item(0).getFirstChild();
    str1 = n22.getNodeValue();
    out.println(str1);
    out.println("After change");
    String name = "Banglore";
    NodeList nlst = doc.getElementsByTagName("name");
    Node node= nlst.item(0).getFirstChild();
    node.setNodeValue(name);
    NodeList n1 = doc.getElementsByTagName("name");
    Node n2= n1.item(0).getFirstChild();
    str = n2.getNodeValue();
    out.println(str);
    catch(Exception e)
    out.println(e) ;
    %>
    <h1><%=str%></h1>
    <%--
    This example uses JSTL, uncomment the taglib directive above.
    To test, display the page like this: index.jsp?sayHello=true&name=Murphy
    --%>
    <%--
    <c:if test="${param.sayHello}">
    <!-- Let's welcome the user ${param.name} -->
    Hello ${param.name}!
    </c:if>
    --%>
    </body>
    </html>

    hi check this exit...
    IWO10012

  • How to load the value in target column?

    Hi
    Source: Oracle
    Target: Oracle
    ODI: 11g
    I have an interface which loads the data from source table to target. Some of the columns in the target tables are automatically mapped with source table. Some of the column remain un-mapped. Those who remain un-mapped, I want to load the values in that column by executing an query. So can anybody tell me where I should mention that query whose result would become the value of the specific column.
    -Thanks,
    Shrinivas

    You can put the query (or subquery) into the mapping field.
    You can also call a function in the mapping field which may be easier in your case.

  • How to update the value of setter and getter..!!

    Hii all i am developing an portal application in which i display the metadata information related to a document(Stored in UCM) in a popup in my application...
    The user can also update the information through the application.
    in my popup i have a trh : table layout in which i have a Select Onechoice field as
    <trh:cellFormat id="xcfcSecurityGrp">
    <af:selectOneChoice value="#{MetaDataFields.DSecurityGroup}" id="ddldSecurityGroup" showRequired="false"
    autoSubmit="true"
    immediate="true">
    <f:selectItems value="#{ContentDataBean.TSecurityGrpList}" id="si1"/>
    </af:selectOneChoice>
    </trh:cellFormat>
    The MetaDataFields.DSecurityGroup show the current security group on document
    and
    ContentDataBean.TSecurityGrpList provide the user with the list of security group to update.
    The current security group i am getting through a map which consist of metadata information for a document :-
    public void setDSecurityGroup(String dSecurityGroup) {
    this.dSecurityGroup = dSecurityGroup;
    public String getDSecurityGroup() throws IdcClientException, IOException {
    Map<String,String> mapValue=ep.getDocumentPropertiesSystem();
    dSecurityGroup=mapValue.get("dSecurityGroup");
    return dSecurityGroup;
    The problem is that whenever i am updating the value for the security group, i am getting the old value, the problem is that i have to every time get value from the map only as it consist metadata information for the current selected document..
    Is there is any way through which i can update the value for this field..??
    Thanks
    JDeveloper - 11.1.1.6.0

    Hi,
    Try binding ValueChangeListener on the selectList. Also set autoSumit property to true.
    Thanks,
    Pandu

  • How to update the value inside a field symbol ?

    ASSIGN COMPONENT 'MENGE' OF STRUCTURE <fs_line> TO <fs_field>.
    <fs_field> = itab_stpo-menge.
    COLLECT <fs_line> INTO <fs_table>.
    .processing some code......
    ASSIGN COMPONENT 'MENGE' OF STRUCTURE <fs_line> TO  <fs_field>.
    <fs_field> = ( itab_stpo-menge * itab_plpo-vgw03 ).
    COLLECT <fs_line> INTO <fs_table>.
    Hi, guys,
    May i know is there a way to update the value in inside a field symbol?
    I feel hard to figure out the way to solve this situation. Kindly give me some help or perhaos tell me other altenative way to do it also can.
    Thanks in advance.
    Edited by: Jiansi Lim on Apr 25, 2008 8:09 PM

    hi check this...
    For a structured data object s, you can use the statement
    ASSIGN COMPONENT comp OF STRUCTURE s TO FS.
    Here the comp is the component name or its index number in the structure.
    Find the following sample code -
    DATA: BEGIN OF LINE,
    COL1 TYPE I VALUE '11',
    COL2 TYPE I VALUE '22',
    COL3 TYPE I VALUE '33',
    END OF LINE.
    DATA COMP(5) VALUE 'COL3'.
    FIELD-SYMBOLS: <F1>, <F2>, <F3>.
    ASSIGN LINE TO <F1>.
    ASSIGN COMP TO <F2>.
    DO 3 TIMES.
    ASSIGN COMPONENT SY-INDEX OF STRUCTURE <F1> TO <F3>.
    WRITE <F3>.
    ENDDO.
    ASSIGN COMPONENT <F2> OF STRUCTURE <F1> TO <F3>.
    WRITE / <F3>.
    The output is:
    11 22 33
    33
    I need to update one field in Internal table
    regards,
    venkat

  • How to get the values in separate columns

    Hello Everyone
    I am new to Bex, i have the sales data of 2008,2009,2010. now i have to display the sales order(key figure) for 2008,2009,2010 in separate columns for each customer(dimension) in a single report , can any one help me how to get this done in bex.
    Thanks
    Gupta

    Hi ,
    You can achieve this either creating New Selections or Restricted Key Figures.
    Right click on the structute>>>> New selcection>>> drag the year to right [  Right Click on it >>restrict it with 2008}>>>Drag the respected Key figure.
    So u will get the values 2008 in seperate column.
    COpy the New Selecten that u created and paste on the structure , chage the descriprion and year to 2009.
    do the same for 2010.
    Note:you can also achieve this by creating variable offsets.Check the following link
    http://help.sap.com/saphelp_bw33/helpdata/en/3f/89533e5ff4d064e10000000a114084/content.htm
    Regards,
    Ranganath

  • How to update the value in wbs element in the iw32

    Hi All,
    Can anyone help me in providing the USER EXIT OR BADI at the time of saving the IW31 / IW32  work order creation or Change. I need to populate the PSPEL ( WBS ELEMENT in Additional data tab with the value coming from Field Exit.
    Here is my analysis on the same.
    I have written Field Exit for Settlement Receiver field in Maintain Settlement SCREEN à 1 and Exporting the value.
    IMPORT the same value into Variable and need to pass the value to PSPEL field ( WBS ELEMENT ) in Additional Data Tab  using any USER EXIT or BADI at the time of save Work Order .
    I tried to use the USER EXIT u201CEXIT_SAPLCOIH_009u201D  and passed Manually at the time of Debugging into CAUFVD-PSPEL and executed. But the Value is not appearing in the Screen after execution.
    Any help is greatly appreciated.

    hi check this exit...
    IWO10012

  • How to get the values of a selectManyCheckBox when that is in h:dataTable

    Hello,
    I have a jsp page. in that user can choose multile checkboxes and these checkboxes labled as Current, Mailing, PosibleMailing, length is 3 fixed.
    And i am displaying this in a <h:dataTable> this datatable length depends upon the users there may be more than 1 user, for every user there is multiplecheckbox with length 3(fixed).
    code is look like this
    <h:dataTable value="#{InvestigationDefendantView.investDefsFindingsModel}" var="def" border="0" >
    <h:column>
    <h:selectManyCheckbox value="#{InvestigationDefendantView.addtype1}" disabled="false">
    <f:selectItem itemValue="Current" itemLabel="Current"/>
    <f:selectItem itemValue="Mailing" itemLabel="Mailing"/>
    <f:selectItem itemValue="Posible" itemLabel="Posible"/>
    <j4j:idProxy id="DefAddTypeProxy"/>
    </h:selectManyCheckbox>
    </h:column>
    </h:dataTable>
    here abovevalue="#{InvestigationDefendantView.investDefsFindingsModel}" suppose 3(we can assume) then there are 3 pairs of selectManyCheckBoxes are there in my jsp page.
    So u can assume in my jsp page checkboxes are look like 3*3 Matrix
    from my backing bean i am fetching the values of this checkboxes with the below code
    java code:
    InvestDefAddressTypeGetter inv = new InvestDefAddressTypeGetter();
    InvestDefAddressTypeBean[] inb = inv.get(pID);
    this.fMap = new HashMap<String, ArrayList<String>>();
    for(int i=0; i<inb.length; i++)
    String str1 = inb.getGivenDefID().toString();
    this.fdefid.add(str1);
    this.fGivenDefID.add(inb[i].getGivenDefID());
    String addType = inb[i].getAddType();
    Logger.info(this, "adding type value", addType);
    this.fdefid.add(str1);
    this.faddType.add(addType);
    Logger.info(this, "length of strings", this.faddType);
    this.fMap.put(str1, this.faddType);
    i am fetching the checkboxes value through my get method
    public String[] getAddtype1() throws SQLException, SearchException
    Logger.info(this, "addtype testing", this.faddType.size());
    if (this.faddType.size() > 0 )
    ArrayList<String> alcb = new ArrayList<String>();
    for (int i = 0; i < this.faddType.size(); i++)
    alcb.add(this.faddType.get(i));
    String[] tempArr = new String[alcb.size()];
    for (int i = 0; i < alcb.size(); i++)
    tempArr[i] = alcb.get(i).intern();
    return tempArr;
    return new String[0];
    from the above code if i have clicked (you can assume 3*3 matrix here) 1*1, 1*2 and 2*1 and 2*2and saving the value in database records are saved as per requirement but when i am editing the records with the above code i am getting 1*1, 1*2 and 2*1, 2*2 and 3*1, 3*2 checked but i did not checked the 3*1 and 3*2 ckeck boxes.
    Because the same get method will be called in the multipleckeck boxes. how can i prevent does not display the unchecked value from my backing bean.
    Please anybody help me in this issue.

    Is this you? [http://forums.sun.com/thread.jspa?threadID=5335038].

  • I just downloaded the new itunes and i cant figure out how to update the apps on my iphone when im on my computer?

    I just downloaded the latest itunes and i cant figure out how to update my iphone apps on my computer now.  I go to the toolbar on the top and press search for updates and it tells me that the latest version of itunes is already downloaded or that there are no updates available at this time.  Previously, i would be able to go to the apps page on itunes and then press search for updates and then download all. Then I would sync with my phone and both phone and computer would be updated.  Now I can only update on the phone and I know Im going to encounter where it tells me the info for downloading is too large to do it on your phone, hence my first question.....where do I go to update my apps on my computer????

    While you're in itunes, with the leftside window open, click on Apps. Then, look across the top middle of your itunes screen. You will see several choices: All, Iphone/iPad Touch, Ipad, Ipod Games, List, and Updates. 
    Clicking on each of these gives you a different view. 
    When you select ALL you will see all of your apps. When you select Updates you sill see only the apps that need to be updated. When you are in Updates you will see the Update button in the lower right corner.
    Hope this helps.

  • How to default the value of a selectOneChoice when adding a row to a table

    I have a table where one of the fields is a selectOneChoice. When adding a row to the table, the new row to be added displays the selectoneChoice field blank. I would like to have this field default to a specific value within the selectoneChoice when clicking the add button. Any suggestion on the code I need to add in the backing bean? Thanks in advance.

    After some studying I figured out how to do this... code below for anyone interested:
    DCIteratorBinding dcib = (DCIteratorBinding) bindings.get("someIterator");
    RowSetIterator iter = dcib.getRowSetIterator();
    Row newRow = iter.createRow();
    newRow.setAttribute("yourFieldName",fieldDefaultValue);
    iter.insertRowAtRangeIndex(0, newRow);
    iter.closeRowSetIterator();

  • How to Update the oracle toad column value in table by using SSRS 2008

    Hi Team,
    How to update the oracle DB table column value by using SSRS 2008.
    Can any one help me on this.
    Thanks,
    Manasa.
    Thank You, Manasa.V

    Hi veerapaneni,
    According to your description, you want to use SSRS to update data in database table. Right?
    Though Reporting Services is mostly used for rendering data, your requirement is still can be achieved technically. You need to create a really complicated stored procedure. Pass insert/delete/update and the columns we need to insert/delete/update as
    parameters into the stored procedure. When we click "View Report", the stored procedure will execute so that we can execute insert/delete/update inside of the stored procedure. Please take a reference to two related articles below:
    Update Tables with Reporting Services – T-SQL Tuesday #005
    SQL Server: Using SQL Server Reporting Services to Manage Data
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • Very Urgent.......How to update the database values through OAF pages ??

    Hi All,
    I am developeing some self service application thru Oracle Application Framework(OAF). There I am fetching 5 attributes from the database and displaying those attributes in my main page Table Region. Now my requirement is i want to edit that exising values & again i want to store it in the databse while clicking the update button. so first i have created one VO for fetching the values from the database & i make one Table Region in my main page along with 5 MessageTextInput field.. & i mapped that VO's attributes to my textbox.Now i can able to fetch & display the values inside the text box while rendering the page.
    But I dont know how to update the values in the database. Caz in my VO I have only select query. So anyone plz send me the code for update. And also plz let me know where to insert that code..whether (CO or AM or EO)..it is very urgent.
    Thanks
    srini

    David,
    Note that the default JavaBean datacontrol does not allow create/remove and transaction operations. These apis are not implemented for the JavaBean datacontrol.
    You may re-initialize the rowsetiterator, by calling ((oracle.adf.model.generic.DCRowSetIteratorImpl)iteratorBinding.getRowSetIterator()).clearCurrentData().
    This will force the RSI to refresh it's data via the named-accessor again.

  • How to update the field EKET-WEMNG (delivered) in database using BAPI.

    Dear All,
    How to update the values to good received field for EKET WEMNG (delivered) in database using BAPI and please give me the standard bapi and explain the process  how to update to database bcoz am new to bapi concepts and i will be thankful to your help.
    Regards,
    Tazeer.

    this field is only updated when you do a goods receipt. 
    So the only BAPI that can do this is the BAPI GoodsMovement  (BUS2017)

Maybe you are looking for

  • Exchange 2013 autodiscover finds external & internal SSL certificate causing autodiscover to fail

    <p>Hi:</p><p>I'm currently working on a windows 2012 server, with exchange 2013, lets say our internal domain is "cars.com" and ALSO the case for our external domain. We have purchased an SSL wildcard positive certificate *.cars.com so that we could

  • Problem connecting to 4g

    I have an issue connecting on Vodafone uk 4g network while I have no problems with other SIM cards. On Vodafone I can only get 3G even if my plan is all set up for 4g. Vodafone doesn't know what the problem is. Occasionally I do get 4g but then it di

  • Discoverer list of worksheets by logged on user

    In portal on a page, I want to add a portlet showing the current user, that is logged on, their discoverer list of worksheets. Is this possible? Do I need to use VPD?

  • Import multi-level BOM into Oracle

    We have a client requirement to create BOM based on level using Pl/Sql, Data will be coming in the below format:- Item Description      BOM LEVEL a               *1*      aa               *2*      aaa               *3*      aab               *3*     

  • IPhoto '08 won't save photos

    After installing iPhoto '08 over the previous version, which was working properly, I can't seem to save the photos I download from my camera. I get this message: "Some recent changes may be lost. Make sure your hard disk has enough space and that iPh