Creating triggers in a package

Does any body has an example on how to create triggers in package/package body.
Here is an example of one of many triggers that I need to create in a package.
CREATE OR REPLACE TRIGGER distributor_q_i
BEFORE INSERT ON f_sw.WQM001Q000001
FOR EACH ROW
DECLARE
lv_sql_error_code PLS_INTEGER;
lv_sql_error_message VARCHAR2(512);--Maximum SQL error message size:512
BEGIN
INSERT INTO [email protected]
(F_PRITIME, F_STATUS, F_DELAY, F_TIMEOUT, F_USERID,
F_GROUPID, UF000, UF001, UF002, UF003, UF004, UF005,
UF006,SYS_CREATED_DATE, SYS_STATUS_DATE,
SYS_STATUS_PREV,SYS_USER_NAME, SYS_USER_IP )
VALUES (:new.f_pritime,:new.f_status,:new.f_delay,:new.f_timeout,
:new.f_userid,:new.f_groupid,:new.uf000,:new.uf001,
:new.uf002,:new.uf003,:new.uf004,:new.uf005,
:new.uf006,SYSDATE, SYSDATE, null, USER, null);
EXCEPTION
WHEN OTHERS THEN
lv_sql_error_code := SQLCODE;
lv_sql_error_message := SQLERRM(v_sql_error_code);
DBMS_OUTPUT.PUT_LINE('OTHER ERROR');
DBMS_OUTPUT.PUT_LINE(v_sql_error_message);
END distributor_q_i;
show errors;

Hello
That idea is pretty much fine. If you're on 9i the values(rec1) will work, if you're on 8i you'll have to specify each column i.e.
SQL> CREATE OR REPLACE PACKAGE dt_test_package
  2  AS
  3  PROCEDURE proc1 (rec1 IN dt_test_tab2%ROWTYPE);
  4  END;
  5  /
Package created.
SQL> CREATE OR REPLACE PACKAGE BODY dt_test_package
  2  AS
  3  PROCEDURE proc1 (rec1 IN dt_test_tab2%ROWTYPE)
  4  IS
  5  BEGIN
  6  INSERT INTO dt_test_tab2 VALUES(rec1.col1,rec1.col2);
  7  END;
  8  END;
  9  /
Package body created.
SQL> CREATE OR REPLACE TRIGGER dt_test_trigger BEFORE INSERT ON dt_test_tab1 FOR EACH ROW
  2
  3  DECLARE
  4  rec1 dt_test_tab2%ROWTYPE;
  5  BEGIN
  6  rec1.col1 := :NEW.col1;
  7  rec1.col2 := :NEW.col2;
  8  dt_test_package.proc1(rec1);
  9  END;
10  /
Trigger created.
SQL> insert into dt_test_tab1 values('col1','col2','col3');
1 row created.
SQL> /
1 row created.
SQL> select * from dt_test_tab1;
COL1       COL2       COL3
col1       col2       col3
col1       col2       col3
SQL> select * from dt_test_tab2;
COL1       COL2
col1       col2
col1       col2David

