Help on Procedure and trigger for updating(urgent please)

SQL> / Table A
CTUT_ID CTUT_COMPANY_NAME CURRT_USER_ID FMIS_ID CREATE_DA UPDATE_BY UPDATE_DATE
1234 A 15-APR-03
2222 B 15-APR-03
3333 C 15-APR-03
4444 D 15-APR-03
5555 E 15-APR-03
6666 F 15-APR-03
150282 G oRACLE 23-APR-03
1 H 15-APR-03
2 I 15-APR-03
3 J 15-APR-03
150343 K TIGER 24-APR-03
150305 L EXAMPLE 23-APR-03
150342 M SCOTT 24-APR-03
sQL >/ Table B
Empno     Empname UPDATE_BY UPDATE_DATE
1 AA
2 BB
3 CC
4 DD
What i need to do is i need to create an update trigger on both tables
like create a procedure
1)In procedure i need to check like
IF TABLEA.CURRT_USER_ID = (SELECT USER FROM DUAL)
THEN
UPDATE_BY = (CURRENT_USER_ID of CTUT_ID)
FOR EXAMPLE CURRENT USER_ID IS SCOTT THEN
UPDATE_BY = 150342
UPDATE_DATE = SYSDATE
ELSIF
UPDATE_BY <=> (CURRENT_USER_ID of CTUT_ID)
THEN
MESSAGE('USER IS NOT IN TABLE);
END IF;
and call that procedure in the update triggers
FOR BOTH TABLES TABLEA,TABLEB
i CREATED A PROCEDURE BUT IT IS NOT WORKING
ANY HELP PLEASE
CREATE OR REPLACE PROCEDURE UPDATE(
UPDATE_DATE out DATE,
UPDATE_BY out VARCHAR2)
IS
Uuser varchar2(20);
Udate date;
Ufound number(1);
BEGIN
SELECT USER,SYSDATE
INTO Uuser,Udate from dual;
SELECT count(*),CTUT_ID into Ufound,Uctut_id
FROM TABLEA
WHERE CURRT_USER_ID = Uuser
Group by Ctut_id;
IF (UFOUND = 1) THEN
UPDATE_DATE := UDATE;
UPDATE_BY := UCTUT_ID;
END IF;
EXCEPTION WHEN NO_DATA_FOUND THEN
RAISE_APPLICATION_ERROR(-20001,'User Does not Exist');
END UPD_CONSTITUENT;
CREATE A TRIGGER :
CREATE OR REPLACE TRIGGER TU
BEFORE INSERT ON TABLEA
FOR EACH ROW
BEGIN      
UPDATE(:NEW.update_date,
     :NEW.update_BY);
END IF;      
END;
SQL> update TABLEA
2 set CTUT_COMPANY_NAME = 'SCOTT TEST'
3 WHERE FMIS_USER_ID = 'N';
update TABLEA
ERROR at line 1:
ORA-04091: table TABLEA is mutating, trigger/function may not see it
ORA-06512: at "UPDATE", line 12
ORA-06512: at "TU", line 1
ORA-04088: error during execution of trigger 'TU'

Hi Mara,
You are right thats what i want
I have a table A
EmpNo Empname Currtuser_id Update_date Updateby
1 Denis Oracle
2 Scott Scott
3 Mara MMara
1)what i need to do is when any user tries to update the table Table A
Then the Trigger or procedure should check whether user is exits in table A in column currtuser_id
If his user id exits in table A
Then allow him to update the TABLE A
and insert his EMPNO in UPDATE_BY
and SYSDATE in UPDATE_BY
He will do all this process using forms
But i need to have trigger or procedure in database level for table
2) I have another table like 10 tables
Suppose TABLE B
When user tries to update TABLE B
Then the Trigger or procedure should check whether user is exits in table A in column currtuser_id
If his user id exits in table A
Then allow him to update the TABLE B
and insert his EMPNO in UPDATE_BY
and SYSDATE in UPDATE_BY
3) I need to have a common Procedure and call that procedure in all tables in UPDATE TRIGGER
Thanks for your help
Thanks

