Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Concatenating and copying columns data

Re: Concatenating and copying columns data

From: <dustin.parkman_at_bentley.com>
Date: 9 Apr 2007 06:56:45 -0700
Message-ID: <1176127005.662882.139220@q75g2000hsh.googlegroups.com>


Sounds like all you are trying to do is the following. This is just pseudo code so you will have to verify that it actually operates correctly on your end, but this should give you get you going in the right direction. You will need to add some validation for column B. It's typically bad practice to do this in a trigger, but if you have to you should look at EXCEPTIONS(VALUE_ERROR).

CREATE TRIGGER YourTriggerName AFTER INSERT or UPDATE BEGIN
    UPDATE YourTableName A Set A.C = ASCII(A.A) + A.BWHERE A.ID = new.ID;
END; OR

CREATE TRIGGER YourTriggerName AFTER INSERT or UPDATE BEGIN
/*Check to see if column B can be be cast to a numeric. If so update column C. If not throw an exception.

    UPDATE YourTableName A Set A.C = ASCII(A.A) + TO_CHAR(TO_ NUMBER(A.B)) WHERE A.ID = new.ID;

    EXCEPTIONS

        WHEN VALUE_ERROR
            //Do Something

END; Received on Mon Apr 09 2007 - 08:56:45 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US