How can i minimize this  trigger code

Hi,
I've written the following trigger ,based on the requirement...
Requirement is following:
After updating the src table(EMPS) corresponding data need to be replicated to dest (REP_EMPS)
While UPDATING ('STATUS') the following conditions to be matched
*(1) updating from any char to 'V then modtp= 'I' AND 'D'*
*(2) updating from 'V r to any char then modtp= 'I' AND 'D'*
*(3) ANY TO ANY THEN modtp='U'*
*(4) while deleting modtp='D'*
So the following trigger is working fine ..
But my doubt is can i even be minimize the code so as to achieve the requirement
CREATE TABLE TEST.EMPS
  EMPNO   NUMBER,
  ENAME   VARCHAR2(11 BYTE),
  STATUS  CHAR(1 BYTE)
CREATE TABLE TEST.REP_EMPS
  ENO    NUMBER,
  ENM    VARCHAR2(11 BYTE),
  STS    CHAR(1 BYTE),
  MODTP  CHAR(1 BYTE)
)Trigger:
CREATE OR REPLACE TRIGGER TEST.EMP_UDAR1
AFTER UPDATE OR DELETE
OF ENAME,STATUS
ON TEST.EMPS  REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
nmodtp char(1):='U';
omodtp char(1):='D';
nempno EMPS.EMPNO%TYPE:=:NEW.EMPNO;
oempno EMPS.EMPNO%TYPE:=:OLD.EMPNO;
nename EMPS.ENAME%TYPE:=:NEW.ENAME;
oename EMPS.ENAME%TYPE:=:OLD.ENAME;
nstatus EMPS.STATUS%TYPE:=:NEW.STATUS;
ostatus EMPS.STATUS%TYPE:=:OLD.STATUS;
docon number:=0;
dodiscon number:=0;
BEGIN
IF (UPDATING('STATUS') AND (:NEW.STATUS='V' OR :OLD.STATUS='V')) THEN
  docon:=1;
  nmodtp:='I';
ELSIF (NOT DELETING) THEN
  docon:=1;
END IF;
IF DELETING or (UPDATING('STATUS') AND (:NEW.STATUS='V' OR :OLD.STATUS='V')) THEN
  dodiscon:=1;
    END IF;
INSERT ALL
WHEN (docon=1) THEN
INTO REP_EMPS(ENO,ENM,STS,modtp)
VALUES(nempno,nename,nstatus,nmodtp)
WHEN (dodiscon=1) THEN
INTO REP_EMPS(ENO,ENM,STS,modtp)
VALUES(oempno,oename,ostatus,omodtp)
SELECT nempno AS nempno,
       oempno AS oempno,
       nename AS nename,
       oename AS oename,
       nstatus AS nstatus,
       ostatus AS ostatus,
       nmodtp AS modtp,
       omodtp AS modtp
FROM DUAL;
END;
/i tried with following in the if condition but not getting the required output
IF (UPDATING('STATUS') AND (:NEW.STATUS='V' OR :OLD.STATUS='V')) THEN
  docon:=1;
  nmodtp:='I';
ELSIF (DELETING) or (UPDATING('STATUS') AND (:NEW.STATUS='V' OR :OLD.STATUS='V')) THEN
  dodiscon:=1;
ELSE
  docon:=1;
END IF;thank you,
josh.....

Hope this helps you
create or replace
TRIGGER EMP_UDAR1
AFTER UPDATE OR DELETE
OF ENAME,STATUS
ON EMPS  REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
-- no need to declaer other variables here.
nmodtp char(1):='U';
omodtp char(1):='D';
docon number:=0;
dodiscon number:=0;
BEGIN
  IF (UPDATING('STATUS') AND (:NEW.STATUS='V' OR :OLD.STATUS='V')) THEN
    docon:=1;
    nmodtp:='I';
  ELSIF (NOT DELETING) THEN
    docon:=1;
  END IF;
  IF DELETING or (UPDATING('STATUS') AND (:NEW.STATUS='V' OR :OLD.STATUS='V'))
  THEN
    dodiscon:=1;
  END IF;
INSERT ALL
    WHEN (docon=1) THEN
      INTO REP_EMPS(ENO,ENM,STS,modtp)
      VALUES(:New.empno,:New.ename,:New.status,:New.modtp) -- Use the :NEW.column values available
    WHEN (dodiscon=1) THEN
      INTO REP_EMPS(ENO,ENM,STS,modtp)
      VALUES(:OLD.empno,:OLD.ename,:OLD.status,:OLD.modtp)-- Use the :OLD.column values available
SELECT *  FROM DUAL; -- You can do this
END;

