Ques on "CALL" in a Database Trigger

Sir ,
I am invoking one package procedure in one row level trigger on Oracle Database 10g Enterprise Edition Release 10.1.0.4.0 - 64bi , PL/SQL Release 10.1.0.4.0 – Production, CORE 10.1.0.4.0 Production,TNS for Solaris: Version 10.1.0.4.0 – Production, NLSRTL Version 10.1.0.4.0 – Production.
The part of the code is attached below. This code gives compilation error but if I delete the word “CALL” from invoking the package procedure, trigger is created. My question when do I use “CALL” to call a procedure in a trigger.
Regards,
Student
CREATE OR REPLACE TRIGGER AIR_REQST
AFTER INSERT ON INFO_REQS
FOR EACH ROW
DECLARE
v_r_id requests.l_id%TYPE;
v_lang_code language_lkups.Lang_Code%TYPE;
BEGIN
SELECT Lang_Code
INTO v_lang_code
FROM language_lkups
WHERE lang_id = :NEW.language_id ;
CALL cg$_appl_pkg.process_reqst
('M5001' ,
v_lang_code ,
'INFO_REQS ' ,
:NEW.infr_id ,
v_lmreq_id -- This is OUT parameter in the procedure
END;

Well, you please let me quote from "Oracle 9i Application Developer’s Guide - Fundamentals Release2(9.2) March 2002 Part No. A96590-01"
Page No. 15-13
The trigger body is a CALL procedure or a PL/SQL block that can include SQL and PL/SQL statements. The CALL procedure can be either a PL/SQL or a Java procedure that is encapsulated in a PL/SQL wrapper. These statements are run if the triggering statement is entered and if the trigger restriction (if included) evaluates to TRUE.
Page No. 15-15
CREATE OR REPLACE PROCEDURE foo (c VARCHAR2) AS
BEGIN
INSERT INTO Audit_table (user_at) VALUES(c);
END;
CREATE OR REPLACE TRIGGER logontrig AFTER LOGON ON DATABASE
-- Just call an existing procedure. The ORA_LOGIN_USER is a function
-- that returns information about the event that fired the trigger.
CALL foo (ora_login_user)
Page No. 15-51
CALL Syntax
CREATE OR REPLACE TRIGGER Secdemo.Setexpseetx
AFTER LOGON ON DATABASE
CALL Secdemo.Exprep_etx.Set_otx
So from Page No. 15-13 , we can easily come to a conclusion that CALL procedure or a PL/SQL block that can include SQL and PL/SQL statements. Right ?

Similar Messages

  • Handle/call Database trigger from bean(programatically) in ADF

    Hi All,
    I want to call/invoke a database trigger (from bean) programatically. I am using adf(11.1.1.5).
    Help needed.
    Thanks,
    NJ
    Edited by: 892586 on 20 Oct, 2011 11:28 PM

    Hi,
    Check followings will helpful
    Re: Need to call DB func on create in ADF BC
    http://download.oracle.com/docs/cd/E16162_01/web.1112/e16182/bcrules.htm#sthref308

  • Re: send message from the database trigger(URGENT)

    Hi,
    I am using forms 6.0 and oracle 8.0. My question is I am calling a stored procedure in the BEFORE UPDATE TRIGGER on database. This trigger will be fired and update another table(table B) when user update any record in the forms based on different table (table A).
    I want to pass the message to the forms from the database trigger when records gets updated in the database e.g. (10 records are updated). Since I am not calling my database procedure from the forms, rather it is being called from the database trigger, How can i display message to the forms.
    Thanks all your help in advance.

    Thanks Parker for ur reply but that subprogram raise_application_error only works if there is an error in the store procedure. But in my case there is no error, I just need to pass a message saying that e.g. "12 rows updated". How can I pass this message from the database trigger to the forms application.
    Thanks

  • Calling form .fmx or report .rep from database trigger. (URGENT PL.)

    can we call an form (.fmx) or a report (.rep) from a database trigger. that is when there is some insertion in the table i want to call a report which will take the parameters from the table changed.
    regards
    vishal

    JDeveloper and ADF

  • Need to call an application with in  Database trigger

    Dear all
    I have created a database trigger that reads the new values inserted on my table and append the record on a text file on the operationg system.
    I have a software that convert this text file to binary file.
    I can call this software using a command prompt
    I need to issue this command prompt from within the database trigger
    I need to Know is there a package or plsql code that can call an application.
    We can do this easly on the form builder using the comman HOST
    But I need to issue this command from within SQL PLUS
    is there a way
    please help
    thanks in advance

    another simple way is to write a C program with an exec function that calls the external program.
    The C function can be called by the Oracle server as an extproc (like a PL/SQL funtion call).
    Check for the extproc Oracle documentation:
    http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b15658/ldr_demo.htm
    Sample programs you will find in your $ORACLE_HOME/plsql/demo directory.
    Kind regards
    Karsten

  • How to get SSO logged user information in a database trigger

    my database is 9i
    my application server is 9i too
    I need to track which SSO user is inserting data into a table , so how can i get the information of that user in a database trigger on that table
    thanks

    Hi,
    The only way I could figure out how to get it was to import the com.sap.security.api.
    1. From Window>Preferences>Java-->Classpath Variables, set up a variable called WEBAS_HOME pointing to:
    <drive>/usr/sap/<SID>/jc00/j2ee/cluster/server0/
    2. Right click on properties of your Dynpro Project->Properties->Java Build Path->Libraries and click "Add Variable." 
    3. Select WEBAS_HOME and click "Extend"
    4. Select /bin/ext/com.sap.api.sda/com.sap.security.api.jar and click OK.
    If you don't have access to a portal directory, you will have to get this jar file and copy it to your workspace to add to your build path instead of the above steps.
    Then in your code:
    import com.sap.security.api.IUser;
    import com.sap.security.api.IUserAccount;
      public void GetLogonID( )
         String LogonID;
         try {
              /*     create an user object from the current user */
              IWDClientUser wdUser = WDClientUser.getCurrentUser();
              IUser user = wdUser.getSAPUser();
              if (user != null) {
                   IUserAccount acct = user.getUserAccounts()[0];
                   if (acct != null) {
                        LogonID = acct.getLogonUid();
                   } else
                        LogonID = "acct null";
              } else {
                   LogonID = "user null";
              wdContext.currentContextElement().setDisplayName(user.getFirstName() + " " + user.getLastName());
              wdContext.currentContextElement().setLogonID(LogonID.toUpperCase());
         } catch (Exception e) {
              e.printStackTrace();
    Hope this helps...  I had to search several places before I found all the necessary stuff.  Maybe I can get my first points!
    Thanks,
    Andrew

  • How can I create a pdf-report in a database trigger

    Hi,
    how can I create a pdf-file with Reports 9i in a database trigger ?
    Where can I find informations about it?
    Thanks
    Friedhold

    Here would be the place to start.
    If you have existing reports to call, take a look at the JRC

  • STORED PROCEDURE & DATABASE TRIGGER

    제품 : FORMS
    작성날짜 : 1995-11-07
    * STORED PROCEDURE
    1. Oracle Forms 4.5에서는 PL/SQL Code를 Server-Side에 저장하거나 Forms 내 Trigger, Procedure로 갖을 수도 있다.
    다음과 같은 경우 Procedure를 Database Server에 저장하는 방법을 선택하는
    것이 좋다.
    - Procedure가 Standard한 기능을 제공하여 다른 Tool이 공유할 수 있을 때.
    - Procedure가 중요한 DML 기능을 가질 경우.
    - Oracle Forms 4.5에서는 PL/SQL의 Version을 1.1까지 지원하므로, PL/SQL
    Version 2.X 의 기능이 필요한 경우.
    2. Stored Procedure의 제한사항
    (1) Server가 7.0 이상이어야 한다.
    (2) Pass되는 Variable은 2000 Byte이하이어야 한다.
    - 2000이 넘으면 Truncate가 되고, PL/SQL에서 Value_Error Exception이
    발생한다.
    (3) Menu PL/SQL에서는 Stored Procedure와 Function을 부를 수 없다.
    (4) Stored Subprogram의 정의가 바뀐 경우, Forms를 다시 Server와 Connect
    하기 전에는 영향을 주지 않는다.
    3. Oracle 7 Server 에서 제공하는 Standard Package들
    - dbms_alert
    - dbms_ddl
    - dbms_describe
    - dbms_lock
    - dbms_mail
    - dbms_output
    - dbms_pipe
    - dbms_session
    - dbms_snapshot
    - dbms_standard
    - dbms_transaction
    - dbms_utility
    < Oracle7 Developers Guide 참조>
    4. Calling Stored Procedures
    (1) Database Procedure는 Server-Side PL/SQL Engine에 의해 실행되도록
    Design된 PL/SQL Block이다.
    (2) Stored Procedure를 Call하기 위해서는 EXECUTE Privilege가 필요하다.
    (3) Server-Side Procedure와 Forms에서의 PL/SQL의 중요한 차이점은
    Server-Side 에서는 Forms의 Bind Variable (:Block_Name.Item_Name 등)
    을 인식하지 못한다는 것이다.
    (4) Parameter/Return이 가능한 Data Type
    - VARCHAR2 : Maximum of Varchar2(2000)
    - NUMBER
    - DATE
    - BOOLEAN
    제한사항
    - TABLE%ROWTYPE, TABLE.COLUMN%ROWTYPE으로 정의된 것은 Reference가
    안된다.
    - Unsupported Parameter나 Return Value를 사용하면 다음의 Error가
    발생한다.
    * PL/SQL error 313 at line xxx, column yyy 'PROCNAME'
    not declared in this scope.
    * PL/SQL error 201 at line xxx, column yyy identifier 'FUNCTNAME'
    must be declared.
    (5) Formal Parameter의 Default Value
    - Defulat Value는 제공하지 않는다.
    - User가 임의로 줄 수 있다.
    - Procedure Private_Test(a in VARCHAR2 := 'Hello' b in
    VARCHAR2 := 'There') IS
    BEGIN
    Dbms_Output.Put_Line(a);
    Dbms_Output.Put_Line(b);
    END;
    (6) 다른 User의 Stored Subprogram이나 Remote Database를 Call하려면
    - User Name이나 Database Link명을 숨기기 위하여 Synonym을 생성하여야
    한다.
    - CREATE SYNONYM lib_hr_syn FOR libowner.lib_hr;
    - Program에서 Call할 때에는 ss_num ;= lib_hr_syn.get_ssn(:EMP.EMPNO);
    5. PL/SQL Compiler가 해당 Procedure를 찾는 순서
    (1) Current PL/SQL Block 내에 정의되어 있는가?
    (2) Standard PL/SQL Command인가?
    (3) Oracle Forms 내의 Built-in Procedure 혹은 Function인가?
    (4) User_Named Procedure 혹은 Function인가?
    (5) Server-side에 정의된 DBMS_STANDARD Package인가?
    (6) Current user가 Server-Side의 어떤 Procedure나 Function을 Access
    하는가?
    * 이상의 질문에 대하여 전부 'NO'라는 대답이 나오면 Compiler는 다음과 같은
    Error Message를 준다.
    - PL/SQL error 313 at line xxx, column yyy 'PROCNAME' not declared in
    this scope.
    - PL/SQL error 201 at line xxx, column yyy identifier 'FUNCTNAME'
    must be declared.
    * DATABASE TRIGGER
    1. Database Trigger는 Forms에서의 Trigger와 개념적으로 거의 동일하다.
    차이점은 Trigger가 Fire되는 원인을 제공하는 사건과 후속코드가 실행되는
    장소가 틀린 것이다.
    2. Database Trigger는 Table과 연관된 PL/SQL Block들이다. Table에 대한
    UPDATE, INSERT, DELETE 등의 행위에 의해 Fire된다.
    3. Error 발생 시에는 RAISE_APPLICATION_ERROR Built-In Procedure를 사용하
    여 Error를 표시한다.
    RAISE_APPLICATION_ERROR Procedure에서는 Error Number가 20000 - 20999의
    Range를 가진다.
    4. Creating & Editing Database Triggers
    아래와 같은 적절한 권한이 주어진다면 Forms Designer Mode에서 Database
    Trigger를 직접 Create, Edit, Compile, Browse 할 수 있다.
    - Execute Privilege, Create Privilege, Compile Privilege,
    Drop Privilege
    * Create하려면
    - Navigator에서 Database Objects와 Table Nodes를 Expand한다.
    - 원하는 Table을 선택하고 Expand한다.
    - Triggers Nodes를 선택하고 Menu Bar의 Navigator*Create를 선택한다.
    - Database Trigger Editor에서 작성, compile한다.
    * Edit 하려면
    - Navigator에서 Database Objects와 Table Nodes를 Expand한다.
    - 원하는 Table을 선택하고 Expand한다.
    - 원하는 Trigger에서 Double-Click하면 Editor가 나타난다.
    - Database Trigger Editor에서 변경, compile한다.

    not possible via forms
    you can debug it on SQL Developer by using manual INSERT Updates commands

  • Oracle form based on a view - need to return a value after database trigger

    We have a form based on a view calling database trigger to insert data.
    I need to display a message of the record ID inserted on the form.
    The values to be displayed are ID field.

    Hi,
    if you use process of Automatic Row Processing (DML), you have an option *"Return Key Into Item"*.
    This will return your primary key into item, and then you can display this item as a result.
    Regards,
    Aljaz

  • Database trigger causes error in Form

    I have a database trigger on the per_performance_reviews table. When I try to save a performance review record from the forms I get the following error:
    FRM-40403: A calling form has unapplied changes. Save not allowed.
    Any suggestions???
    Here is my trigger:
    CREATE OR REPLACE TRIGGER APPS.XXPER_UPDATE_PERF_REVIEW
    BEFORE INSERT ON HR.PER_PERFORMANCE_REVIEWS
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    DECLARE
    l_hire_date DATE;
    l_next_review_Date DATE;
    l_event_type VARCHAR2(40);
    BEGIN
    select papf.START_DATE, pe.type
    into l_hire_date, l_event_type
    from per_all_people_f papf, per_performance_reviews ppr, per_events pe
    where ppr.performance_review_id = :NEW.performance_review_id
    and papf.person_id = ppr.person_id
    and pe.event_id = ppr.event_id
    and sysdate between papf.effective_start_date and papf.effective_end_date;
    l_next_review_date := l_hire_date + (365 * 2);
    IF l_event_type = 'APPRAISAL' THEN
    :NEW.NEXT_PERF_REVIEW_DATE := l_next_review_date;
    END IF;
    END XXPER_UPDATE_PERF_REVIEW;

    There is a forms forum here too.
    However this error message
    FRM-40403: A calling form has unapplied changes. Save not allowed.
    implies that you opend your current form without posting/commiting in the previous form. This is not allowed. Your changes never even touched the database.

  • Passing variables to a procedure inside a database trigger

    Hi,   I am new to oracle Forms . I am having a table in database . For that table i had written a database trigger which will fire after insert or update . I am using a procedure inside the Trigger . I want to pass arguments to the procedure which is being called in the trigger . The variables which i want to pass to the procedure are one is a primary key and the other is a normal cloumn which are in the same table for which the trigger is written. Can anybody help me regarding this.?

    > But when i m calling it with forms i m getting an error
    You cannot call a database trigger from forms. A trigger is part of the table, e.g.:
    create trigger my_trigger
    before insert or update or delete on my_table
    for each row

  • DATABASE Trigger not Working

    Dear All,
    I wrote the DataBase Trigger which gets compile but not execute and if i execute the procedure manually then it works.
    CREATE OR REPLACE TRIGGER ficreports.trg_omni
    AFTER STARTUP ON DATABASE
    DECLARE
    PRAGMA AUTONOMOUS_TRANSACTION;
    BEGIN
    Temp_Reporting_Datasync;
    commit;
    END;
    Kindly give your valuable suggestions to start executing the trigger after starting the database.
    Regards,
    Anand

    Yes , if it is fired then it will perform the DML operation on the tables which is mentioned inside the procedure..
    Is there any possiblibility of not firing the trigger or the way of calling procedure is not correct ?
    Kindly confirm.

  • How to send error message to forms from Database Trigger

    Hi, Please help me to send error message to forms from Database Trigger?
    RgDs,
    Madesh.R.M

    You are correct, the On-Error trigger is a Forms trigger. However, if your Form is going to display the error generated by the database stored procedure or trigger - you might not see the database error in your Form unless you check the DBMS_ERROR_CODE in the On-Error trigger and manually display the Error Code and associated Text. I've see this happen with a co-worker. The Form she was working on was based on a table with an Before-Insert trigger. Because she was not explicitely handling the error from the Before-Insert trigger in the Forms On-Error trigger, her Form appeared to halt for no reason at all. Once she added code to the On-Error trigger in the Form to handle the DBMS_ERROR_CODE, she discovered the trigger was producing an error and was able to show the error to the user in the On-Error trigger.
    I understand the desire to keep as much as possbile in the database, but with that comes some extra coding in your Forms to handle this. This extra coding could easily be placed in a Forms Library, attached to a Form and called in the On-Error trigger. Your code could look like this:
    DECLARE
       /*This example assumes you have an Alert defined
          in your Form called: 'ERROR' */  
       al_id    ALERT;
       al_text  VARCHAR2(200);  /* Max text of a Forms Alert message*/
       al_btn   NUMBER;
    BEGIN
    IF DBMS_ERROR_CODE != 0 THEN
       /* Error code is ORA-00000 Normal Successful completion
           So only handle non-zero errors  */
       al_text := DBMS_ERROR_CODE||':'||DBMS_ERROR_TEXT;
       al_id := Find_Alert('ERROR');
       set_alert_property(al_id, alert_message_text, al_text);
       al_btn := show_alert(al_id);
    END IF;
    END;Your original question was "How to send error message to forms from Database Trigger?" The answer is you don't because Forms already gets the database error code and database message through the Forms DBMS_ERROR_CODE and DBMS_ERROR_TEXT functions. Look these up in the Forms help and it should clear things up for you.
    Craig...
    Edited by: CraigB on Jun 14, 2010 4:49 PM
    Edited by: CraigB on Jun 14, 2010 4:49 PM
    Edited by: CraigB on Jun 14, 2010 4:50 PM
    Edited by: CraigB on Jun 14, 2010 4:51 PM
    Edited by: CraigB on Jun 14, 2010 4:51 PM

  • Can I execute a mapping from a database trigger ????

    Can anyone tell me if I can execute a mapping from a database trigger ? How ???
    Thanks in advance.----
    JEMD

    Hello,
    We are using the approach of scheduling predefined job heavily in our projects. It works fine.
    There are several points to mention:
    - scheduling / rescheduling algorithm must not lead to simultaneous session of the mapping run. Depending of content of the mappings/PF this could bring the real pain.
    - If there are several user sessions intensively interacting the table on which the scheduling trigger is created, scheduling / rescheduling algorithm must be written with care – users could lock or wait each other while updating job record.
    - Depending on intensity of such mapping runs additional care must be taken of OWB audit trail which will tend to grow.
    Depending on requirements trigger could call ordinal procedure for scheduling (if mapping run must be performed only if user commit change to the table), or procedure with autonomous_transaction pragma (if any touch of the table should fire the execution – don’t think this is a case)
    Sergey

  • Start Workflow from the After startup database trigger

    Hallo,
    I try to startup a workflow process from a database trigger :
    the after startup database trigger. But when I do this, he
    doesn't startup. When I add a commit-statement after the call
    to startup the workflow, my database never gets open.
    What do I have to do ? And what command is used ?
    Thanks a lot.
    Filip Huysmans.

    See the Posting: Starting Workflows From a Database Trigger
    Hallo,
    I try to startup a workflow process from a database trigger :
    the after startup database trigger. But when I do this, he
    doesn't startup. When I add a commit-statement after the call
    to startup the workflow, my database never gets open.
    What do I have to do ? And what command is used ?
    Thanks a lot.
    Filip Huysmans.

Maybe you are looking for

  • Search for multiple items in one text field

    Hi all, I am new to ApEx, I have a request from one of our users to ask if there is a way we can allow them to enter more than one search items delimited by a comma. For instance, we have a text item field for user to enter some values as emp names,

  • DrawImage takes long time for images created with Photoshop

    Hello, I created a simple program to resize images using the drawImage method and it works very well for images except images which have either been created or modified with Photoshop 8. The main block of my code is public static BufferedImage scale(

  • I have downloaded Adobe Muse to CC, but are unable to open. Why?

    I have downloaded Adobe Muse to CC, but are unable to open. Why?

  • Dreamweaver crashing at startup

    OK...out of the blue Dreamweaver stops loading. I see the startup screen, begins to load the site cache and then disappears. I've tried reinstalling, deleting the user config file...but nothing seems to make it work. Very frustrating when you are on

  • Jdeveloper 9031 deploy to remote dcm

    Hi, We've been playing with the JDeveloper 9031 to deploy applications to remote dcm (Oracle9iAS 903). It seems (from experimentation and documentation) that the ias_admin user & password is needed for that function. Many developers are going to conn