Update a single column of a table

Hi Champs,
I want to update a single column of table PA0000.
Following is ABAp code I am using:
UPDATE pa0000 SET massn = wa_upd_actn71-massn
                   WHERE pernr = wa_upd_actn71-pernr AND
                          massn = c_crct_entry.
where in current scenario wa_upd_actn71-massn = 54,
                                     wa_upd_actn71-pernr = 10005092,
                                     c_crct_entry = 71.
But this code is not working and note updating the DB table PA0000.
Can you help me out?
Edited by: Nishant Khimesra on Apr 7, 2009 2:00 PM
Edited by: Nishant Khimesra on Apr 7, 2009 2:00 PM

hiii,
If u want to update it thr program then write the query as update <dbtablename> set fld = value where <condn>. make sure that the values u pass are converted as per the values in database.
2nd way is goto se16n
specify table name and then enter &sap_edit on command line. sap editing function will be edited. specify the filter parameters on the field and then execute the transaction. u can change thd data instantly as the data appears in editable alv.
Regards,
Anil N.

Similar Messages

  • Need to update a single column in a table with some other column value

    Hi experts,
    I was about to change one column data type in a table. Then I renamed that column name to "old_column_name" . Later I added new column name with required datatype( My case its NCLOB). Now I want to update the new column value with old column value.I mean i have to copy the data. But data amount is very huge. Its more than 1.5 crores of data. But on promote day, I have only 1 hr of outage. Please suggest the effective solution to achieve this.

    Hi Stew
    I have 1 primary key in my table and 11 foreign keys in my table.there are 20 check constraints as well.
    If i go for an online redefine of a table, these objects will be created back automatically?
    Please clarify.
    This is my table. Here Remarks is the column with CLOB datatype. To support multi language, I need to change it to NCLOB. That column having data so i cant rename it.
    So I added new column , after renaming that remarks to old_remarks. Now new column remarks is ready with NCLOB data type, but no data in it.
    To copy the old remarks column into new remarks column, i thought to write one script. But how it is achievable using "DBMS_REDEFINITION". Please explain me,
    create table XXXXXXXXXX
    ID NUMBER(8),
    COMPLETED_DATE DATE,
    COMMUNICATION_MEDIUM VARCHAR2(32),
    REMARKS1 VARCHAR2(4000),
    COPY VARCHAR2(1),
    IO_MARKER VARCHAR2(3),
    EVENT_DATE DATE,
    CON_REF_NO NUMBER(8),
    DEP_CODE VARCHAR2(6),
    SFM_STAFF_NO NUMBER(8),
    CRPD_ID NUMBER(8),
    CRPD_ID_COPY NUMBER(8),
    STATUS VARCHAR2(2),
    COMEBACK_NO NUMBER(2),
    ADD_ADD_ID NUMBER(10),
    AEV_ID NUMBER(8),
    OLAY_ID NUMBER(8),
    COE_TYPE VARCHAR2(3),
    CET_CODE VARCHAR2(6),
    DEP_CODE_RAISED_BY VARCHAR2(6),
    SFM_STAFF_NO_RAISED_BY NUMBER(8),
    USR_CREATED VARCHAR2(30),
    CREATED DATE,
    USR_CHANGED VARCHAR2(30),
    CHANGED DATE,
    EXT_REF_ID VARCHAR2(150),
    REPLY_EXPECTED_DATE DATE,
    SEC_ID VARCHAR2(8) not null,
    PROTECTED VARCHAR2(1),
    APPROVED_BY NUMBER(8),
    DOCUMENT BLOB,
    OLD_REMARKS CLOB,
    CTS_ID NUMBER(8),
    MESSAGE_STATUS VARCHAR2(4),
    WORD_DOCUMENT NCLOB,
    REMARKS NCLOB
    Edited by: Hema on Jul 2, 2012 8:31 AM
    Edited by: Hema on Jul 2, 2012 8:31 AM

  • Adding a single column to mulitple tables

    I have to add a single column to 664 tables.
    I can copy the column from the table it is originally created in.
    Is there a way to paste the column in all the remaining tables?
    It doesn't work by selecting all the tables in the design ('Ctrl + a', right click 'paste').
    It does work if I click each individual table ('Ctrl', left click) but i do not want to have to click each of the 664 tables.
    Thanks,
    Nic

    You can create script for this purpose for all 664 tables.
    And if you use MS Excel to create that script, you will feel a bit relieved. Its not too much difficult, just simple steps to create the script.
    In MS Excel
    1- In first column Write >>Alter table [Drag this cell for 664 times]
    2- In second table Paste >>Table_Name [Select all tables Ctrl+a, and copy table names in this column 664 Tables will come there]
    3- In third column Write >>Add (COLUMN_NAME  VARCHAR2(50)); [Drag this cell for 664 times]
    Now Script is Ready, You can select all three columns now and paste them in notepad file.
    And execute this script in Database;
    Hope this will resolve your problem.

  • How to grey out one single column in a table control of TPMOE

    Hi Experts,
    Any body please tell me how to greyout a single column in a table control of TPMOE.
    Help needed ASAP.
    Thanks,
    sreenivas.

    lr_result      TYPE REF TO if_bol_bo_property_access
    lr_iterator TYPE REF TO if_bol_bo_col_iterator
          CALL METHOD lr_iterator->get_by_index
            EXPORTING
              iv_index  = index
            RECEIVING
              rv_result = lr_result.
          CALL METHOD lr_result->get_property_as_value
            EXPORTING
              iv_attr_name = 'TRANSFER_STATUS'
            IMPORTING
              ev_result    = lv_status.
    if  lv_status = x and component = cost_category.
    rv_disabled = true.
    else.
    call super.
    endif.
    INDEX will have the row number.
    Frame ur logic based on this.

  • Correct way to handle updates of XMLtype columns in standard tables.

    Hello to whoever may read this,
    I am currently studying the XML functionality of oracle DB for a uni project.
    We have been asked to compare/contrast solutions to publishing product and price data for data stored in standard relational tables, and data stored in XML type tables. For extra marks, i am looking at a table containing an XMLType column for multiple items of data relating to the primarykey.
    I have managed to get my head around publishing the data - pretty straight forward, but we have also been asked to show how we can update data, which isn't a problem within the standard tables/columns, but when it comes to the XMLType columns/tables, i dont have a clue.
    At the moment i am working on trying to update an XMLtype column. The table itself is a "product" table, and contains product information, as well as an XMLType column containing multiple changes to the prices. In the relational tables, this "product" table has a one-to-many link to another table called price_history which contains details about past prices (which is populated by a trigger on update/insert of a new price). But in this table all the product changes are stored in XML format in the XML type column "prices".
    Table columns: id number(4), name varchar2(25), prices xmltype;
    example data: 1781, CDW 20/48/E, <product_prices><price_change>
    <change_id>1</change_id>
    <date_changed>2009-10-13</date_changed>
    <details>price increased</details>
    <new_value>234</new_value>
    </price_change>
    <price_change>
    <change_id>2</change_id>
    <date_changed>2009-10-13</date_changed>
    <details>price increased</details>
    <new_value>235</new_value>
    </price_change></product_prices>
    We need to give examples of an update. I have been looking around the net, and these forums for a solution now for about 4 hours. My own thoughts are that to update this with a new price change i need to, SELECT the current data INTO a variable, then concatenate that variable with the new price change info e.g.
    <price_change>
    <change_id>3</change_id>
    <date_changed>2009-10-13</date_changed>
    <details>price decreased</details>
    <new_value>230</new_value>
    </price_change>
    then insert that whole chunk of data again to overwrite the old data.
    Now im fairly certain there is some function somewhere which will allow me to do this update/insert operation without going through this process... After i am done with this update of XMLType column data, i need to tackle updating data in an XMLType Table with XQuery(? apparently), so if you have any pointers for that please let me know.
    Could one of you experts point me in the right direction for this? Any advice at this stage is a great help and will stop me losing my mind.
    p.s. im sorry about the lengthy description of the problem/solution required. How to describle something i dont understand? I ask myself.

    Hi,
    You really need to take a look at the XMLDB Developers guide.
    For updating XML with SQL/XML see UPDATEXML and for XQuery see [Using XQuery with Oracle XMLDB|http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14259/xdb_xquery.htm#sthref1673]
    HTH,
    Chris

  • How to update a single row of data table

    How we can update a single row of the data table by clicking the button in the same row.
    Thanks in Advance.

    Hi!
    What do You mean 'update'? Get fresh data from DB or change data and commit it in DB?
    If commit, try to read here:
    http://developers.sun.com/jscreator/learning/tutorials/2/inserts_updates_deletes.html
    Thanks,
    Roman.

  • How to update a BLOB column in a table with a file in local machine?

    I have a file (of XML type) in my local machine. I want to update it in a BLOB column of a table in databse server. Can anyone help me in this regard. Appreciate your help.
    Regards
    Walter Nicholas

    user447427 wrote:
    I have a file (of XML type) in my local machine. I want to update it in a BLOB column of a table in databse server. Can anyone help me in this regard.That's the client's job to read data on the client PC (from keyboard/mouse/scanner/file/whatever input) and submit that to the database server for processing and/or storage.
    You cannot expect the server to hack into your PC and lift that data in the file from your disk. Not that is not technically possible. You can wire rockets onto a bicycle to make it go faster, but that's not a wise thing to do. Similarly, it is not a bright idea to ignore the very basics of client-server.
    Bottom line - you need client s/w on your PC to load the content of that file into Oracle. It can be done using SQL*Loader as already suggested. It can be done using a web browser (submitting it via HTTP to web-enabled PL/SQL code). You can use FTP or WebDav and upload into Oracle's XDB (XML database).
    Your requirements will determine what client to use. Once off load? SQL*Loader is very easy to use for loading XML files into the database.

  • How to update the COST column using another table's column

    Dear All,
    I have table:
    table parts: pno, pname, qoh, price, olevel
    table orders: ono, cno, eno, received, shipped
    table odetails: ono, pno, qty
    view:orders_view: ono, cno, eno, received, shipped,sum(qty*price)order_costview:odetails_view: ono, pno, qty, (qty*price)cost
    after I update the price in parts, I need to update COST and ORDER_COST too. The orders_view does not have pno, qty, and price, the odetails_view does not have price, how can I update the COST and ORDER_COST. Please help and Thanks in advance!!!
    I wrote the update the price in parts:
    create or replace procedure change_price(ppno in parts.pno%type, pprice in parts.price%type) as
    begin
        update parts
        set price = pprice
        where pno = ppno;
    end;
    show errorsthis procedure works fine.
    I wrote the trigger:
    create or replace trigger update_orders_v
    after update of price on parts
    for each row
    begin
        update orders_view
        set order_cost = sum(parts.(:new.price)*parts.qty)
        where parts.pno = :new.pno;
    end;
    show errorsIt gives me:Errors for TRIGGER UPDATE_ORDERS_V:
    LINE/COL ERROR
    3/5 PL/SQL SQL Statement ignored
    4/22 PL/SQL ORA-00934: group function is not allowed hereplease help!

    You could add the columns to the tables and then you would need a trigger to update those columns. However, you could just as easily select the price * qty to get the cost, without creating an additional column or trigger. I have no idea what you might want to do with a global temporary table. I think you need to explain what your purpose is, before any of us can suggest the best method. Since I have already demonstrated an update with a view, I will demonstrate an update with the cost column added to the odetails table and a trigger as you asked about. Notice that you will need triggers on both tables, the one that has qty and the one that has price.
    scott@ORA92> create table parts
      2    (pno    number(5) not null primary key,
      3       pname  varchar2(30),
      4       qoh    integer check(qoh >= 0),
      5       price  number(6,2) check(price >= 0.0),
      6       olevel integer)
      7  /
    Table created.
    scott@ORA92> create table odetails
      2    (ono    number(5),
      3       pno    number(5) references parts,
      4       qty    integer check(qty > 0),
      5       cost   number,
      6       primary key (ono,pno))
      7  /
    Table created.
    scott@ORA92> create or replace procedure change_price
      2    (ppno   in parts.pno%type,
      3       pprice in parts.price%type)
      4  as
      5  begin
      6    update parts
      7    set    price = pprice
      8    where  pno = ppno;
      9  end;
    10  /
    Procedure created.
    scott@ORA92> create or replace trigger update_cost1
      2    after insert or update of price on parts
      3    for each row
      4  begin
      5    update odetails
      6    set    cost = qty * :new.price
      7    where  pno = :new.pno;
      8  end update_cost1;
      9  /
    Trigger created.
    scott@ORA92> show errors
    No errors.
    scott@ORA92> create or replace trigger update_cost2
      2    before insert or update of qty on odetails
      3    for each row
      4  declare
      5    v_price parts.price%type;
      6  begin
      7    select price
      8    into   v_price
      9    from   parts
    10    where  pno = :new.pno;
    11    --
    12    :new.cost := :new.qty * v_price;
    13  end update_cost2;
    14  /
    Trigger created.
    scott@ORA92> show errors
    No errors.
    scott@ORA92> insert into parts values (1, 'name1', 1, 10, 1)
      2  /
    1 row created.
    scott@ORA92> insert into odetails values (1, 1, 22, null)
      2  /
    1 row created.
    scott@ORA92> -- starting data:
    scott@ORA92> select * from parts
      2  /
           PNO PNAME                                 QOH      PRICE     OLEVEL
             1 name1                                   1         10          1
    scott@ORA92> select * from odetails
      2  /
           ONO        PNO        QTY       COST
             1          1         22        220
    scott@ORA92> -- update:
    scott@ORA92> execute change_price (1, 11)
    PL/SQL procedure successfully completed.
    scott@ORA92> -- results:
    scott@ORA92> select * from parts
      2  /
           PNO PNAME                                 QOH      PRICE     OLEVEL
             1 name1                                   1         11          1
    scott@ORA92> select * from odetails
      2  /
           ONO        PNO        QTY       COST
             1          1         22        242
    scott@ORA92> -- select works without extra cost column or trigger:
    scott@ORA92> select o.ono, o.pno, o.qty, (o.qty * p.price) as cost
      2  from   odetails o, parts p
      3  where  o.pno = p.pno
      4  /
           ONO        PNO        QTY       COST
             1          1         22        242
    scott@ORA92>

  • Updating a derived column of a table

    Hi everyone,
    Can you please help me and give me a solution for this
    I have 3 columns paydate, expdate, NewRenew in a table.  If the paydate is greater than 90 days than exp date I need to update NewRenew column to N and If the paydate is less than 90 days than exp date I need to update NewRenew column
    to R.
    In simple terms as in the code below, if the column D in the query is less than 90 newrenew column should be 'R' otherwise 'N'
    Below is the sample data to create and insert. when I use the update as I am using it is updating all the rows in the table.
    create table test_3
    (Accnt_no int,
    expdate date,
    paydate date,
    newrenew varchar(1)
    insert into test_3 (Accnt_no,expdate,paydate,newrenew)
    select 1859,'20150131','20150221','N'
    UNION ALL
    select 3549,'20150219','20150302','N'
    UNION ALL
    select 9185,'20140910','20150123','N'
    UNION ALL
    select 11302,'20140910','20150317','N'
    select * from (select DATEDIFF( DAY, convert(date,expdate),CONVERT(date, PAYDATE)) D,* from Test_3
    WHERE convert(date,paydate) > convert(date,expdate)) z
    where Z.D>90
    ----am trying to update in this way but it is updating all the rows in the table instead of 2 rows.
    update Test_3
    set newrenew = 'R'
    from (select DATEDIFF( DAY, convert(date,expdate),CONVERT(date, PAYDATE)) D,* from Test_3
    WHERE convert(date,paydate) > convert(date,expdate)) z
    where Z.D<90

    Please follow basic Netiquette and post the DDL we need to answer this. Follow industry and ANSI/ISO standards in your data. You should follow ISO-11179 rules for naming data elements. You should follow ISO-8601 rules for displaying temporal data. We need
    to know the data types, keys and constraints on the table. Avoid dialect in favor of ANSI/ISO Standard SQL. And you need to read and download the PDF for: 
    https://www.simple-talk.com/books/sql-books/119-sql-code-smells/
    >> I have 3 columns pay_date, expiry_date, renewal_flg in a table.<<
    No, you do not have a table. A table has a key by definition. What you did post is awful. An accounting number is an identifier and you do no math on it, so it should never be a numeric. We do not use flags in RDBMS! That is assembly language programming. SQL
    is a logical predicate based language that computes a state of being as part of a query. Your mind set is still in punch cards and mag tapes where we had to physically mark things in hardware. That is your assembly language renewal flag – a hole in the last
    column of a 1950's punch card in 2015 SQL Then the punch cards are passed to the next step in the sequence of procedural steps. 
    We now have modern INSERT INTO syntax and CAST() in place of the old Sybase CAST() string function. The old Sybase UPDATE..FROM.. does not work! Google it. The ANSI/ISO Standard SQL uses only the “yyyy-mm-dd” style date display format; what you had will also
    work in T-SQL, but might not port and makes you look like a dialect speaker. 
     CREATE TABLE Test_3
     (account_nbr CHAR(16) NOT NULL  PRIMARY KEY, -- typical credit card length
      expiry_date DATE NOT NULL, 
      pay_date DATE NOT NULL);
    Here is the correct syntax for insertions since the SQL-92 standards:
     INSERT INTO Test_3 (account_nbr, expiry_date, pay_date)
    VALUES
     (1859, '2015-01-31', '2015-02-21'), 
     (3549, '2015-02-19', '2015-03-02'), 
     (9185, '2014-09-10', '2015-01-23'), 
     (11302, '2014-09-10', '2015-03-17');
    Why did you cast (well, you did it with CONVERT() instead) a date to date? Why did you use “SELECT *” in production code? Is this what you meant?
    CREATE VIEW Old_Accounts_Test_3
    AS
    SELECT account_nbr,  expiry_date,  pay_date,
                DATEDIFF(DAY, expiry_date, pay_date) AS account_age
      FROM Test_3
     WHERE pay_date  > expiry_date  -- is it >= or >?? 
        AND DATEDIFF(DAY, expiry_date, pay_date)  > 90;
    This view is always current, required no disk writes, etc. I have been teaching SQl for a few decades, and I have see this mindset before.  You are 3-5 years away from actually being an SQL programmer. You need to do a lot of un-learning. The bad news
    is that if you keep coming to forums, people will feed you kludges and you will never learn. Be better than that.  
    --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

  • Updating one varray  column in a table

    Hi ,
    We are using 10gR2 on AIX . I have one varray column in a table which has be updated ..To update this column , data is fetched in a query by using 2 tables.Is there any way to reduce the update time?
    Edited by: Minu on 25-Apr-2011 20:24

    HOW TO: Post a SQL statement tuning request - template posting

  • How to Sort single column in webdynpro table

    Hi all
    I have requirement as follows.
    i have webdynpro table with the following columns like Date,firstname,lastname,address etc.
    now when i run the the application the table is populating the data at runtime that is fine.
    i need as soon as table is loaded , Date field in the table should be displayed the values in the decending order...i have the requirement as follows...
    how to sort the single column in table ...by default the values of the column displayed with decending order as soon as table displays at runtime....i dont want to click any button specific button to do the sort for that column
    Regards
    bindu

    Hi, I solved the same problem by modifying the sort() method in the default TableSorter class so that it takes a column id and direction rather than an event.
    I assume you have read the TableSorter tutorial.
    Like this. (This was done on nw ce 7.1 btw but may work on older versions as well.
    Oh and then you just call the sort method right after you have made the request
    //Code that goes into controller/view to execute sorting
    wdContext.currentContextElement().getPensionplanTableSorter().sort("MyColumnId", "Up", wdContext.nodePensionPlan());
    //Part of TableSorter.java
    //The original method that needs an event. Now it just calls the new method
    public void sort(IWDCustomEvent wdEvent, IWDNode dataSource) {
         // find the things we need
         String columnId = wdEvent.getString("selectedColumn");
         String direction = wdEvent.getString("sortDirection");
         sort(columnId, direction, dataSource);
    //This is the new method.
    public void sort(String columnId, String direction, IWDNode dataSource) {
         if (columnId == null || direction == null ) {
              return;
         IWDTableColumn column = (IWDTableColumn) table.getView().getElement(columnId);
         NodeElementByAttributeComparator elementComparator =
    (NodeElementByAttributeComparator) comparatorForColumn.get(column);
         if (elementComparator == null){
         //not a sortable column
              column.setSortState(WDTableColumnSortDirection.NOT_SORTABLE);
              return;
         // sorting
         elementComparator.setSortDirection(WDTableColumnSortDirection.valueOf(direction));
         dataSource.sortElements(elementComparator);

  • Inserting single column in internal table

    Hiii,
    I have to insert data into a single column of a internal table from a field.The rest of the columns of the internal table are already filled.
    wats is the syntax for it?? plz reply soon...its very urgent.

    Hi,
    try this
    data idx type sy-tabix.
    loop at itab.
    itab-fld1 = 'some value'.    " your empty field
    modify itab index idx.
    endloop.
    Regards,
    V.Balaji
    Reward if Usefull...

  • Getting parent-child data from a single column in a table

    Hi,
    I have a parent-child data in a column.
    Eg:
    0
    00
    01
    010
    011
    1
    10
    11
    These values are present in the single column itself. My need is to get the parent values for the given child value.
    For eg: If I am giving the input as 011, the query should return all its parents, i.e. 01 and 0
    Could you please give me any inputs on this?
    Thanks,
    GV

    Frank Kulash wrote:
    Assuming that each child's id is formed by adding exactly one character to the end of its parent's id:
    SELECT     id
    FROM     table_x
    START WITH     id          = :target_id
    CONNECT BY     PRIOR id     LIKE id || '_';
    Small tweak to yours Frank if it's just the parents that need identifying...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select '0' as x from dual union all
      2             select '00' from dual union all
      3             select '01' from dual union all
      4             select '010' from dual union all
      5             select '011' from dual union all
      6             select '1' from dual union all
      7             select '10' from dual union all
      8             select '11' from dual)
      9  -- end of test data
    10  SELECT     x
    11  FROM       t, (select '&required' as req from dual) req
    12  WHERE x != req.req
    13  START WITH x = req.req
    14* CONNECT BY PRIOR x LIKE x || '_'
    SQL> /
    Enter value for required: 011
    old  11: FROM   t, (select '&required' as req from dual) req
    new  11: FROM   t, (select '011' as req from dual) req
    X
    01
    0
    SQL> /
    Enter value for required: 11
    old  11: FROM   t, (select '&required' as req from dual) req
    new  11: FROM   t, (select '11' as req from dual) req
    X
    1
    SQL>

  • Tabular Report for Update a single column

    Hello Everyone,
    I have a tabular report which will display 1 column (apart from primary key),
    1. I will display a edit icon (on primary key)
    2. when the user selects this icon, this only row must become updatable (only one column must become text item, so that user can modify the value).
    3. Next this text item, i would like to display save button and cancel button so that user can click one of these buttons next to that particular row.
    Any help would be appreciated.
    Regards
    Anil

    There is no easy way to do this without some incredibly lengthy javascript. Tabular forms still do not give much declarative control to the developer.
    If you are looking to click a button and update one column on one row, it's easiest to change your design to two pages using report and form. Make the first page the report with an Edit button, click the button (nothing more than a link) and it goes to a basic form with only one updateable field. After submit, branch back to the first page. Easy.
    For the end user, there are no more mouse clicks involved in this than what you described originally so it's likely it'll be an acceptable application design change.

  • Update a single column in query only form

    Forms 9i, database 10g
    I am migrating the form from 6i to 9i. I have a form that is query only except for one field that can be updated. The main block1, based on a view, includes most of the person's personal data, none of which is updateable.. Another block2, based on a table, includes the 3 not-null colums that cannot be updated, and a remarks field, which can be updated. The block2 properties are set YES for insert, update, delete. The three non-updatable columns have properties set to NO for I,U and D, but the remarks column has I,U and D properties set to YES. When I enter data into the remarks field and press the Save on the Forms icon bar, I get error FRM-40508:unable to insert record and the ORA-00001:unique constraint. I don't should not be able insert and I don't want to, I just want to update one column.
    What am I not setting correctly in 9i? The same triggers and code works in 6i.
    Any suggestions are greatly appreciated.
    Vija

    No, there are no on-update triggers, but there are Post-Qry. I did run it in debug mode, but there is no good place to put a break point, since retrieval of the data works fine. Should I have key-commit trigger on the block to do the update?
    Vija

Maybe you are looking for