473,397 Members | 2,077 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

How to call store procedure from DB trigger in oracle 10g?

Hello Everyone

I want to call store procedure from DataBase Trigger
how to call it.
i tried as following but it give me error.

For example This is my Procedure
----------------------------------
Expand|Select|Wrap|Line Numbers
  1. CREATE OR REPLACE PROCEDURE P1
  2.  IS
  3.  CURSOR C1 IS SELECT EMPNO,ENAME FROM EMP;
  4.  V_EMPNO NUMBER;
  5.  V_ENAME VARCHAR2(20);
  6.  BEGIN
  7.  OPEN C1;
  8.  LOOP
  9.  FETCH C1 INTO V_EMPNO,V_ENAME;
  10.  EXIT WHEN C1%NOTFOUND;
  11.  DBMS_OUTPUT.PUT_LINE(V_EMPNO||' '||V_ENAME);
  12.  END LOOP;
  13.  END;
/
Now I want to Execute the above procedure from Database Trigger,
when the INSERT,UPDATE or DELETE occure to the table
the above procedure should automitclly EXECUTE.

This is my trigger

Expand|Select|Wrap|Line Numbers
  1. CREATE OR REPLACE TRIGGER EMP_TRIG
  2. AFTER INSERT OR UPDATE OR DELETE ON EMP
  3. FOR EACH ROW
  4. BEGIN
  5. CALL P1();
  6. END;
/

it give me the following Error.

LINE/COL ERROR
-------- ------------------------------------------------
2/6 PLS-00103: Encountered the symbol "P1" when expecting one of the
following:
:= . ( @ % ;
The symbol ":=" was substituted for "P1" to continue.


--------------------------------------------------------
Thanks in Advance.
looking forword.
Jun 7 '11 #1
2 2988
debasisdas
8,127 Expert 4TB
try this.
Expand|Select|Wrap|Line Numbers
  1.     CREATE OR REPLACE TRIGGER EMP_TRIG
  2.     AFTER INSERT OR UPDATE OR DELETE ON EMP
  3.     FOR EACH ROW
  4.     BEGIN
  5.     CALL P1;
  6.     END;
  7.  
Jun 9 '11 #2
Hello Dear
I try the above method but its again give the following error
---------------------------------------
SQL> show error;
Errors for TRIGGER EMP_TRIG:

LINE/COL ERROR
-------- -----------------------------------------------------------------
2/13 PLS-00103: Encountered the symbol "P1" when expecting one of the
following:
:= . ( @ % ; immediate
The symbol ":=" was substituted for "P1" to continue.
------------------
please help me
thanks in advance.
Jun 13 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: ofer | last post by:
My oracle is crash and i still have the dbf file what could i do? the data in the dbf is not necessary - could i just look at the file and copy the store procedure. could you recommecnd on free...
2
by: Jin | last post by:
Hello: I run one process that calls the following the store procedure and works fine. create PROCEDURE sp_GetHostSequenceNum AS BEGIN SELECT int_parameter_dbf + 1
3
by: Hrcko | last post by:
How to use store procedure to store data? I have a User Name and would like to change it's password. Hrcko
0
by: Diffident | last post by:
Hello Guys, How can I call a SYSTEM stored procedure in ORACLE from my DAL component? I am trying to call in the same way as I would call a normal stored procedure but it is throwing me an error...
8
by: gacuna | last post by:
i want to insert into a temporal table the result of a store procedure. on sql server the sentence would look like this (already working) INSERT INTO #SHIPINFO exec TESTDTA.S59RSH05 @SCBILLTO,...
0
by: rxding | last post by:
Hello, Performance reason we need to move some of our code into database. Java Store Procedure is given the first choice. However, while investigating some sample code of Java store procedure, ...
11
by: c676228 | last post by:
Hi everyone, I am just wodering in asp program, if there is anybody writing store procedure for inserting data into database since there are so many parameters need to be passed into store...
0
by: mktilu | last post by:
hi can any one tell me how to call a stored procedure from oracle where the stored procedure return one paramter as string
1
by: Fabio | last post by:
Hi, is there any method to call a store procedure into a function? Thanks Fabio
2
by: E11esar | last post by:
Hello there. I am going in bit of a circle with this matter; First some background: I am trying to upload the details of a CSV file into an Oracle table. I am using a StreamReader to copy a line...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.