Similar Messages

  • Help!! Auto-Deploy and Check For Updates in an OPMN-managed instance

    I'm trying to use the auto-deploy and check for updates functions in an OAS 10.1.0.3 but I can not make it work.
    I don't Know if this functions are only availables for a standalone OC4J instance.
    Can anyone help me??
    Thanks!!! and sorry for my poor english.

    Auto-Deploy is not really designed for an OPMN managed instance -- in earlier releases, this would not even work correctly since deployments where stored in the DCM subsystem and any subsequent configuration changes made via DCM would overwrite the config and you'd lose the "auto-deployed" application.
    In 10.1.3.x where DCM is no longer in the picture, and the auto-deploy polling is a function of Oc4J itself, it may work. Be aware that this is not something that is tested in OPMN managed environments.
    What configuration changes have you made?
    You need to ensure you have modified server.xml so the attribute check-for-updates="all" and you've added the attribute application-auto-deploy-directory and have it pointing at a directory to watch.
    -steve-

  • When the iPhone 4 with IOS 5 is connected by cable to iTunes and check for update results in Error 1630. plz help me

    When the iPhone 4 with IOS 5 is  connected by cable to iTunes and check for update results in Error 1630, plz help me to update plz

    My Iphone 4 crashed yesterday after a restart and upload of OS 5.0, it will only partially sync.  It's not transferring any of my music or ringtones.  They still appear when I click open the sync screens on ITunes, but I don't seem to have an Ipod function and only one of my personalized ringtones transfers on the actual phone.

  • HT1339 My ipod classic fails the sync test on Windows 7. help say go to summary tab and check for updates. I cannot find a summary tab

    My ipod is failing the sync diagnostic on my Windows 7. The troubleshooting guide say go to the Summary Tab and "check for updates" I can't find a summary tab. I have no problem sync with windows vista.

    chicx wrote:
    This is the third time of writing this on your Apple Support Communities!
    Not with your current user id.
    Far too much uneccesary information in your post, which only confuses things, a vast amount!
    Let's start with iTunes.
    Have you updated iTunes to 11.1.5, because the previous version did appear to have an issue about seeing iPods?
    With iTunes 11.1.5 installed, look in Edit/Preferences/Devices, (or use the ALT key, followed by the E key and then the F key) and make sure that the box named Prevent iPods, iPhones and iPads from syncing automatically does not have a tick in the box.
    Once you have doen those two things, check to see if the iPod is seen by iTunes.
    chicx wrote:
    By the way, what does IOS mean? (I thought IO stood for operating system, but am flummoxed by the S on the end.
    Really?
    OS stands for Operating System. (In computer speak, IO means Input/Output.)
    iOS originally stood for iPhone Operating System, but it now refers to the iPod Touch and iPhone. The iPod Classic, which you have listed in your profile as your iPod, does not use iOS.
    I assume that you have been listening to the Podcast in your iTunes on the computer as you cannot transfer it to your iPod. It's what I'd do.

  • Creation of sequence and trigger for each table!!!!!!!1

    Hi
    I am new to trigger and Sequence field. In one of my database we have many tables with fields for specifing ID numbers. Iam planning to insert the ID field with help of a Sequence and trigger...that trigger fires by adding the sequence value from the dual table. Now the point is here we r having around *60* table with ID field. And i am planning use the above process for each table by creating sequences and trigger for each table.
    Will this affects the performance of database.
    Is there any other option other than the above process, I mean other than creating sequences and trigger for each table.
    PLzz help to resolve this issuee......
    Shiyas
    Edited by: user13170361 on Jun 7, 2010 12:37 AM

    Tiger, I didn't mind about your comment, but the point is try to use
    select NVL(max(a) + 1,1) into i from p1_temp;This line in your trigger code and see what is happening. The problem is with your trigger. You are using group by function and you will not get no_data_found !
    For more help, this is some modification of your code.
    SQL> create table p1_temp (a number(10) primary key, b number(10));
    Table created.
    SQL> create or replace trigger trg_p1_temp
      2  before insert on p1_temp for each row
      3  declare
      4  i number(10);
      5  begin
      6  begin
      7  select NVL(max(a) + 1,1) into i from p1_temp;
      8  exception
      9  when no_data_found then
    10  i := 1;
    11  end;
    12  :new.a := i;
    13  end;
    14  /
    Trigger created.
    SQL> insert into p1_temp(b) values (1);
    1 row created.
    SQL> insert into p1_temp(b) values (2);
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select * from p1_temp;
             A          B
             1          1
             2          2
    SQL> Edited by: Saubhik on Jun 7, 2010 2:30 AM

  • HT1688 I can not restore and upgrade my Iphone 4. When i plug in to computer itune's restore and check for update buttons are not active.

    I can not restore and upgrade my Iphone 4. When i plug in to computer itune's restore and check for update buttons are not active. What is that mean?

    Razmee,
    Guess what? After posting, I read another thread on this topic where someone said they went to an Apple store and the tech person there added the optional username and password in the Outgoing Mail Server boxes, and then reset the phone again. Although I had tried resetting and restarting a few times today, I had NOT reset it after entering the username and password into the optional fields.
    When I entered my username and password into the optional fields, the iPhone entered checks (ticks) to the right of every entry; it had not done this earlier. (I didn't reset at this time, and the outgoing mail would still not transmit).
    So just now, I reset it and the outgoing email was sent!
    Thanks to you and this forum, it's a great ending to a few frustrating days.
    I hope this message helps others. Not only does everything have to be entered correctly in the respective boxes; but once everything is entered and you press the "Done" button, every box should then have a check mark next to it and then you must reset the phone.

  • Planning Procedure and Horizon Auto Update

    Is it possible to auto update the planning procedure as (4) and SNP, PPDS horizon (360 days) while CIFing material from ECC to APO.
    Is their any coding required for the same?
    Regards

    Hi,
    If you want to maintain same value of horizon for all products, you can maintain this in Model & Version management.
    PP Planning Procedure can be maintained using MassD.
    If you want to maintain different values of PP Planning procedure and Horizon for each product, you can use ABAP code for this. There are CIF user exits from both APO side and ECC side. This is regular process in almost all projects and developers would be aware of these function modules.
    Regards,
    Bipin

  • Please tell the basic procedure and operations for inventory in Sap

    Hello:
          everybody,  please tell me the basic procedure and operations for inventory
    in sap?  couldn't thank you more.                                                                               
    Frank
                                                                                    Best regards

    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/MMIM/MMIM.pdf
    /people/community.user/blog/2007/05/04/physical-inventory-in-material-management
    Physical Inventory Cycle:
    1. Create physical Inventory document MI01
    2. Print physical inventory document MI21
    3. Enter count MI04
    4. Execute difference list MI20
    5. Post with/without differences MI07
    Configuration :
    Inventory Management and Physical Inventory
    Plant Parameters for inventory management
    Goods receipt: Set tolerance limit
    Valuation and Account Determination
    Define Price Control for Material Types
    Account Determination without Wizard
    Rewards if Helpful

  • What can I do to change the sound of a track in garageband?  It is "stuck" on electric piano setting and will not change. I've tried restarting, restoring sound library, full key reset, and checked for updates.

    What can I do to change the sound of a track in garageband?  It is "stuck" on electric piano setting and will not change. I've tried restarting, restoring sound library, full key reset, and checked for updates.

    Hi
    In iMovie'11 (version 9.0.x)
    on top menu row - Apple/iMovie/File/Edit/Cut (Can vary dep. on language - in Swedish Apple/iMovie/Arkiv/Redigera/Klipp . . . )
    down Cut menu - Slow playback/Raspid Playback/Re-play in Slow Motion and onvards
    Here one can select the Pre-Set speeds
    Are you familiar with getting 'inspector' to run?
    No - but I guess that Double Click on clip/sequense or ctrl-Click on it might open it.
    Yours Bengt W

  • HT1338 Need help locating where and how to update Mac OS-X 10.6.5 to the latest Mountain Lion Software...thanx John

    I need help locating where and how to update Mac OS-X to Mountain Lion.....Thanx....Jay

    First update your 10.6 version to 10.6.8 from the software update under the Apple Menu.
    This will add direct access to the Mac App store via a new application.
    Now launch the App Store from your Applications folder - Its the new icon a letter A formed from a ruler pencil and pen on a blue circle !
    Once launched you need to add your iTunes account details or create an account add payment details etc...
    Sign in purchase download and follow install processes to upgrade to 10.8 Mountain Lion.
    OH and to be safe BEFORE you install backup your current system to an external drive !

  • I did force shutdown on my MacBook Pro (2006 year, 15.4"), so, when I tried to boot, it shows apple logo (as usual) and shuts down. When I booting MacBook with Option key pressed it shows lock icon and field for password. Please help me.

    I did force shutdown on my MacBook Pro (2006 year, 15.4"), so, when I tried to boot, it shows apple logo (as usual) and shuts down. When I booting MacBook with Option key pressed it shows lock icon and field for password. Please help me.

    Wait for advice on repairing a damaged filesystem.  Forceshutdown stops processs in mid-stream and leaves some parts not-valid.
    Do not proceed until you get that avice.

  • I am trying to download the InDesign CS5.5 update and keep getting "Update Failed" "Please contact your Administrator if you wish to apply updates on your machine". I have done this and now have Administrator rights, but I am still getting the message. Ho

    I am trying to download the InDesign CS5.5 update and keep getting "Update Failed" "Please contact your Administrator if you wish to apply updates on your machine". I have done this and now have Administrator rights, but I am still getting the message. How do I apply the update?

    Direct Updates
    https://www.adobe.com/downloads/updates/

  • HT5654 Im clicking help and checking for updates, the updates come up so I click to download it and nothing happens, help me?

    Ive clicked on help to check for updates, the update I needed came up so I clicked update and nothing happened, what do I do?

    Going by your profile your Mac has v10.5.8 installed. That is the most recent version available for Leopard.
    You may be able to upgrade to v10.6 Snow Leopard >  Mac OS X v10.6 Snow Leopard - Technical Specifications
    Snow Leopard is available for purchase from the Apple online store > Mac OS X 10.6 Snow Leopard - Apple Store (U.S.)
    With Snow Leopard installed, iTunes would be updated for you.

  • Help needed in PL/SQL for updating the column for multiple records

    Hi,
    I am new to PL/SQL and need some help. What is the most effiecient way to update some field in a table as I may need to update thousands of records. I have a coulmn groupid can have multiple records tied to it. All the records attached to some groupid have a priority field also.
    How can I update the prorityfield value for all the groupids in a profiecient way. Here is a sample data
    GroupId     Priority
    1            1
    1            2
    1            3
    1            4
    1            5
    2            1
    2            2
    2            3
    3            1Here I have three groups 1, 2, 3. Now if any group contains only one record the priority remains same e.g. groupid=3 on top. If any group contains more than one record e.g. groupid=1 & 2 I want to re-arrange the priority fields e.g. If I want to update groupid=1 now if I change the priority of 2 to 5 (make it the last) I want to rearrange the remaing records priority i.e. if 2 becomes 5 as I have 5 rows for groupid=1 then 5 becomes 4, 4 becomes 3, 3 becomes 2 and 1 remains the same.
    Same wya if I want to make the priority 1 to 3 for groupid=2 then need 2 to become 1 and 3 to become 2 etc....
    Any help is appreciated.
    Thanks

    Hi,
    You don't need PL/SQL to do this (though you can put the following in PL/SQL if you want to):
    UPDATE     table_x
    SET     priority = CASE
                   WHEN  groupid     = 1
                   AND   priority = 2
                        THEN  5
                   WHEN  groupod     = 1
                   AND   priority     BETWEEN 3 AND 5
                        THEN  priority - 1
                   WHEN  groupid = 2
                   THEN
                        CASE
                             WHEN  prioity = 1
                             THEN  3
                             ELSE  priority - 1
                        END
                 END
    WHERE     groupId          IN (1, 2)
    AND     (     priority     BETWEEN 2 AND 5
         OR     groupid          = 2
         );There are lots of different techniques that can reduce your coidng: for example, the nested CASE statement used for groupid=2 above.
    You could do several smaller UPDATEs (for example, one just for groupid=1). Execution will be slower, but coding and testing will be faster.
    You could make the "magic numbers" 2 (for groupid=1) and 1 (for groupid=2) variables, even outside of PL/SQL.
    If you need more help, post the information that Satyaki requested.

  • Fixes to see CD's in ITunes and check for updates

    I was having two problems with ITunes after upgrading to version 6. CD's wouldn't show up in itunes and if i checked for updates it would say "the itunes server can not be contacted, please check your internet or try again later" My internet connection was working fine.
    The solution that fixed both was with Norton Internet Security but I would guess similar software could cause the same problem. Go to Norton Internet security, click on status and settings; personal firewall; configure button; programs tab; select apple itunes and change from blocked to automatic or permit all, clicked ok and relauched itunes.
    I actually thought it would only fix the update issue but was pleasantly suprised that ITunes can see cd's again. I hope this helps.

    well done, Herman!
    I actually thought it would only fix the update issue but was pleasantly suprised that ITunes can see cd's again.
    yep ... you're about the third person i've seen accidentally solve a CD recognition problem by fixing their other Norton problems. i'm starting to ask people about Norton if they don't get CDs showing up in their source lists ...
    love, b

Maybe you are looking for

  • DTP is not running by request by request?

    Hi , Am loading data from DSO - > cube , by DTP which setting as extraction mode as Get all new data request by request. In actual scenario i collected around 7 requests of data in DSO, so by functionality of Cube DTP setting  Get all new data reques

  • HT1711 Is buying the song on iTunes buying the rights to use the song in a video

    Is buying a song on iTunes buying the rights to use it in a video

  • Unavailable Fonts Preview-Information-Warning Missing SC5

    Chris Cox suggested I start a new on this subject when I mentioned it in another thread. CS5 12.0.1 - 10.6.4: I open a layered .psd with a text layer (font not available on system). Ps opens and gives missing font error. Ps displays a substituted fon

  • BPC Export data with filter

    Hello. It is necessary to export BPC transactional data by means of a standard export chain. How can I to customize filter use for export? Order my actions: 1.Run the Export package with Data Manager.  2.Choose a file name. 3. Choose the dimension. I

  • MIRO system Alert when user does a reversal entry.

    Dear Friends, The Process is like this. 1. PO Creation ( Import) 2. Goods Receipt 3. Miro - custom duty amount & quantity is captured. Currently the user is able to reverse the Miro. So, The requirement is that, whenever Miro Captures custom duty amo