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

Similar Messages

  • Update of varray columns

    Hi all,
    Can I update a varray column.Oracle version we are using is 9.2.0.8.
    In the below given table structure and sample data, in second insert statement, email column is having null values.In the actual table we have around 200 - 300 columns where email value is null, i want update those columns where email is null.Is it possible to update only one column in a varray column.
    CREATE TABLE XXEACCESS_IMPL
    ( REQUEST_ID VARCHAR2(20 BYTE),
    STATUS CHAR(1 BYTE),
    SYSTEM_IMPL VARCHAR2(50 BYTE),
    ART_REQUEST_ID NUMBER,
    CALL_DATA WF_PARAMETER_LIST_T,
    LAST_UPDATED_DATE DATE DEFAULT sysdate);
    CREATE OR REPLACE type SCOTT.WF_PARAMETER_T as object
    ( NAME VARCHAR2(30), VALUE VARCHAR2(2000),
    MEMBER FUNCTION getName return varchar2,
    MEMBER FUNCTION getValue return varchar2,
    MEMBER PROCEDURE setName (pName in varchar2),
    MEMBER PROCEDURE setValue(pValue in varchar2));
    CREATE OR REPLACE
    type body SCOTT.WF_PARAMETER_T as
    MEMBER FUNCTION getName return varchar2 is
    begin
    return name;
    end getName;
    MEMBER FUNCTION getValue return varchar2 is
    begin
    return value;
    end getValue;
    MEMBER PROCEDURE setName(pName in varchar2) is
    begin
    name := pName;
    end setName;
    MEMBER PROCEDURE setValue(pValue in varchar2) is
    begin
    value := pValue;
    end setValue;
    end;
    Insert into XXEACCESS_IMPL
    (REQUEST_ID, STATUS, SYSTEM_IMPL, ART_REQUEST_ID, CALL_DATA, LAST_UPDATED_DATE)
    Values ('EA39050', 'Y', 'CONTACT_MANAGEMENT_REQUEST', 27084, wf_parameter_list_t(
    wf_parameter_t('EMAIL', '[email protected]'), wf_parameter_t('DOMICILE', 'US')), TO_DATE('05/03/2006 16:45:18', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into XXEACCESS_IMPL
    (REQUEST_ID, STATUS, SYSTEM_IMPL, ART_REQUEST_ID, CALL_DATA, LAST_UPDATED_DATE)
    Values
    ('EA39045', 'Y', 'CREATE_ACCOUNT', 27089,
    wf_parameter_list_t(
    wf_parameter_t('EMAIL',''),WF_PARAMETER_T('DOMICILE','US')),
    TO_DATE('05/03/2006 17:13:08', 'MM/DD/YYYY HH24:MI:SS'));
    Please help me in this regard.
    Thanks
    Raghu

    You can use this statement:
    UPDATE xxeaccess_impl x
       SET call_data =
           CAST (MULTISET (SELECT CASE WHEN temp_tab.name = 'EMAIL' AND temp_tab.value IS NULL THEN
    wf_parameter_t ('EMAIL', '[email protected]')
    ELSE
    VALUE (temp_tab)
    END CASE
                             FROM TABLE (SELECT call_data
                                           FROM xxeaccess_impl
                                          WHERE x.ROWID = ROWID
                                         ) temp_tab
                 AS wf_parameter_list_t
                );But, better way is to use PL/SQL: retrieve the entire varray, update its elements, and then store the changed varray back in the database.
    Regards,
    Zlatko

  • 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

  • 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

  • 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>

  • 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.

  • 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.

  • 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

  • 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.

  • Mail needs to be sent after updating the salary column of emp table

    Hi,
    we have table test_emp_table, oracle form based application is running on this table...
    it conatins salary column, we have requirement that, when every any update to the salary column, a mail needs to be sent to concerned person with new and old salary values..
    I did that using the following procedure...
    ===========
    -- Create Temporary Table to hold the Updated values
    create table email_parameters
    ( id number primary key,
    oldsal varchar2(10),
    newsal varchar2(10),
    ename varchar2(100));
    --- Create Procedure
    CREATE OR REPLACE PROCEDURE send_email_new (
    l_job IN NUMBER ) is
    l_oldsal varchar2(100);
    l_newsal varchar2(100);
    l_emp_name varchar2(100);
    l_message varchar2(100);
    BEGIN
    SELECT oldsal
    INTO l_oldsal
    FROM email_parameters
    WHERE ID = l_job;
         SELECT newsal
    INTO l_newsal
    FROM email_parameters
    WHERE ID = l_job;
         SELECT ename
    INTO l_emp_name
    FROM email_parameters
    WHERE ID = l_job;
         l_message:=
    'Employee Name= '
    || l_emp_name
    || chr(10)||chr(10)
    || 'Old Salary= '
    || l_oldsal
         || chr(10)||chr(10)
    || 'New Salary= '
    || l_newsal;
    send_mail(l_message);
    DELETE FROM email_parameters
    WHERE ID = l_job;
         EXCEPTION
    WHEN OTHERS
    THEN
    DBMS_OUTPUT.put_line (DBMS_UTILITY.format_error_stack);
    DBMS_OUTPUT.put_line (DBMS_UTILITY.format_call_stack);
    END;
    --- Create Trigger
    create or replace trigger send_email_trg
    after update on TEST_EMP_TABLE
    for each row
    declare
    l_job number;
    begin
    dbms_job.submit (job => l_job,
    what => 'send_email_new(job);' );
    insert into email_parameters
    values (l_job, :old.sal,:new.sal,:new.ename);
    end send_email_trg;
    -- Create Procedure for Sending Mail
    create or replace procedure send_mail(l_message varchar2) is
    c utl_smtp.connection;
    PROCEDURE send_header(name VARCHAR2, header VARCHAR2) AS
    BEGIN
    utl_smtp.write_data(c,name ||':'|| header || UTL_TCP.CRLF);
    END;
    BEGIN
    c := utl_smtp.open_connection('192.168.0.18');
    utl_smtp.helo(c, 'abc.com');
    utl_smtp.mail(c, '[email protected]');
    utl_smtp.rcpt(c, '[email protected]');
    utl_smtp.open_data(c);
    send_header('From', '[email protected]');
    send_header('To', '[email protected]');
    send_header('Subject', 'Warning: Employee Solary has been updated!');
    utl_smtp.write_data(c, UTL_TCP.CRLF || l_message);
    utl_smtp.close_data(c);
    utl_smtp.quit(c);
    EXCEPTION
    WHEN utl_smtp.transient_error OR utl_smtp.permanent_error THEN
    BEGIN
    utl_smtp.quit(c);
    EXCEPTION
    WHEN utl_smtp.transient_error
    OR utl_smtp.permanent_error THEN
    NULL;
    END;
    raise_application_error(-20000, SQLERRM);
    END;
    ====================
    But I have doubt, if there is any problem with mail server, if user is updating salary column from form based application at same time....
    will table trigger allows him to save the new record or not????? or will he get any errors????

    thanks justin...
    I have written that code..but it works...problem is ...i am not able to understand the flow...what happens in the order, until mail is sent...
    i have another code.....
    I have written with out dbms_job, i have witten directly in the trigger itself...
    Tom suggested the procedure, what i have given above..but not the below procedure....
    I am not able to understand, what is the difference between them.....
    CREATE OR REPLACE TRIGGER test_emp_table_trg
    AFTER UPDATE
    ON test_emp_table
    FOR EACH ROW
    WHEN (NEW.sal <> OLD.sal)
    DECLARE
    l_employee_name VARCHAR2 (240);
    l_old_sal VARCHAR2 (240);
    l_new_sal VARCHAR2 (240);
    l_message VARCHAR2 (240);
    BEGIN
    /* Gets the employee full name */
    BEGIN
    SELECT ename
    INTO l_employee_name
    FROM test_emp_table
    WHERE empno = :OLD.empno;
    EXCEPTION
    WHEN OTHERS
    THEN
    l_employee_name := NULL;
    END;
    /* Gets the old Salary */
    BEGIN
    SELECT sal
    INTO l_old_sal
    FROM test_emp_table
    WHERE empno = :OLD.empno;
    EXCEPTION
    WHEN OTHERS
    THEN
    l_old_sal := 0;
    END;
    /* Gets the new position name */
    BEGIN
    SELECT sal
    INTO l_new_sal
    FROM test_emp_table
    WHERE empno= :NEW.empno;
    EXCEPTION
    WHEN OTHERS
    THEN
    l_new_sal := 0;
    END;
    l_message:=
    'Employee Name= '
    || l_employee_name
    || 'Old Salary= '
    || l_old_sal
    || 'New Salary= '
    || l_new_sal;
    BEGIN
    send_mail (l_message);
    END;
    ==========
    can you please describe it clearly???
    thanks in advance my dear friend????
    Edited by: oraDBA2 on Oct 4, 2008 10:26 PM

  • Need to update one column of all table in that particular schema

    hi all,
    i am using db10g.
    my task is to update one particular column's value of all the table in that schema.
    to acheive the above
    do i have to write update statement for each table or is there any way to do it in bulk?
    i hope my question make sense.
    Thanks..

    Hi karthick,
    I want to know something which is not related to this thread .
    How to include formatted post while replying to thread .
    I know using will be used  format  code before posting  . But how can we  do  it for posted message .
    I hope you understand my question .
    Thanks in advance .                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Problem by adding one spatial column to the version-enabled table

    Hello, I'm trying to modify one version-enabled table T1 like this:
    --table definition
    create table T1
    (ID NUMBER NOT NULL PRIMARY KEY,
    NAME VARCHAR2 (256),
    FUNCTION VARCHAR2 (256));
    --enable versioning
    EXECUTE DBMS_WM.EnableVersioning('T1','VIEW_WO_OVERWRITE');
    I'd like to add one spatial column to this table by:
    -- modify metada view for spatial indexing
    INSERT INTO USER_SDO_GEOM_METADATA (TABLE_NAME, COLUMN_NAME, DIMINFO, SRID)
    VALUES ('T1_LT', 'ANCHOR',
    MDSYS.SDO_DIM_ARRAY
    (MDSYS.SDO_DIM_ELEMENT('X', 0.000, 100000.000, 0.0005),
    MDSYS.SDO_DIM_ELEMENT('Y', 0.000, 100000.000, 0.0005),
    MDSYS.SDO_DIM_ELEMENT('Z', -100, 1000, 0.0005)) , 81989002);
    -- table modification - add a column and create a spatial index
    EXECUTE DBMS_WM.BeginDDL('T1');
    ALTER TABLE T1_LTS ADD ("ANCHOR" MDSYS.SDO_GEOMETRY);
    CREATE INDEX T1_SPX on T1_LTS(ANCHOR) INDEXTYPE is MDSYS.SPATIAL_INDEX;
    EXECUTE DBMS_WM.CommitDDL('T1');
    By finishing of the DDL operation with EXECUTE DBMS_WM.CommitDDL('T1') I get an error message:
    "SQL> EXECUTE DBMS_WM.CommitDDL('T1');
    BEGIN DBMS_WM.CommitDDL('T1'); END;
    ERROR at line 1:
    ORA-20171: WM error: 'CREATE TABLE' and 'CREATE SEQUENCE' privileges needed.
    ORA-06512: at "SYS.WM_ERROR", line 342
    ORA-06512: at "SYS.WM_ERROR", line 359
    ORA-06512: at "SYS.LTUTIL", line 8016
    ORA-06512: at "SYS.LT", line 11925
    ORA-06512: at line 1
    What is wrong here? The Oracle 10g DB is installed on Windows 2003 Server, OWM_VERSION - 10.2.0.1.0.
    Regards,
    Viktor

    Hi,
    You need to explicitly grant the create table and create sequence privileges to the user owning the table. It is not enough for these to be granted by using a role. This restriction is documented in the user guide.
    Also, you should add the entry in the user_sdo_geom_metadata view on the t1_lts table, which is the table to which you are actually adding the geometry column, after calling beginDDL. CommitDDL will make the necessary changes, which in this case would be to add an entry for both t1 and t1_lt.
    Regards,
    Ben

  • How to update two columns in two tables?

    hi friends
    I have two tables linked to each other through SaleNo and SaleDT. their structure as below
    Sales Table============
    SaleNo int PK auto increment
    SaleDT Datetime PK
    Qnty decimal
    Units decimal
    Invoices table
    =================InvoiceNo int PK Auto incremented
    InvoiceDT Datetime
    SaleNo int FK
    SaleDT Datetime FK
    Note that SaleDT column is NOT assigned with getDate() expression.
    1. what I need to do is update the SaleDT column of Sales table and Invoices table with the value '2013-01-31 10:31:55.813', how do I do this without manually breaking the link between the tables?
    2. Assume SaleNos 15 to 27 needs update the SaleDT to '2013-06-12 10:31:55.813', how do I do this complex operation where I I have update SaleDt column of two table of SaleNo range from 15 to 27?
    thanks
    I use Visual studio 2012 Ultimate and SQL server 2008 developer edition!

    Why not below? May be you will not be able to change your design now, but just want to share.
    Sales Table============
    SALEID int PK autoincrement
    SaleNo int
    SaleDT Datetime
    Qnty decimal
    Units decimalUNIQUE (Saleno,SaleDT)
    Invoices table
    =================InvoiceNo int PK Auto incremented
    InvoiceDT Datetime
    SALEID int FK

  • How to Update a clob column..it gives error string literal too long

    I am trying to update a clob column of a table but it gives error string literal too long plz tell me what's the issue
    ORA-01704: string literal too long

    Peeyush wrote:
    I am trying to update a clob column of a table but it gives error string literal too long plz tell me what's the issue
    ORA-01704: string literal too longThere's a problem with my car. It won't start. Why won't it start? Please tell me!
    Oh wait, you can't, because I haven't given you nearly enough information...
    In other words, if you would like help in trying to work out where you've gone wrong, you should provide a small enough example of your code that demonstrates the error. We might then actually stand a chance of being able to help you!

  • Columns justification in tables

    LabVIEW version 8.0
    Is there any way to independently justify at ones, each column of a table, left or centre or right ? and to justify all columns in a table, for instance all left ?
    Simbani

    You can play with negative values for the row-colum index of the active cell property node :
    -1 refers to the column or row header only, while -2 refers to the whole column/row.
    Accordingly -2,-2 refers to the whole table...
    You need to call the cell selection start property to validate the justify operation.
    See the attached vi to find out how to justify all the cells.
    Message Edité par chilly charly le 01-28-2006 01:33 PM
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        
    Attachments:
    Justify table.vi ‏11 KB

Maybe you are looking for

  • Linking Subreports based on group in the main report

    Hello, I have a main report that groups by department, month, and then employee name.  I put a subreport in at the month and name level (it brings back statistics for a particular employee for the chosen month).  The subreport is based on a completel

  • Can't open PDF's in Dreamweaver

    I am unable to open PDF files from Dreamweaver, however I can access a PDF from my share drive.  I am using the Microsoft Office 7 Operating System, CS6 DreamWeaver and Adobe Acrobat X Pro.  I can map to the links and preview.  Any assistance would b

  • How I fixed the Spinning Beach Ball Issue

    Ok, like many of you, I was also getting iTunes to hang when plugging in my shuffle, and it would just sit with the spinning beach ball. Even after an hour, it was still frozen. Well, I just fixed mine. I went to check the Library File to see if it w

  • Alarm Clock apps?!?!?!?!?!?

    This is quite ridiculous. The clock app that comes with the iPhone has absolutely NO customization options whatsoever when it comes to alarms, and its just flat out lame. (Apple really outdone themselves to keep everything absolutely simple, they fai

  • Tidy Favorites has stopped working - anyone else having problems?

    I have been using Tidy Favorites on Firefox for the last 2 years no problem but it has suddenly stopped working from all my computers - the connection just times out.