SQL & PL/SQL :: Catch The Triggering Statement In DMl Triggers

Dec 23, 2011

How to catch or store the sql statement that caused the trigger to fire in DMl Triggers.

View 11 Replies


ADVERTISEMENT

SQL & PL/SQL :: Error ORA-00694 When Triggering DDL Operation

Feb 28, 2011

I am trying to use on trigger to get the code of an DDL operation, I use the code supplied on orafaq (orafaq.com/scripts/plsql/auditdll.txt) as base code and I added a collumn objcode and a call to DBMS_METADATA.GET_DDL to save the object code, however I am receiving an Oracle error ORA-00604.See code below.

This error is raised when I try to create a new view on the schema, on objects that I already have and I changed something usually the error did not happens, how to get the object code of one object when it is created, or changed.

I am using Oracle 11g

SQL> select banner
2 from sys.v_$version;
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE11.2.0.1.0Production
TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production

cl scr;
DROP TRIGGER audit_ddl_changes
/
DROP TABLE dll_audit_log

[Code]....

CREATE FORCE VIEW V3 AS SELECT * FROM ALL_OBJECTS
ORA-00604: error occurred at recursive SQL level 1
ORA-31603: object "V3" of type VIEW not found in schema "XXISV_V11R01"
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
ORA-06512: at "SYS.DBMS_METADATA", line 3912
ORA-06512: at "SYS.DBMS_METADATA", line 5678
ORA-06512: at line 1
ORA-06512: at line 2

View 1 Replies View Related

How To Catch Null Value With C# Code

Jan 5, 2010

how to catch a null value with C# code?

My Asp.Net/C# application is connected to an Oracle database where it retrieves database values and also values calculated/returned from Oracle functions. My problem is that sometimes an Oracle function I calling returns a null value because of not correct input parameters which will cause Oracle function to (I think) return an null value. My problem and question is how to catch/obtain if he Oracle function returns a null value? Oracle function should return a decimal value if correct input parameters. Below is my row of code that crashes when Oracle function returns a null value in case of incorrect input parameters.

decGrossFreightRevenue = (decimal)(OracleNumber)cmdCalculateRevenueCall.ExecuteOracleScalar();

how to change my code to catch a null value and avoid a crash. I have tried several checks (if statements) without success.

View 2 Replies View Related

Forms :: How To Catch Exception Thrown By A Table

Feb 11, 2010

How can i catch the exception thrown by a PLSQL_TABLE.POPULATE_BLOCK. Actually i want to display alert messages if POPULATE_BLOCK doesn't contain any records. i wrote the PLSQL_TABLE.POPULATE_BLOCK(bk_data, 'block name');

In query procedure after that if i write any code for alert message then it is not getting executed it may be because of exception is handled by PLSQL_TABLE.POPULATE_BLOCK

What will be the solution to this problem ?

View 1 Replies View Related

Forms :: How To Catch Warning / Error ORA-28002 In Oracle

Dec 6, 2010

SQL > conn ashish/pass@conn_string
ERROR:
ORA-28002: the password will expire within 1 days
----------------------------------------------------------
I want to catch this eror in forms: catch the error code ORA-28002 in ON-ERROR trigger and ON-Message trigger, however its not getting caught in the trigger. how to catch the warning/error ORA-28002 in oracle forms?

View 1 Replies View Related

SQL & PL/SQL :: Functional Index - Catch Exception And Print Customized Message

Feb 16, 2011

I have a functional index.. which doesn't allow duplicate based on condition.I want to catch the exception and print the customized message but it always override my message.

create or replace function i_func
(tt_id in number,
d_date date,
stat in varchar2)
return varchar2
[code].....

output: ORA-00001: unique constraint (abb.TEST_IDX) violated

View 10 Replies View Related

Client Tools :: Catch Oracle Login Error In Batch File?

Feb 6, 2012

I have a Batch file(.bat) where I get the user name password ans schema name as a input . Based on that input I connect the sql and run some update query from bat file itself. Now I have issue ,when the user give wrong credintials it ask for the credintials again.

Is there any way to check the credintials of oracle and give the invalid credintial error via bat file. The sample of my Bat file is as follows.

@echo off
for /f %%i in ('sqlplus -s usename/password@db @H: est_db_connection.sql') do @set count=%%i
echo %count%
IF %count% EQU 1 ECHO ("Database connection working fine")
IF %count% NEQ 1 ECHO ("Not able to connect to database")