Similar Messages

  • Giving error of insufficient privileges while creating triggers

    Hi all,
    I am facing the problem of insuffcient privilege on base tables while creating triggers. I have three schemas say A, B, C in my database.
    Base tables are in schema A. I have given all the grants on base table to schema B and C.
    grant all on base_table_name to B;
    grant all on base_table_name to C;
    I have created synonym also on that base table.
    And i m creating triggers in schema B.
    When i execute the query for trigger the it giving following error :
    +AFTER INSERT OR UPDATE OR DELETE ON BASE_TBALE_NAME                                      *+
    ERROR at line 3:
    ORA-01031: insufficient privileges
    even i have checked in dba_tab_privs for that base_table.....it is showing all the grants to USER B and C.
    What should I do now?
    please suggest.......
    Regards,
    Andy.

    Hi karan,
    You are right. While searching docs i got the solution of my problem.
    Privileges Required to Use Triggers
    To create a trigger in your schema:
    +•You must have the CREATE TRIGGER system privilege+
    +•One of the following must be true:+
    +◦You own the table specified in the triggering statement+
    +◦You have the ALTER privilege for the table specified in the triggering statement+
    +◦You have the ALTER ANY TABLE system privilege+
    To create a trigger in another schema, or to reference a table in another schema from a trigger in your schema:
    +•You must have the CREATE ANY TRIGGER system privilege.+
    +•You must have the EXECUTE privilege on the referenced subprograms or packages.+
    To create a trigger on the database, you must have the ADMINISTER DATABASE TRIGGER privilege. If this privilege is later revoked, you can drop the trigger but not alter it.
    The object privileges to the schema objects referenced in the trigger body must be granted to the trigger owner explicitly (not through a role). The statements in the trigger body operate under the privilege domain of the trigger owner, not the privilege domain of the user issuing the triggering statement (this is similar to the privilege model for stored subprograms).
    I have to grant only create any trigger to user.
    Problem solved.
    Thanks to all for ur help.
    Regards,
    Andy.

  • How to raise the event without creating Triggers

    Hi Gurus,
    here is my requirement.
    Whenever user issue the material from inventory ( on hand quantity reduced ), we have to generate a data file which contains item number, sub inventory and quantity info. for this we have created a utl file package. But here my issue is, without creating triggers / Alerts , i have to run the utl package.
    Please advice me how to do this / is there any middle ware tools available to run the package / concurrent prohram.
    We are using R12.
    Regards,
    Sreehari.

    Oracle provides various business events for material issue/transactions from inventory (For e.g.,oracle.apps.inv.miscIssue, oracle.apps.inv.subinvTransfer, oracle.apps.wip.job.material.transact, etc.).
    First check what kind of transactions happen when the On-hand is consumed. Then Go to any Workflow Admin responsibility >> Business Events: Events >> Search for the event you are looking for >>Hit Update >> Enable the event >> Navigate to Subscription and associate your PLSQL pacakge. let me know if it helps.

  • How to create a new TRANSPORT PACKAGE in BI 7.0

    Two issues
    1) How to check avaliable TRANSPORT PACKAGES in BI 7.0 and
    2) How (steps) to create a new TRANSPORT PACKAGE,So that i can assign all the transport request to that package.
    Thanks

    Hi,
    Steps for creating TRANSPORT PACKAGE
    Go to SE80 and in the obj edit mode select Select DEVELOPMENT COORDINATION tab where u can giv ur PACKAGE NAME and create the package
    Select your Software Component ,Transport Layer
    Package Type = NOT A MAIN PACKAGE and create a request
    and save it.
    Assign points if useful..
    Regards,
    NR
    Edited by: N R Pradeep Reddy on Apr 10, 2008 11:29 AM

  • Workflow event bus1022-created triggered twice with ME21Nu200F

    Hi everybody
    The explanation to my problem is as follow: Initially I was using the Tcode AS01, ME21N, ABUMN to create fixed assets and every asset created triggers the event BUS1022-CREATED, but then I set the system to synchronizing assets with equipments (SPRO -> Financial accounting->Assets accounting->Master Data->Automatic creation of equipment master recordsu2026u2026) but the event BUS1022-CREATED didn´t triggered any more so I create the new entry in SWEC with ANLA as objet of modification and the OBJ BUS1022 and the event CREATED for the creation for any new record; It works but now the problem is that this event  is being created twice with the Tcode ME21N.
    Any suggestion?
    Thanks a lot.
    Felipe Uribe

    Hello Felipe,
    a check on the TCode during the event coupling seems to be the most effective way here. However, only checking on sy-tcode will not help you much, as you don't know the source (change document / application event).
    So what you need to round up your work-around is a flag in the event container that tells you, if the event was created through the SWEC, and if yes, by which transaction code.
    - To do so, create a subtype of BUS1022 with a system wide delegation.
    - Create two new additional event parameters: TransactionCode  (type syst-tcode) and ByChangeDocument  (type boole-boole)
    - Create a function module Z_SWEC_CONTAINER_BUS1022 copied from SWE_CD_TEMPLATE_CONTAINER_FB (or SWE_CD_TEMPLATE_CONTAINER_FB_2 depending on your ABAP OO experiences) and enter this function module under "Event container" in the maintenance entry of SWEC/BUS1022/CREATED
    - Within that event container function module, you just set the two event container elements using the value of SY-TCODE for the field TransactionCode and a fixed 'X' for the value of the field ByChangeDocument
    - Create a new check function module (or workflow start condition) -- as described earlier in this thread -- that checks on:
    ( ByChangeDocument = 'X' AND TransactionCode = 'ME21N' ) OR ( ByChangeDocument = ' ' ).
    This way you'll sort out the doubled events through the change document for all other transactions than ME21N.
    Good luck,
    Florin

  • PDF created using Java iText package - Text not editable and not displaying font properties on Acrobat

    Hi,
    I have an issue in editing the text and viewing the font properties of a text region on a PDF created using Java iText package.
    I use Adobe Acrobat 9 Pro Extended and the option Tools -> Advanced Editing -> TouchUp Text Tool.
    The strange behaviour is that, I have 2 PDFs created out of the same base PDF and text added via Java iText package with the same Text, Font and other properties.
    One of the PDF has the text region editable on Acrobat but the other one has the text region which is not editable.
    But both the PDFs are editable via Adobe Illustrator.
    I have attached both the PDFs for your reference
    PDF_Editable.pdf - Editable on Acrobat
    PDF_Not Editable.pdf - Not Editable on Acrobat
    Any help or insight to find out the difference/issue with the PDF which is not editable via Acrobat would be appreciated.
    Thanks in advance.
    Regards,
    Madhusoodhan Henryraman

    You don't have direct control of the leading of a multiline text field. A common approach is to control the background color of the field with JavaScript since the lines are not really needed when the field is used in Reader/Acrobat. They may be useful when using the form by hand. For more information, see the posts by Max in this topic: http://acrobatusers.com/forum/forms-acrobat/how-do-i-use-multi-lined-text-fields-over-prin ted-line-area-existing-form

  • Can't create a silent install package for Captivate 7 with AAMEE

    I'm trying to create a silent install package for Captivate 7. It doesn't appear that this works with AAMEE. Has anyone been able to do this? If it won't be possible with AAMEE, is there a way to do it with cmd line switches?

    Hi,
    You would need to use Adobe Creative Cloud Packager to create a deployment package and deploy Captivate 7 as AAMEE does not supports Captivate 7.
    Please refer the documentation available at - http://helpx.adobe.com/creative-cloud/packager.html
    Hope this helps.
    Regards,
    Sharad
    P.S - Creative Cloud Packager would be deployed under your Adobe LWS account. In case you do not have it available in LWS, then please P.M me your email address and I will get that processed.
    Regards,
    Sharad

  • How to create an installation setup package for a java project?

    hi,
    i have a small project written in java. i used eclipse ide. i am trying to create an installation setup package for my application. can some one help me?
    thanks.

    hi daven,
    iam not using the websphere application developer.
    iam using eclipse release 3.2
    is there a solution?

  • Create triggers?

    Does Oracle TimesTen support creating triggers?

    No, not currently. What TimesTen does have is a high performance post-commit event notification API called XLA. Check it out in the documentation; it might meet your requirements.
    Chris

  • The ideal knowledge of creating triggers in form

    its very easy to design a form but the matters is creating triggers so since i am a beginner i need ur guidance how to create triggers in form

    Hi,
    There are 3 types of triggers Form Level, Block Level and Item level triggers.
    First you have to decide which level you are going to create a trigger.
    Suppose you need to create Item level trigger, for a push button there is a trigger called When-Button-Presed. Like wise for each item,block and form has specific/general triggers for each event.
    you should check forms documentation or fellow online help/examples
    http://www.oracle.com/webapps/online-help/forms/10g/state?navSetId=_&navId=3&vtTopicFile=designing_forms/trig/dg0701.html&vtTopicId=
    Nilaksha.

  • How to create installation scripts in packaged application

    can u tel me How to create installation scripts for packaged application.
    also tell me , i have to first install scripts and then supporting objects or
    supporting objects first then installation scripts..

    Hi,
    Depending upon your usecase there are different ways to implement this logic.
    Check this for example (Read my answer in this post):
    https://forums.sdn.sap.com/thread.jspa?threadID=349151
    Also check these senarios:
    http://help.sap.com/saphelp_nw70/helpdata/en/42/9ddf20bb211d72e10000000a1553f6/frameset.htm
    http://help.sap.com/saphelp_nw70/helpdata/en/42/9ddcc9bb211d72e10000000a1553f6/frameset.htm
    Also the delegation may be interesting for you:
    http://help.sap.com/saphelp_nw70/helpdata/en/a0/44b742cafec96ae10000000a155106/frameset.htm
    Greetings,
    Praveen Gudapati

  • Cannot create class in system package

    Hello,
    I wrote a J2ME game for nokia S40 phones. It compiles without any errors, but when I'm trying to run in on the Nokia 7210 phone emulator I receive the following message:
    Cannot create class in system package.
    Howerver running on the Nokia 6230 phone emulator is ok.
    I have obfuscated my applet as I read in previous topics, but still it does not work.
    Can anyone help me?
    Thanks,
    Alexander.

    You get that error when you try to reference a class that is part of the MIDP framework but isn't installed on the phone.
    The 7210 doesn't support MMAPI or WMA or MIDP 2.0, while the 6230 does, so check that you don't have any references (even an import statement), to classes from those packages (like the javax.microedition.media.*, javax.microedition.lcdui.game.*,javax.wireless.messaging.*, etc. packages hierarchies).
    shmoove

  • Cannot create class in system package while Using Sprite class

    Hi i developed a game using Sprite class & imported
    javax.microedition.lcdui.game.*; package. But when i tried to build this project it gave me "Cannot create class in system package" error. Worst thing is that now again if i build, then it displays error "package javax.microedition.lcdui.game.*; does not exist" . Pls help me

    First exception means that you tried to create a class with the package name equaling one from the predefined libraries in midp/cldc.
    For your second error, add all the jars you are using into the project's classpath.
    Mihai

  • Is it supported by Adobe to create an App-V package from Acrobat 12?

    I know there are many recipes in the web to create an App-V package from Acrobat 10 or 11, but is this officially supported by Adobe?
    I found this for Acrobat 11: App-V Deployment — Enterprise Administration Guide
    It´s stated explicitly there that Acrobat is not supported, only the Reader.
    Regards
    tuxhater

    Creating an APP is a very in-depth process. And getting the few people to be able to share it, can be difficult.
    You probably would do better with an interactive PDF. Your main concern would be finding a PDF reader for iPads and tablets that will play all your buttons. But that's not really a problem.
    If I can be so bold, you might want to look at my book, Digital Publishing with Adobe InDesign CS6. (Don't let the CS6 throw you, for your needs, everything is the same.)

  • Triggers inside a package

    How do I use triggers within a package?

    You don't. Triggers are pieces of code that we attach to database objects that contain events (tables, views) or events (logon, execute ddl). Of course, a trigger can execute stored procedures.
    As I type this answer it occurs to me that you might be wanting to attach a trigger in order to do something every time a pacakage is excuted. If that is the case, then tell us what that something is and we may be able to ssuggest a workaround.
    Cheers, APC

Maybe you are looking for

  • Windows 7 Install questions, warnings?

    Bought Windows 7 Home Premium (Full) cost ~$260 Cad to replace free Windows 7 Ultimate RC 7100 Build. This was necessary because the RC was not recieving critical updates. After install of 32 & 64 Bit OSs, pleased to see update Windows 6.1-KB978207-x

  • Need help in fetching requested data from JSP

    Hello, I really need help in fecthing requested data from JSP to servlet. Can anyone assist me as soon as possible because I must finish my program by today.....( 20/02/2002). Thanks in advance.

  • Question re: 3D object rotation in Photoshop CS5.5

    So I've searched the forums and the web and I can't find a solution to my problem. I created a simple shape in Photoshop I then edited the shape using the Repoussé dialog. I simply extruded the object. The defualt extrusion depth setting of 1.0 was f

  • Runtime Error. R6025 - pure virtual function call. What is that?!

    Hi, would like to know what is wrong with my ipod. Since abt 3 wks ago, my ipod is functioning very slow upon connection to the computer for charging. The iTune is always lagging with it was charging too. But last week, it got worse. My computer does

  • Slim Wireless Keyboard Not Working (Boot-Camp (Windows XP SP2) Leopard

    I installed Boot Camp with Windows XP SP2 on my iMac. My new slim apple wireless keyboard did not after I rebooted to finish the install. It worked when I was installing it though. My wireless mighty mouse works fine with xp.I have given my keyboard