Similar Messages

  • How can i write this C-Code in G-Code

    hallo
    how can I write this C-Code in LabVIew ,
    for a=0; a=<10; a++
       for b=0; b=5 ; b+2
            X= 3+b;
      Y=1+a;
    please see the attachment and tell me where is the problem
    Attachments:
    Unbenannt 11.vi ‏43 KB

    Well, at least you tried and got some of it right.
    I think this should do what you want, but my C is rusty. Is the increment performed before or after the loop executes? If it's after, then I believe the loop should iterate 11 times, not 10.
    In any case, you should note that for a literal translation, you would need to add a sequence structure to guarantee that Y was written to only after the inner loop finished because of the way data-flow works.. Also, note that controls and indicators in LabVIEW are not equivalent to variables. They can be used as such, but they usually should not be.
    Another point about this is that you probably want to use the correct data type - the orange terminals are floating point indicators (of double precision, in this case) and you want integers.
    To learn more about LabVIEW, I suggest you try looking at some of these tutorials.
    Try to take over the world!
    Attachments:
    C.png ‏4 KB

  • How can i obtain this block code of a Font

    Hello,
    I want to know how do I obtain the definition of a Font (TrueType), I found a block code, and I supposed is the definition of the Font in a PS file. Is it correct?
    I added part of the code, to explain me better.
    $_FONT_ARIALMT ="%%BeginResource: font ArialMT
    %ct_CffDict begin
    %!FontType1
    16 dict begin
    /FontInfo 15 dict dup begin
    /Notice (Copyright (c) 1991, 1993, 1996, 1997, 1998, 1999 Adobe Systems Incorporated.  All Rights Reserved.Arial is a trademark of The Monotype Corporation, registered in the US Patent and Trademark Office and elsewhere.) def
    /version (001.001) def
    /FullName (Arial MT) def
    /FamilyName (Arial MT) def
    /Weight (Regular) def
    /ItalicAngle 0 def
    How to obtain this lines but of another TrueType Font?
    Thanks a lot for your help.

    The PFB files are printer font binary files and they contain a mixture of 7-bit ascii and 8-bit binary characters.
    Read the Adobe Type 1 Font Format version 1.1 book (especially Chapter 2: Font Program Organization on page 11).
    I wrote an application in "C" that reads .PFB files and makes .PS files that are used to insert into PostScript jobs. Whether it is easy or not depends on your level of proficiency in "C" or whatever language you use.

  • New computer win 8.1 pro, installed my creative Suite 4 Design premium but it shuts down when I try to use any of the programs and gives me an error code 147:20. How can I fix this?

    New computer win 8.1 pro, installed my creative Suite 4 Design premium but it shuts down when I try to use any of the programs and gives me an error code 147:20. How can I fix this? Is this a conflict with win 8.1 pro?

    You need to adjust your security stuff/ permissions and possibly use compatibility modes. It means that your licensing service is being blocked/ shut down.
    Mylenium

  • I bought Photoshop CS6 Extended(education edition) for Mac. Now ik want to install it on my (new) macbook. I have the product code and serial number. I receive an error code: may be a false copy. How can I install this program?

    In 2012, I bought Photoshop CS6 Extended (education edition) for Mac. Now I want to install it on my new Macbook. I have the correct serial number and product code, but I receive an error message: the software may be a false copy etc....What to do?

    Here is a copy of the error
    This means : Installation failed.
    Verification of the Adobe Software failed
    The product you want to install is no valid Adobe product and seems to be falsified.
    HUgo
    Op 29-aug.-2014, om 23:42 heeft Jeff A Wright <[email protected]> het volgende geschreven:
    I bought Photoshop CS6 Extended(education edition) for Mac. Now ik want to install it on my (new) macbook. I have the product code and serial number. I receive an error code: may be a false copy. How can I install this program?
    created by Jeff A Wright in Downloading, Installing, Setting Up - View the full discussion
    Hugo please turn off your e-mail signature.
    If your serial number is listed as being valid at http://www.adobe.com/ then I would recommend obtaining a fresh copy of the installation files.  You can find details on how to locate your serial number at Find your serial number quickly - http://helpx.adobe.com/x-productkb/global/find-serial-number.html.
    To download a fresh copy of the installation files please see Download CS6 products.
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at https://forums.adobe.com/message/6685617#6685617
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page:
    To unsubscribe from this thread, please visit the message page at . In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Downloading, Installing, Setting Up by email or at Adobe Community
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/thread/416458?tstart=0.

  • HT3702 I'm TRYIN to dwnload an app however it's fails bc the security code on my card is incorrect however it is correct how can I resolve this issue

    I'm TRYIN to dwnload an app however it's fails bc the security code on my card is incorrect however it is correct how can I resolve this issueU

    This happens to me as well

  • TS3694 I am getting error code 3194 when i try to update my iphone 4S to IOS 6.1.3. How can i resolve this

    I am getting error code 3194 when i try to update my iphone 4S to IOS 6.1.3. How can i resolve this?

    Here you go:  http://lmgtfy.com/?q=iphone+error+3194

  • I am trying to download trial CC, but i am receiving error cod 205. how can i fix this problem? few months ago, i used trial CC and deleted it.

    i am trying to download trial CC, but i am receiving error cod 205. how can i fix this problem? few months ago, i used trial CC and deleted it.

    Creative Cloud Help / Error downloading Creative Cloud applications
    http://helpx.adobe.com/creative-cloud/kb/error-downloading-cc-apps.html

  • I get an error code 50 when downloading digital movie. How can I fix this issue?

    I get an error code 50 when downloading digital copy of a movie to my iTunes. I try to restart and still get the smae error code. I have my PC plugged directly into my modem and still get error, when trying to download failed movies. I have 5 failed downloads. How can I fix this issue?

    Try the "Error -50," "-5000," "8003," "8008," or "-42023" section in the Specific Conditions and Alert Messages: (Mac OS X / Windows) section of the following document:
    iTunes: Advanced iTunes Store troubleshooting

  • How  can i run this code correctly?

    hello, everybody:
        when  i run the code, i found that it dons't work,so ,i  hope somebody can help me!
        the Ball class is this :
        package {
        import flash.display.Sprite;
        [SWF(width = "550", height = "400")]
        public class Ball extends Sprite {
            private var radius:Number;
            private var color:uint;
            private var vx:Number;
            private var vy:Number;
            public function Ball(radius:Number=40, color:uint=0xff9900,
            vx:Number =0, vy:Number =0) {
                this.radius= radius;
                this.color = color;
                this.vx = vx;
                this.vy = vy;
                init();
            private function init():void {
                graphics.beginFill(color);
                graphics.drawCircle(0,0,radius);
                graphics.endFill();
    and the Chain class code is :
    package {
        import flash.display.Sprite;
        import flash.events.Event;
        [SWF(width = "550", height = "400")]
        public class Chain extends Sprite {
            private var ball0:Ball;
            private var ball1:Ball;
            private var ball2:Ball;
            private var spring:Number = 0.1;
            private var friction:Number = 0.8;
            private var gravity:Number = 5;
            //private var vx:Number =0;
            //private var vy:Number = 0;
            public function Chain() {
                init();
            public function init():void {
                ball0  = new Ball(20);
                addChild(ball0);
                ball1 = new Ball(20);
                addChild(ball1);
                ball2 = new Ball(20);
                addChild(ball2);
                addEventListener(Event.ENTER_FRAME, onEnterFrame);
            private function onEnterFrame(event:Event):void {
                moveBall(ball0, mouseX, mouseY);
                moveBall(ball1, ball0.x, ball0.y);
                moveBall(ball2, ball1.x, ball1.y);
                graphics.clear();
                graphics.lineStyle(1);
                graphics.moveTo(mouseX, mouseY);
                graphics.lineTo(ball0.x, ball0.y);
                graphics.lineTo(ball1.x, ball1.y);
                graphics.lineTo(ball2.x, ball2.y);
            private function moveBall(ball:Ball,
                                      targetX:Number,
                                      targetY:Number):void {
                ball.vx += (targetX - ball.x) * spring;
                ball.vy += (targetY - ball.y) * spring;
                ball.vy += gravity;
                ball.vx *= friction;
                ball.vy *= friction;
                ball.x += vx;
                ball.y += vy;
    thanks every body's help!

    ok, thanks for your reply ! I run this code in the Flex builder 3!and the Ball class and the Chain class are all in the same AS project!
      and i changed the ball.pv property as public in the Ball class, and  the Chain class has no wrong syntactic analysis,but the AS code don't run.so this is the problem.
    2010-04-21
    Fang
    发件人: Ned Murphy <[email protected]>
    发送时间: 2010-04-20 23:01
    主 题: how  can i run this code correctly?
    收件人: fang alvin <[email protected]>
    I don't see that the Ball class has a pv property, or that you even try to access a pv property in the Chain class.  All of the properties in your Ball class are declared as private, so you probably cannot access them directly.  They would need to be public.  Also, I still don't see where you import Ball in the chain class such that it can use it.

  • What is error code 3194 and how can i past this for i can update my ipod to 5.0.1, what is error code 3194 and how can i past this for i can update my ipod to 5.0.1

    what is error code 3194 and how can i past this for i can update my ipod to 5.0.1, what is error code 3194 and how can i past this for i can update my ipod to 5.0.1

    This device is not eligible for the requested build: Also sometimes displayed as an "error 3194." If you receive this alert, update to the latest version of iTunes. Third-party security software or router security settings can also cause this issue. To resolve this, follow Troubleshooting security software issues.
    Downgrading to a previous version of iOS is not supported. If you have installed software to performunauthorized modifications to your iOS device, that software may have redirected connections to the update server (gs.apple.com) within the Hosts file. First you must uninstall the unauthorized modification software from the computer, then edit out the "gs.apple.com" redirect from the hosts file, and then restart the computer for the host file changes to take affect.  For steps to edit the Hosts file and allow iTunes to communicate with the update server, see iTunes: Troubleshooting iTunes Store on your computer, iPhone, iPad, or iPod—follow steps under the heading Blocked by configuration (Mac OS X / Windows) > Rebuild network information > The hosts file may also be blocking the iTunes Store. If you do not uninstall the unauthorized modification software prior to editing the hosts file, that software may automatically modify the hosts file again on restart. Also, using an older or modified .ipsw file can cause this issue. Try moving the current .ipsw file, or try restoring in a new user to ensure that iTunes downloads a new .ipsw.
    Error 3194: Resolve error 3194 by updating to the latest version of iTunes. "This device is not eligible for the requested build" in the updater logs confirms this is the root of the issue. For more Error 3194 steps see: This device is not eligible for the requested build above.
    Above from:
    http://support.apple.com/kb/TS3694

  • When trying to import videos off of a CD I continually get error code -36 on one of the videos. How can I fix this?

    When trying to import videos off of a CD I continually get error code -36 on one of the videos. How can I fix this?

    Contact Apple and request a 10.4 or possibly a 10.5 distribution disk for this system, if you've not obtained that DVD disk from the seller. 
    Boot and use that distribution disk to wipe the hard disk via Disk Utility, and to then reinstall OS X. 
    Best to start with a fresh installation of OS X, as that'll provide the default environment and not something that's been customized and extended by the previous owner.
    The last OS X version that was supported for most PowerMac G5 systems was 10.5.8, and that would be preferable — if your Mac supports that.
    If you're not sure which Mac you have, then use the  > About This Mac from the menu and request more information on the system.  You're looking for a model number listed there, and that'd be something like PowerMac7,3 or PowerMac11,2 for a ~2005-vintage PowerMac system.  Whatever model number you have can then be used to determine the general specs for the configuration, and what the last version of OS X that was supported for the system.

  • My Macbook pro won't open downloaded programs. it just opens the code it was written in using the text and edit app. How can I fix this?

    My Macbook pro won't open downloaded programs, it just opens the code it was written in using the text and edit app. How can I fix this? I just bought the computer last month so this is some what frustrating.

    If you are downloading .exe files, those are Windows programs, and will not run on your Mac unless you install Windows on it.  (That is possible, if you need one of those apps.)

  • I have to type my security code every time I turn on my ipad with ios6.0. I don' have to this with ios5.1. How can I solve this problem?

    I have two problems with IOS 6.0.
    1. I have to type my security code every time I turn on my ipad with ios6.0. I don' have to to his with ios5.1. How can I solve this problem?
    2. I can not send email via Yahoo as usual, Only Safari allow me to it.
    Accordingly, I am writting here to ask for to solve those problems.
    Thanks in advance.

    * Websites remembering you and automatically log you in is stored in a cookie.
    * You need an allow cookie exception (Tools > Options > Privacy > Cookies: Exceptions) to keep that cookie, especially for secure websites and if you let cookies expire when Firefox closes
    * Make sure that you do not use [[Clear Recent History]] to clear the "Cookies" and the "Site Preferences"
    See also http://kb.mozillazine.org/Cookies

  • How can i know how to redeem the code? how can i get this code?

    how can i know how to redeem the code? how can i get this code? please i need you help
    <Email Edited by Host>

    You are trying to create a new Apple ID? You don't have one yet? Is that correct?
    If so, then see this article on how to creat your Apple ID - and make up a password for it. Remember to write it down immediately.
    http://support.apple.com/en-us/HT203993

Maybe you are looking for

  • Error while executing LUW in SM58 - Mess.No.SY359

    hi, error while executing LUW in SM58 Error. Mess.No.SY359 "Function module does not exist or EXCEPTION raised-sy359" trfc has been configured and try to push the Idoc through SM58 need help on this. Regards Leo

  • How do I open te files in older versions of Director?

    I made a movie in Director 11 and it doesn't open in director 10. It show's a message like "file is too new". I tried to find in Director 11 an option for saving in older versions of director but I didn't find anything. How's that possible?

  • Mini as server or desktop ... or simultaneously both?

    Can the mini be set up to operate effectively for desktop service and secondarily as a small personal server for home office use? What are the concerns? Thanks in advance for your insight.

  • Utilization of VAT

    Hi CIN guys, How can we avail the input credit (utilization) of VAT (sales tax) in CIN.  any t.codes regards, mallik

  • Linking to local video on iPad

    Hello, I'm trying to link to a local file on the iPad from a pdf or ePub and have no idea what the file directory is for QuickTime movies in the Videos application. Does anybody know how to link to a local file on the iPad? Thanks very much.