This is not working fine.

View 2 Replies View Related

SQL & PL/SQL :: Instead Of Triggers?

Dec 26, 2011

What is the purpose and use of 'Instead of Triggers'

View 20 Replies View Related

SQL & PL/SQL :: Two Triggers On Same Table

Dec 4, 2010

I have to write two triggers on same table for auditing different columns of different users(may be different modules).

I will have an audit table in which i will insert data such as (user_id,module_id,column_name,old_col_val,new_col_val,timestamp)

Now different users from different modules will update the data on same table may be same columns from different front end forms!

If we write directly, we will not be able to know which column is updated by which user.

My question is in this case how can we control the triggers to raise differently?

View 3 Replies View Related

Triggers In Oracle

Jul 1, 2010

Im going to create a trigger(insert or update) for a table A, when it fires inserted or updated columns are should be insert or update into another table say table B, one column(Processed_time) in table B where its value will be by subtracting two columns in table A(response_time,Submission_time) all are timestamp type.

How to update(Processed_time) in table B by subtracting above two columns in table A.

View 2 Replies View Related

Compound Triggers Not Firing

Nov 1, 2011

I have rather large compound triggers that I discovered were not firing this morning, so I created a simpler compound trigger to test:

CODECREATE OR REPLACE TRIGGER "test"
FOR INSERT OR DELETE OR UPDATE OF KI_NM ON CHEMAXON.CB1ASSAYS
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
ENABLE
[code]...

It's just not firing. The tables are all in the owner's schema (who has DBA rights). My Google-fu is failing me, and I'm not sure how to start troubleshooting general trigger failure.

View 2 Replies View Related

Trc Files Generated From Triggers?

Dec 3, 2010

The trace directory is full of trc files with the text below:

--------Dumping Sorted Master Trigger List --------
Trigger Owner : INPUT
Trigger Name : CUS_TST
--------Dumping Trigger Sublists --------

There is like a file generated every minute, and i cant stop it from happening.I have tried setting the trace_enabled parameter to FALSE but no success.

View 2 Replies View Related

Dynamic Old Column Name In Triggers?

Jul 26, 2004

I have column names stored in a table(say t1).

Inside a trigger I have to dynamically get the : old. values for only these columns.

This I need because during update trigger on a table (say t2) I am supposed pickup the coumn names stored in t1 and get the : old values of only these columns to insert into a new table .

View 5 Replies View Related

SQL & PL/SQL :: Procedure Functionality As Triggers

Oct 26, 2010

I am creating triggers for audit operation when any insert/update/delete happens on a table automatically.Now i need the same functionality in procedure.

My requirement is to create procedure for all those triggers.

View 2 Replies View Related

PL/SQL :: DML Triggers Not Working Properly?

Jul 18, 2013

There are two servers A and B ,and i am maintaining one table suppose table1 and another table suppose table2 , DML triggers are made for both of these tables.The action of DML trigger is that the movement we are inserting values , suppose a table1 on server A so automatically the same set of value in table2 on server Bso my problem is that the movement i inserted value on table1 on server A ,

the same set of values were inserted into table2 of server B and as the values were inserted intotable2 , the same set of values were inserted into the tabld1 because of the trigger.  How to stop the non ending loop which occurs due to the simultaneous firing of triggers and insertion of same records into both the table endlessly...

version :---Personal Oracle Database 10g Release 10.2.0.3.0 TNS for 32-bit Windows: Version 10.2.0.3.0

View 0 Replies View Related

Variable Usage In Type Of Table Declaration Statement And Execute Immediate Statement

Aug 10, 2011

HOW to use variable P_TMPLID in following statement

TYPE typ_unrecon IS TABLE OF REC_' || P_TMPLID ||'_UNRECON%ROWTYPE index by binary_integer;

because its throwing error while compiling

and also in statement
FORALL i IN unrecondata.FIRST .. unrecondata.LAST SAVE
EXCEPTIONS
--STRSQL := '';
--STRSQL := ' INSERT INTO REC_' || P_TMPLID ||'_UNRECON VALUES ' || unrecondata(i);
-- EXECUTE IMMEDIATE STRSQL;
INSERT INTO REC_' || P_TMPLID ||'_UNRECON VALUES unrecondata(i);---throwing error on this statement
commit;
--dbms_output.put_line(unrecondata(2).TRANSID);
EXCEPTION

