Need a procedure,trigger,function
hello,
i am having an vijay.sql file.In this vijay.sql file i have some delete and insert statement. I want to execute this vijay.sql file per very hour,daily that to automatically.Is there any trigger,procedure or function to execute .sql file .please send me an example.
advance thank's
vijay
hello ,
thanks for ur reply.
my sql file is in way.
delete from vid_lookup;
/* ----------------LABEL= BR-------------------*/
insert into vid_lookup(type,value) select distinct bezeichnung ,wert
from pudis.sd_labels l,pudis.messwerte m
where l.bezeichnung='BR' and l.sdlab_id=m.sdlab_sdlab_id;
Then how can i use dbms_job.
please give me stored procdure and how to execute dbms_job
function.
its very urgent.
advance thanks
vijay
Similar Messages
-
Need (procedure or function or sql query )for Email filter
Hi All,
in (procedure or function or sql query ) ,if i pass the a input parameter like (anbu@y or anbu@ or anbu@yahjjj ) ,i need to get output like [email protected] .
please give me code for this ...SQL> with t
2 as
3 (
4 select 'anbu@y' email from dual union all
5 select 'anbu@' from dual union all
6 select 'anbu@yahjjj' from dual
7 )
8 select email, regexp_replace(email, '@.*','@yahoo.com') email_new
9 from t
10 /
EMAIL
EMAIL_NEW
anbu@y
[email protected]
anbu@
[email protected]
anbu@yahjjj
[email protected] -
ORA-04091: table name is mutating, trigger/function may not see it
Hi,
I have a row level before update trigger written on a table A which calls a procedure to undergo some processing. Procedure has some select queries against table A and it inturn causes the following error.
ORA-04091: table name is mutating, trigger/function may not see it
To overcome this I have used a combination of PL/SQL collection types (nested tables based on the following definition TYPE t_table_a is table of A.colname%TYPE index by binary_integer;), a row level before update trigger and statement level after update trigger. The mutating problem is fixed, but to update one row of data it took around 3 min and I am wondering if its the problem with PL/SQL tables I have used.
In before update trigger I am storing the unique id's which needs to be updated into the PL/SQL table and in the after update trigger I am looping through the PL/SQL table and peforming the rest of the processing by calling in the procedure.
Can anyone help how to minimize the run time of this process or if any other better solution exists?
Thanks for the helpTriggers raise the mutating table issue, because else they could be used to create endless loops. If you work around the mutating table issue, then you should make sure not to create an endless loop yourself. This would be possible.
You description also seems to imply something like this.
Without code it is impossible to say something specific.
- Do you initialize your collection in a before statement trigger?
- Is your looping mechanism somehow broken?
- Do you update the same table again and again and again? -
ORA-04091: table blah is mutating, trigger/function may not see it
ORA-04091: table blah is mutating, trigger/function may not see it
ORA-06512: at "AOLALERE.CHK_FOR_POST", line 7
ORA-06512: at "AOLALERE.CHK_FOR_POST", line 20
ORA-06512: at "AOLALERE.PREPRODDTA_F41021_AFTER_UPDATE", line 14
ORA-04088: error during execution of trigger 'AOLALERE.PREPRODDTA_F41021_AFTER_UPDATE'
TRIGGER preproddta_f41021_after_update
after insert or update
on preproddta.f41021
for each row
declare
--nothing to declare
--pragma autonomous_transaction;
l_lipqoh preproddta.f41021.lipqoh%type;
l_lipcom preproddta.f41021.lipcom%type;
l_lihcom preproddta.f41021.lihcom%type;
l_lilots preproddta.f41021.lilots%type;
l_lilocn preproddta.f41021.lilots%type;
l_lilotn preproddta.f41021.lilots%type;
l_quantity_avail f41021_audit.quantity_avail%type;
l_rec_chk f41021_audit.liitm%type;
begin
--chk_for_post(:new.limcu,:new.liitm);
--if :old.limcu <> ' GBD001' then return; end if;
if :old.lipqoh = :new.lipqoh then
l_lipqoh := :old.lipqoh;
else
l_lipqoh := :new.lipqoh;
end if;
if :old.lipcom = :new.lipcom then
l_lipcom := :old.lipcom;
else
l_lipcom := :new.lipcom;
end if;
if :old.lihcom = :new.lihcom then
l_lihcom := :old.lihcom;
else
l_lihcom := :new.lihcom;
end if;
if :old.lilots = :new.lilots then
l_lilots := :old.lilots;
else
l_lilots := :new.lilots;
end if;
if l_lilots <> ' ' then
l_quantity_avail := - (l_lipcom - l_lihcom);
else
l_quantity_avail := l_lipqoh - (l_lipcom + l_lihcom);
end if;
l_rec_chk := rec_chk(:old.limcu,:old.liitm,l_lilots);
if l_rec_chk is not null then
begin
update f41021_audit
set lipqoh = l_lipqoh,
lipcom = l_lipcom,
lihcom = l_lihcom,
quantity_avail = l_quantity_avail
where limcu = :old.limcu
and liitm = :old.liitm
and lilotn = :old.lilotn
and lilocn = :old.lilocn
and lilots = l_lilots;
end;
else
-- insert record into audit table
begin
insert into f41021_audit
(limcu,
liitm,
lipqoh,
lipcom,
lihcom,
lilots,
lilotn,
lilocn,
quantity_avail)
values
(:old.limcu,
:old.liitm,
l_lipqoh,
l_lipcom,
l_lihcom,
l_lilots,
:old.lilotn,
:old.lilocn,
l_quantity_avail);
end;
end if;
end;
create or replace procedure chk_for_post(p_limcu in varchar2,
p_liitm in number)
is
cursor get_bra_qa(p_limcu in varchar2,
p_liitm in number)is
select liitm,
(sum(lipqoh) - sum(lipcom + lihcom)) qual_avail
from preproddta.f41021 a, preproddta.f4101 b
where limcu = p_limcu
and liitm = imitm
and liitm = p_liitm
group by liitm,imdsc1;
l_bra_qa get_bra_qa%rowtype;
l_itm_bran_qa t_f41021_itm_bran_qa := t_f41021_itm_bran_qa.initialize(p_liitm);
begin
open get_bra_qa(p_limcu,p_liitm);
fetch get_bra_qa into l_bra_qa;
close get_bra_qa;
if l_itm_bran_qa.quantity_avail is null then ---This indicate that there is no record for
---quantity available for the item based on the branch .
l_itm_bran_qa := new t_f41021_itm_bran_qa(p_liitm);
begin
l_itm_bran_qa.liitm := p_liitm;
l_itm_bran_qa.limcu := p_limcu;
l_itm_bran_qa.quantity_avail := l_bra_qa.qual_avail;
l_itm_bran_qa.add_it;
commit;
end;
else
l_itm_bran_qa := t_f41021_itm_bran_qa.initialize(p_liitm);
if l_itm_bran_qa.quantity_avail = l_bra_qa.qual_avail then
null; return;
else
begin
l_itm_bran_qa.liitm := p_liitm;
l_itm_bran_qa.limcu := p_limcu;
l_itm_bran_qa.quantity_avail := l_bra_qa.qual_avail;
l_itm_bran_qa.send_to_DB;
commit;
end;
end if;
end if;
end;Thanks,
I comment it out cos it was causing the problem this is the code:
The following error has occurred:
ORA-04091: table PREPRODDTA.F41021 is mutating, trigger/function may not see it
ORA-06512: at "AOLALERE.CHK_FOR_POST", line 7
ORA-06512: at "AOLALERE.CHK_FOR_POST", line 20
ORA-06512: at "AOLALERE.PREPRODDTA_F41021_AFTER_UPDATE", line 98
ORA-04088: error during execution of trigger 'AOLALERE.PREPRODDTA_F41021_AFTER_UPDATE'
TRIGGER preproddta_f41021_after_update
after insert or update
on preproddta.f41021
for each row
declare
--nothing to declare
--pragma autonomous_transaction;
l_lipqoh preproddta.f41021.lipqoh%type;
l_lipcom preproddta.f41021.lipcom%type;
l_lihcom preproddta.f41021.lihcom%type;
l_lilots preproddta.f41021.lilots%type;
l_lilocn preproddta.f41021.lilots%type;
l_lilotn preproddta.f41021.lilots%type;
l_quantity_avail f41021_audit.quantity_avail%type;
l_rec_chk f41021_audit.liitm%type;
begin
--if :old.limcu <> ' GBD001' then return; end if;
if :old.lipqoh = :new.lipqoh then
l_lipqoh := :old.lipqoh;
else
l_lipqoh := :new.lipqoh;
end if;
if :old.lipcom = :new.lipcom then
l_lipcom := :old.lipcom;
else
l_lipcom := :new.lipcom;
end if;
if :old.lihcom = :new.lihcom then
l_lihcom := :old.lihcom;
else
l_lihcom := :new.lihcom;
end if;
if :old.lilots = :new.lilots then
l_lilots := :old.lilots;
else
l_lilots := :new.lilots;
end if;
if l_lilots <> ' ' then
l_quantity_avail := - (l_lipcom - l_lihcom);
else
l_quantity_avail := l_lipqoh - (l_lipcom + l_lihcom);
end if;
l_rec_chk := rec_chk(:old.limcu,:old.liitm,l_lilots);
if l_rec_chk is not null then
begin
update f41021_audit
set lipqoh = l_lipqoh,
lipcom = l_lipcom,
lihcom = l_lihcom,
quantity_avail = l_quantity_avail
where limcu = :old.limcu
and liitm = :old.liitm
and lilotn = :old.lilotn
and lilocn = :old.lilocn
and lilots = l_lilots;
end;
else
-- insert record into audit table
begin
insert into f41021_audit
(limcu,
liitm,
lipqoh,
lipcom,
lihcom,
lilots,
lilotn,
lilocn,
quantity_avail)
values
(:old.limcu,
:old.liitm,
l_lipqoh,
l_lipcom,
l_lihcom,
l_lilots,
:old.lilotn,
:old.lilocn,
l_quantity_avail);
end;
end if;
chk_for_post(:new.limcu,:new.liitm);
return;
end;
create or replace procedure chk_for_post(p_limcu in varchar2,
p_liitm in number)
is
cursor get_bra_qa(p_limcu in varchar2,
p_liitm in number)is
select liitm,
(sum(lipqoh) - sum(lipcom + lihcom)) qual_avail
from preproddta.f41021 a, preproddta.f4101 b
where limcu = p_limcu
and liitm = imitm
and liitm = p_liitm
group by liitm,imdsc1;
l_bra_qa get_bra_qa%rowtype;
l_itm_bran_qa t_f41021_itm_bran_qa := t_f41021_itm_bran_qa.initialize(p_liitm);
begin
open get_bra_qa(p_limcu,p_liitm);
fetch get_bra_qa into l_bra_qa;
close get_bra_qa;
if l_itm_bran_qa.quantity_avail is null then ---This indicate that there is no record for
---quantity available for the item based on the branch .
l_itm_bran_qa := new t_f41021_itm_bran_qa(p_liitm);
begin
l_itm_bran_qa.liitm := p_liitm;
l_itm_bran_qa.limcu := p_limcu;
l_itm_bran_qa.quantity_avail := l_bra_qa.qual_avail;
l_itm_bran_qa.add_it;
commit;
end;
else
l_itm_bran_qa := t_f41021_itm_bran_qa.initialize(p_liitm);
if l_itm_bran_qa.quantity_avail = l_bra_qa.qual_avail then
null; return;
else
begin
l_itm_bran_qa.liitm := p_liitm;
l_itm_bran_qa.limcu := p_limcu;
l_itm_bran_qa.quantity_avail := l_bra_qa.qual_avail;
l_itm_bran_qa.send_to_DB;
commit;
end;
end if;
end if;
end;
Please sugesst any work around. I need to call calculate changes based on the insert or updates -
Compiling Procedures/Packages/Functions
I'm fairly new to the arena of compiling Procedures/Packages/Funcitons but I was given the task of updating a development DB with a lot of newly created/updated Objects. I have created a shell script to go through all the new files and create or replace all the new objects in sqlplus. My question is how to compile all the newly created objects and their dependencies correctly? I have been using SQL Developer to verify that everything has compiled but I see that some are marked invalid which I assume is because a dependency was compiled after it. What would be my best way to making sure everything is valid? I hope this makes sense but any help would be appreciated.
You can use a script like this to build your own sql statement to compile the invalid objects. You can add your own statement for other object types at the end with a union, ie TYPE body.
You will probably need to run it repeated until all objects are VALID. You can put it in a PL/SQL block with a loop and execute immediate so reduce the manual work.
--PACKAGE
select 'alter package ' || object_name || ' compile;' from user_objects
WHERE Status = 'INVALID'
and object_type= 'PACKAGE'
union
-- PACKAGE BODY
select 'alter package ' || object_name || ' compile body;' from user_objects
WHERE Status = 'INVALID'
and object_type= 'PACKAGE BODY'
union
--PROCEDURE
select 'alter procedure ' || object_name || ' compile;' from user_objects
WHERE Status = 'INVALID'
and object_type= 'PROCEDURE'
union
--FUNCTION
select 'alter function ' || object_name || ' compile;' from user_objects
WHERE Status = 'INVALID'
and object_type= 'FUNCTION'
union
--TRIGGER
select 'alter trigger ' || object_name || ' compile;' from user_objects
WHERE Status = 'INVALID'
and object_type= 'TRIGGER'
union
--VIEW
select 'alter view ' || object_name || ' compile;' from user_objects
WHERE Status = 'INVALID'
and object_type= 'VIEW' -
Table is mutating, trigger/function may not see it
Hi,
I have been trying to get a trigger to execute a stored procedure when an update is made to a row in a table.
The procedure works when ran manually and the trigger compiles but when the trigger is fired I get a "table is mutating, trigger/function may not see it" error.
Here's a bit more background:
I have a product table where the cost of a product is calculate based on costs in other tables (e.g. cost of raw materials is in the suppliesrawmat table).
I have written a procedure (called proc_costcalc) which takes in a productID and updates that product's cost in the product table.
I want a trigger to do this for every affected product when a rawmaterial cost is changed.
The code of my trigger is:
CREATE OR REPLACE trigger trig_rawcostupdate
AFTER INSERT OR UPDATE ON suppliesrawmat FOR EACH ROW
DECLARE
cursor c1 is
SELECT p.prodid
FROM process p,
(SELECT s.processid
FROM stage s,
(SELECT stageno
FROM stagerawmat
WHERE prodid = :new.prodid) subquery0
WHERE s.stageno = subquery0.stageno) subquery1
WHERE p.processid = subquery1.processid;
BEGIN
FOR tuple in c1
LOOP
proc_costcalc(tuple.prodid);
END LOOP;
END;
The query for the cursor generates a list of productIDs which I need to run through the proc_costcalc procedure.
Can anyone show me where I am going wrong? How can I fix this?
Thanks
KeithI'm afraid I'm still not getting this.
Suppose I have 4 tables (product, madefrom, rawmat and suppliesrawmat).
Product (productid, cost)
Madefrom (productid, rawmatid)
Rawmat (rawmatid)
Suppliesrawmat (supplierid, rawmatid, cost)
The cost of a product should be the sum cost of all rawmaterials it is made from where the cheapest supply cost of that material is used.
What I want to do is update the cost of a product when the cost of a raw material used in its production changes.
My earlier attempt was to have a procedure which when given a productid updates the price of that product. However, when trying to call this procedure from an update on the suppliesrawmat table I recieved the table is mutating error. I now understand why (thanks to everyone for that) but I still don't really know how to rectify the problem.
How should I be doing this?
Thanks again
Keith -
How to check if column_ name is used by any procedure ,package ,function
Hello
Help Is greatly appreciated .
Kindly please let me know for the folllwoing:
How to check if column_ name is used by any procedure ,package ,function ,trigger or in any dataabse objects>
How to check if column_ name is used by any procedure ,package ,function ,trigger or in any dataabse objects
>
In general you can't. Code can always exist outside the database and it is always possible that you have dynamic code and there is no way to find references like that if used by dynamic code. That dynamic code reference could be based on a query stored in a table.
And there is no way of knowing if external code (e.g. a Java app) references that column.
Another issue is that a column could exist in multiple schemas and in multiple objects of different types in those schemas. So a global DB search for 'MY_COLUMN' might turn up references in multiple schemas and you may only care about one schema.
Unfortunately a reference to 'MY_COLUMN' in code could refer to many different objects or to an object in different schemas so how would you resolve those? Especially if you take synonyms into account which can ponit about anywhere.
Why don't you tell us what it is you are really trying to do?
Are you trying to find the references to a particular column? Why? Are you planning on removing/renaming the column? If so then the simplest way is to remove/rename the column and see what objects become invalid. Those invalid objects will have become invalid because that column is no longer available.
As suggested you can use DBA_SOURCE for references in code that use the standard names. But for tables/views you need to use all_tab_columns. And for dynamic code or client code (e.g. a Java application) there is no way. -
How to write procedure or function or any sql statement for requirement
Hi,
i have a table named letter,it contains 2 columns named as letter_id and letter_content.
select * from letter;
letter_id letter_content
103 Dear MFR
103 This is in regards to the attached DM List
103 Please Credit us after reviewing it.
103 Thanks
103 Regards
103 xxxx
108 Dear customer
108 This is to inform that ur DM List is as follows
108 Credit us according to the Dm after reviewing it.
108 Thanks
108 Regards
108 xxxx
now my requirement is,i need send a parameter as letter_id to a procedure or function in pl/sql in oracle,the output should be as follows:
if we will pass parameter(letter_id) = 103 then it displays as follows:
Dear MFR
This is in regards to the attached DM List.Please Credit us after reviewing it.
Thanks
Regards,
XXXXX.
if we will pass parameter(letter_id) = 108 then it should displays as follows:
Dear customer,
This is to inform that ur DM List is as follows. Credit us according to the Dm after reviewing it.
Thanks
Regards,
XXXXX.
---------------------------------------------------------------------------------------------------------i am really appriciate ur help.
thank u so much for ur suggestions.
when i am uning line_seq its giving an error
ORA-00904: "LINE_SEQ": invalid identifier
so,in my table i had created a sequense named content_seq.
select * from letter;
content_seq letter_id letter_content
1 103 Dear MFR
2 103 This is in regards to the attached DM List
3 103 Please Credit us after reviewing it.
4 103 Thanks
5 103 Regards
6 103 xxxx
7 108 Dear customer
8 108 This is to inform that ur DM List is as follows
9 108 Credit us according to the Dm after reviewing it.
10 108 Thanks
11 108 Regards
12 108 xxxx
then i had used ur code as follows:
select linefrom ( select content_seq , letter_content || case content_seq when 2 then ' ' || lead(letter_content) over (partition by letter_id order by content_seq) end as line from letter where letter_id = 103 )where content_seq <> 3;
LETTER_CONTENT
Dear MFR
this is in regards to the attached DM List Please credit us after reviewing it
thanks
Regards
EXP
but when i take letter_id = 108 the format is comming different.it was unable to combine 2lines.
Message was edited by:
user579585
Message was edited by:
user579585 -
Procedure and Functions from ADF View Layer
Hi,
Before i ask my question ,I would like to mention that I have done lot of googling on this topic before asking this question.
http://adfhowto.blogspot.in/2010/11/call-db-procedure-or-function-from-adf.html
http://adf-tools.blogspot.ca/2010/03/adf-plsql-procedure-or-function-call.html
Lot of threads on otn forum too on this topic.
I m pretty new to ADf too.
Now most of our logic is in procedures and functions ,so on various events on form(view layer) I need to call procedure and function and then return values back to value layer too.
Now the approach mentioned in the link above is good whats best approach to return out parameters to view layer considering i will be using either the DbCall class for all calls to procedures and functions
I am thinking of this approach to Create a view with static fields,and in Model layer set values for these fields and access them in view layer or binding view controls to these fields.
From View layer i will call the methods in AppmodImpl which will be calling procedure( methods will be exposed as Client Interface)
Also in few articles i came across generic CallStoredProcedure and CallStoredFunctions.
But my main concern is how to share out parameters with view layer....can anyone give link of showing application of it on view layer.
Regards,From your subject. am stating that, dont do all those stuff in backing bean. backing bean is 1:1 mapping with your .jpsx or .jsff .
best approach would be call those things your Application Module(model layer) exposed it. access the method over your pagedef. well said by ram. -
How can I use the procedures and functions in my library
hello, all
I have a pl/sql library MYLIB.pld, MYLIB.pll and MYLIB.plx.
How can I invoke procedures and functions there in JDeveloper?
Thanks.
DamonI am indeed using ADF BC to re-develop the oracle application.
Here is my situation:
We have an oracle form application.
Our objective is to try to re-use the existing sources in the form application as much as possible:
1. tons of procedures and functions in a pl/sql library(a file with extension name portfolioLib.pll or portfolioLib.plx);
2. tons of form-level triggers, data-block triggers and item-triggers;
3. tons of database stored procedures and triggers;
After doing a research on JDeveloper, we decide to use ADF Swing+ADF BC to re-develop the application.
My opinion for the above three kinds of sources in our form application is:
for 1: we try to move most of procedures and functions into database(except Form build-in);
for 2: we try to wrap those triggers in a SQLJ class;
for 3: we try to call database procedures and functions with PreparedStatment or CallableStatement;
I just do a test on a post-query trigger on a data-block:
I created a sqlj file, named testSQLJ.sqlj in the test.view package;
I tried to call it in createInstanceFromResultSet of testDeptVOImpl.java which is test.model package,
I was told that testSQLJ cannot be found there. why?
How can I call some classes from test.view package in some classes of test.model?
I read some documents about how to deal with post-query trigger in JDeveloper: create a view with SQL statement, but it seems that it does not support pl/sql statement there.
Can you give me some opinion about the above stuff?
I really appreciate your help.
Damon -
hi folks,
procedure and function are doing a same job then why we using function,please give explanation in real time scenario ...When talking about PL/SQL only, everything that can be achieved with a function can also be achieved with a procedure using out parameters, thus you don't really need functions.
However, a function may be used as a "syntactical convenience" in that you can write expressions like this in your PL/SQL code:
total_salary := get_total_salary(dept_id => my_dept);
(assuming you have defined the function get_total_salary).
You may find this more readable than writing
get_total_salary(result => total_salary, dept_id => my_dept);
(assuming you have defined the procedure get_total_salary with an out parameter result).
This is the same as with e.g. the CASE statement. You don't really need it, every CASE statement might be expressed with IF .. THEN statements as well. However using CASE may be more convenient and make your code more readable. Another example are loops, where you have different flavours, while everything might be expressed using one sort of loops (e.g. WHILE).
In addition, you may use functions in SQL, while this is not possible with procedures, i.e. after defining some function f, you may write SQL like this:
select * from t where f(id) = 0; -
Procedure and Function-Memory issue
Hi,
I have got code for maintaining cube.This code is generated by AWM while maintaining cube.This is nothing but the PL/SQL block with generated SQLs using following package and procedure.
dbms_lob.writeappend
I am running this PL/SQL block by putting in procedure.It is working perfectly in procedure but due to system requirement I need to turn procedure into function.When I run the same PL/SQL block in function,it gives following error:
ORA-29532: Java call terminated by uncaught Java exception:
java.lang.OutOfMemoryError
What is the difference between function and procedure when same set of SQLs are running successfully in procedure and giving error in function.
Can someone help me in this?
ThanksWhen talking about PL/SQL only, everything that can be achieved with a function can also be achieved with a procedure using out parameters, thus you don't really need functions.
However, a function may be used as a "syntactical convenience" in that you can write expressions like this in your PL/SQL code:
total_salary := get_total_salary(dept_id => my_dept);
(assuming you have defined the function get_total_salary).
You may find this more readable than writing
get_total_salary(result => total_salary, dept_id => my_dept);
(assuming you have defined the procedure get_total_salary with an out parameter result).
This is the same as with e.g. the CASE statement. You don't really need it, every CASE statement might be expressed with IF .. THEN statements as well. However using CASE may be more convenient and make your code more readable. Another example are loops, where you have different flavours, while everything might be expressed using one sort of loops (e.g. WHILE).
In addition, you may use functions in SQL, while this is not possible with procedures, i.e. after defining some function f, you may write SQL like this:
select * from t where f(id) = 0; -
How to call plsql procedure or function and getting back the string?
Hi Everyone,
i am using Jdev 11.1.1.5.0.
i have a requirement to call plsql procedure or function from my backing bean java file and get back the returned value from the procedure or function.
what piece of simple code i need to write in my backing bean?
please suggest.
Thanks.As always you write the method to call he pl/sql in the application module, expose this method to the client (so you see it in the datacontroll) then create a operation binding to the method and call this operation from the bean. The result you get by operation.getResult();
You should never call pl/sql from the bean directly!
The doc shows how to call the procedure from an application module: http://docs.oracle.com/cd/E21764_01/web.1111/b31974/bcadvgen.htm#sm0297
Timo -
ORA-04091: is mutating, trigger/function may not see
I am getting this error
ORA-04091: table SATURN.SARQUAN is mutating, trigger/function may not see it
ORA-06512: at "BANINST1.F_GETSARQUANSEQNO", line 24
ORA-06512: at "BANINST1.F_GETSARQUANSEQNO", line 30
I am trying to do this insert
INSERT INTO sarquan
(sarquan_pidm,sarquan_term_code_entry,sarquan_seqno,
sarquan_appl_no, sarquan_question,
sarquan_answer, sarquan_activity_date,
sarquan_user_id
SELECT spriden_pidm,'201090',BANINST1.F_GETSARQUANSEQNO(spriden_pidm,'201090','1'),'1',
'Would you prefer September admission?',
DECODE (szcasup_sept_adm, 'Y', 'Yes', 'N', 'No'),sysdate,'rmanoei'
FROM saturn_midd.szcasup, saturn.spriden
WHERE spriden_id = szcasup_common_appl_id
AND spriden_ntyp_code = 'CAPP'
AND ( szcasup_sept_adm IS NOT NULL
OR szcasup_feb_adm IS NOT NULL
OR szcasup_interview IS NOT NULL
AND NOT EXISTS (
SELECT *
FROM sarquan
WHERE sarquan_pidm = spriden_pidm
AND spriden_ntyp_code = 'CAPP'
AND sarquan_term_code_entry = '201090');
I got data when I ran just the select statement, none of the records have data in the sarquan table.
I got data when I select from this function
,BANINST1.F_GETSARQUANSEQNO(spriden_pidm,'201090','1'),'1'
Any ideas?
Edited by: peace4all on Aug 12, 2009 4:49 PMI can not drop the trigger, I don't own the trigger, it is in production, SARQUAN is a production table
Now I am getting this error ORA-04091: table SATURN.SARQUAN is mutating, trigger/function may not see it
ORA-06512: at "BANINST1.F_GETSARQUANSEQNO", line 24
ORA-06512: at "BANINST1.F_GETSARQUANSEQNO", line 30
ORA-06512: at "SATURN.ST_SARQUAN_INSERT_ROW", line 2
ORA-04088: error during execution of trigger 'SATURN.ST_SARQUAN_INSERT_ROW'
when I do the following
I know that this pidm does not have any records in the table SARQUAN
spriden_pidm = 2287953
So I try to do a simple insert, not using the function, now I am hardcoding the seq, I know it needs to be 1 since there are not records in that table yet,
the sequence go by pidm
INSERT INTO saturn.sarquan
sarquan_pidm,
sarquan_seqno,
sarquan_term_code_entry,
sarquan_appl_no,
sarquan_question,
sarquan_answer,
sarquan_activity_date,
sarquan_user_id
SELECT spriden_pidm,'1',
'201090','1',
'Would you prefer September admission?',
DECODE (szcasup_sept_adm, 'Y', 'Yes', 'N', 'No'),sysdate,'recheverri'
FROM saturn_midd.szcasup, saturn.spriden
WHERE spriden_id = szcasup_common_appl_id
AND spriden_ntyp_code = 'CAPP'
and spriden_pidm = 2287953
AND ( szcasup_sept_adm IS NOT NULL
OR szcasup_feb_adm IS NOT NULL
OR szcasup_interview IS NOT NULL
AND NOT EXISTS (
SELECT *
FROM saturn.sarquan
WHERE sarquan_pidm = spriden_pidm
AND spriden_ntyp_code = 'CAPP'
AND sarquan_term_code_entry = '201090');
Edited by: peace4all on Aug 13, 2009 5:35 AM -
ORA-04091:table XYZ is mutating,trigger/function may not see it ORA-06512
Hi everybody
i am facing mutating problem during data deletion fron XYZ table as
ORA-04091:table XYZ is mutating,trigger/function may not see it ORA-06512 at "user.procdure_name",line 39 ORA-065
i have table XYZ and have database trigger on this table
and also have procedure "user.abc" in this procedure m selecting data from xyz tableYou didn't post the actual code. I was more interested in seeing table name and the trigger body.
Anyways, mutation problem comes when you refer the same table on the trigger, on which it is based for some data manipulation on that table.
For e.g, If inside your trigger body, you are doing INSERT on the same table, then it'll definitely result in mutation problem because this trigger will be fired endlessly (as it is after insert trigger).
Please mark answer as helpful / correct, if it helps you
Navnit
Maybe you are looking for
-
T3/RMI packet size very large
In order to determine our bandwidth requirements, we recently placed a sniffer on our network to analyze our message packets. We've noticed that our packets are very large and it appears that much of the overhead is in the overhead of RMI or T3. Here
-
Solaris 10 Net Install - Illegal Instruction
Hi Colleagues, I 've been wrestling with this for awhile and can't seem to correct the problem. Searching the forum and the Web has also not returned any solutions. Problem: I'm trying to install Solaris 10 10/09 on a SunFire V100 (128MB Ram, 40GB an
-
Info view Timeout. [RCIRAS0244]
Hi, I am running report in the InfoView. My SQL query execute time is about 20-30 minutes. (I have checked it in the "Oracle SQL developer" and "PLSQL Developer") I get this error when I try to run a Crystal report in Infoview: Timeout. [RCIRAS0244]
-
Problem with imported photos color/exposure
Hello group, Have been working on a video of our vacation and am having a strange problem importing photos. When I import the photo, it looks as it should. When I add the ken burns effect, once it renders the color seems washed out and the exposure l
-
Make changes to a spry menu bar
I have used a spry menu bar 2.0 widget with the adobe widget browser by David Powers in my web site, and its working really well but now I have found I need a new sub menu, off an existing sub menu, I have read the instructions to try and put it in,