View 2 Replies View Related

Triggers / Referencing Non-updated Fields?

Jan 11, 2011

I'm having a bit of a problem getting the syntax of a trigger right. Unfortunately, I have no DBAs locally, I use some third party software, and for reasons beyond my understanding, I have been told to use triggers, and not stored procedures, so I'm running with it.

The set up:

STRUCTURES table: contains several columns, one of which is the unique ID column.
ASSAY table: contains several rows, also with the same ID column, but can have more than one row per ID (several assays per compound). One column is XC_ASSAYS.

The idea of the trigger is basically: When a row in the ASSAYS table is updated, pull out the ID of the row, then calculate the average of the XC_ASSAYS columns for those rows, and report it to the STRUCTURES.XC_ASSAY column for that row ID.

My best attempt thus far results in compilation errors.

CREATE TRIGGER INHIB_W_ALA_TR
AFTER INSERT OR UPDATE ON ASSAYS
FOR EACH ROW
BEGIN
UPDATE STRUCTURES SET XC_ASSAY = (SELECT AVG(XC_ASSAY) FROM ASSAYS WHERE ASSAYS.ID = :NEW.ID) WHERE STRUCTURES.ID = :NEW.ID
END;
/

The resulting errors are:
LINE/COL ERROR
-------- -----------------------------------------------------------------
2/1 PL/SQL: SQL Statement ignored
2/190 PL/SQL: ORA-00933: SQL command not properly ended
12/0 PLS-00103: Encountered the symbol "end-of-file" when expecting

[code]...

I don't understand some of the errors, such as why line 2 SQL is ignored (it seems correct?), or I'm supposed to properly terminate the trigger (I've read ; and /, but I'm getting the end-of-file errors when I do so). Tried shuffling syntax and ' or " around - and I can't get it.The body SQL works when I replace :NEW.ID with an actual variable (such as 'NMP12'), but I'm not sure how to pass the ID variable from the updated row into the body. The ID is not updated, but other columns are.

View 3 Replies View Related

GoldenGate Sequence Replication And Triggers

Apr 29, 2013

I have a question about GG Sequence Replication and Triggers. My main database, which I would like to replicate on another server, is highly dependent on sequences for assigning surrogate keys to every row in every table in the application. I know that I need to add Sequence support to my source database (plus supplemental logging, etc), but I'm curious about the target database.

I do not anticipate allowing Read/Write access to this database - we are migrating from 10.2.0.4 (source) to 11.2.0.3 (target) on a new platform, and I want to keep the 11g database up-to-date with our production data until it is time to begin the actual conversion of our application. My thinking is that if I use the SUPPRESSTRIGGERS dboption in my Replicat session, this should take care of the use of the Sequences for assigning the surrogate key values, and the data should add to the tables normally without any intervention by the sequences/trigger combination. I know I will have to manually "correct" the sequences on my 11.2.0.3 database whenever I want to open this database up for use, but I have a script for this ready to go.

Also, in my source database, I am using Oracle Context indexes for generic name searching - this feature creates a number of DR$ named tables in the main application schema that I am replicating (approximately 50 of them). I am assuming that I should EXCLUDE these tables from the replication, as the context indexing should automatically update them as changes to the underlying data are applied via the replication of the indexed tables.

View 1 Replies View Related

Forms :: Mouse Triggers Not Working?

Sep 5, 2010

why when-mouse move,up,enter,leave are not working in oracle forms 10g except when-mouse-click and when-mouse-doubleclick on any items.

what i need to do to execute this triggers..

View 3 Replies View Related

SQL & PL/SQL :: Mutating Tables And Row Level Triggers?

Feb 24, 2010

I am unable to understand why row level triggers cant be used in mutating tables.

If you need to update a mutating table, you could bypass these restrictions by using a temporary table, a PL/SQL table, or a package variable. For example, in place of a single AFTER row trigger that updates the original table, resulting in a mutating table error, you might use two triggers--an AFTER row trigger that updates a temporary table, and an AFTER statement trigger that updates the original table with the values from the temporary table.

View 1 Replies View Related

Forms :: Can Change The Order Of Triggers In 6i

Dec 12, 2012

can change the order of triggers in forms 6i . that means firing in form level?

View 4 Replies View Related

Forms :: Triggers Regarding Find Query?

Oct 24, 2013

I am working on a form, whose one block is query_find, so on clicking find button it will open another block.the find block contain 4 column and second block contain around 10 column.but the column present in find block are associated to standard tables and the column present in block-2 are from custom tables.there is a query which link those column.

I am not sure where to use that query, so that it will take input from the find block and then populate the result into the block-2.

View 13 Replies View Related

Forms :: Triggers - Key Next And When Validate Item?

Jan 18, 2006

Suppose if I have defined two triggers Key-next and When-validate-item on the same item.

If my key-next is going to fire first and When-validate-item laterhow can the validation happen if I write a code like go_item('XXXX') in my Key-next.Does it mean that if u write a code in key-next to jump to some other item, no validation takes pLace?

View 14 Replies View Related

SQL & PL/SQL :: Triggers Dropped And Stored In Recycle Bin

Dec 5, 2012

Some triggers are dropped and stored in recycle bin. when i am trying to restore it by the command

1* alter trigger "BIN$FFRO1R1LSuSIZ6uyLocD6g==$0" rename to WFNOTIFICATION_GEN_PK
SQL> /
alter trigger "BIN$FFRO1R1LSuSIZ6uyLocD6g==$0" rename to WFNOTIFICATION_GEN_PK
*

ERROR at line 1:
ORA-38301: can not perform DDL/DML over objects in Recycle Bin

View 13 Replies View Related

SQL & PL/SQL :: Overcome Recursive Triggers In Oracle?

Jul 14, 2012

How can we overcome recursive triggers in oracle SQL?

View 7 Replies View Related

PL/SQL :: - NO_DATA_FOUND But Triggers Doesn't Continue Job

Sep 9, 2012

i've a problem regarding my code at line: 76. URL....

If i put a RAISE_APPLICATION_ERROR just before:
SELECT ID_GIOCATORE INTO CONTR_GIOCATORE2
FROM COMP_CONTR_GIOCATORE_PARTITA GC JOIN CONTRATTO C ON GC.ID_CONTRATTO = C.ID_CONTRATTO
WHERE GC.ID_PARTITA = :NEW.ID_PARTITA AND (C.ID_CASELLA = 28 OR C.ID_CASELLA = 12) AND C.ID_CASELLA <> :NEW.ID_CASELLA AND
[code]....

But if i put the RAISE_APPLICATION_ERROR just after this statement and before IF(CONTR_GIOCATORE2 IS NOT NULL AND CONTR_GIOCATORE2 = CONTR_GIOCATORE) THEN, nothing happens after the insert(that goes well) and the trigger doesn't do his job(insert,update etc). if i do that select, i got the no data found, so i put the exception to set the variable CONTR_GIOCATORE2 to NULL.

View 1 Replies View Related

Spatial :: How To Disable Triggers Per Session

Mar 1, 2013

I recently stumbled upon a post for an undocumented golden gate procedure that I find VERY useful when repairing / simplifying spatial data as a DBA without causing user triggers to fire and do unnecessary work, etc. Anything with foo in the name must be good, right? ;-)

HINT: Oracle please make this a documented feature!

This will disable triggers – just for a session – no system wide changes or trigger mods needed! Yes, fire needs to be set to true - to disable the triggers from firing.

exec sys.dbms_xstream_gg.set_foo_trigger_session_contxt(fire=>true);

Note, you will need execute permissions on sys.dbms_xstream_gg first.See for more info: URL.....

View 1 Replies View Related

Forms :: Triggers In 6i / Which Is Applicable To All Items

Jan 24, 2012

May i know the triggers in forms 6i, which is applicable to all items,blocks and form.

View 9 Replies View Related

PL/SQL :: Java Stored Procedures And Triggers

Oct 31, 2012

I want to to use Java stored procedures and triggers within the Oracle 11g XE ?

View 3 Replies View Related

SQL & PL/SQL :: Select Statement From Schemas In MERGE Statement In USING Clause

Sep 13, 2013

In the following merge statement in the USINg clause...I am using a select stament of one schema WEDB.But that same select statement should take data from 30 schemeas and then check the condition below condition

ON(source.DNO = target.DNO
AND source.BNO=target.BNO);

I thought that using UNIONALL for select statement of the schemas as below.

SELECT
DNO,
BNO,
c2,
c3,
c4,
c5,
c6,
c7
[code]....

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved