SQL & PL/SQL :: Unable To Create Trigger Dynamically
Dec 3, 2010
I have created a procedure to build trigger dynamically using Dynamic SQL. Here procedure created successfully, when we execute the procedure to build trigger getting the following error.
Note: We are able to create a Trigger, but it is INVALID. if we get the code of a trigger and execute, trigger created a successfully with Valid Status.
ERROR:
ORA-24344: success with compilation error
ORA-06512: at "APPS.CREATE_TRIGGER", line 28
ORA-06512: at line 2
SQL*Plus internal error state 2087, context 47:0:0
Unsafe to proceed
View 2 Replies
ADVERTISEMENT
Jul 9, 2013
I have to audit some table to log all modifications (inserts, updates, deletes). I wrote the following trigger (works as expected) :
-- Trigger for DOCUMENT table audit
CREATE OR REPLACE TRIGGER TAUDIT_IUD_DOCUMENT
AFTER INSERT OR UPDATE OR DELETE ON DOCUMENT
FOR EACH ROW
DECLARE
l_user VARCHAR2(64);
[code].........
Is there any way I can improve this ?I mean getting columns name and value (:NEW and :OLD) dynamically, instead of specifying them one by one (the trigger will have to be updated in case a new column is added). Something like this :
FOR i in 1..DOCUMENT.COLUMN_COUNT LOOP
l_row := l_row || DOCUMENT.COLUMN_NAME(i) || :NEW.COLUMN_VALUE(i) || l_separator;
END LOOP;
View 6 Replies
View Related
Apr 25, 2011
We have developed a code which builds a trigger on a atble dynamically at run time usinf Dynamic SQL command Execute immediate.
create or replace
PROCEDURE GENERATE_TRIGGER
(
P_TNAME IN VARCHAR2
[Code].....
I am not usre if the error is due to insufficient privileges as we are able to build tabl;e in the system dynamically using the above mentioned command.
View 1 Replies
View Related
Jun 13, 2010
I want to make a trigger , to store values that are affected during any DML(insert,update,delete).
CREATE OR REPLACE TRIGGER generate_log
BEFORE INSERT OR UPDATE
ON EMPLOYEE
FOR EACH ROW
DECLARE
[code]....
View 8 Replies
View Related
Oct 14, 2011
In a pl/sql procedure code, I created a normal table (create table) using dynamic sql. Then I used that table in procedure for further processing. But while compiling, it gave error that table does not exist. I can understand that he table is not present in DB, so the error came. But at the same time I need to create a table dynamically, use it and drop it. Does it mean that I need to make every query referencing that table as dynamic ??
View 1 Replies
View Related
Oct 22, 2013
i need to create a replica of an existing table in same schema dynamically so as to reflect the modifications on replica table which has been done on primary table.this table we need to maintain as snapshot,like if a column is added or deleted then it should automatically be added or deleted on the replica table.how should i approach this.
View 4 Replies
View Related
Nov 15, 2010
how I can create an index dynamically? The DBA wants me to put this code below in the beginning of a PL/SQL package. At first, I tried by just putting the below syntax in the code, but I get an 'Alter' is not a valid identifier.
alter index ZZAP_selected_invoices_n1 rebuild online;
And then once the job completes...
alter index ZZAP_selected_invoices_n1 unusable;
View 8 Replies
View Related
Oct 12, 2013
How to create folder using oracle form. I used HOST command but its not working.
HOST ('md C:Emp_Photo2013');
View 5 Replies
View Related
Dec 26, 2011
I am working with forms 6i..Is it possible to create form dynamically at run time..
View 2 Replies
View Related
Apr 10, 2013
i want to create a lov and record group dynamically at run time. i have the code in when-form-instance..
Declare
v_lov lov;
rg_id recordgroup;
gc_id groupcolumn;
[Code]....
whether i create first a lov and record group at design time or not? if i create a lov and have the recordgroup column then what is the benefit of dynamically lov.?
View 5 Replies
View Related
Oct 27, 2012
how to create link file dynamically in oracle reports 6i
View 3 Replies
View Related
Jul 28, 2010
I need to load data from a CSV file where one of the CSV values determines how many records should be inserted.
Example of the input data:
KEYWORD;2;REC1_COL1_X,REC1_COL2_X;REC2_COL1_X;REC2_COL2_X
KEYWORD;3;REC1_COL1_Y;REC1_COL2_Y,REC2_COL1_Y;REC2_COL2_Y;REC3_COL1_Y;REC3_COL2_Y
KEYWORD;4;REC1_COL1_Z;REC1_COL2_Z,REC2_COL1_Z;REC2_COL2_Z;REC3_COL1_Z;REC3_COL2_Z,REC4_COL1_Z;REC4_COL2_Z
If the KEYWORD is found, then the next value determines how many value pairs will follow, and therefore how many rows should be created in the affected DB table.
As a result I hope to achieve this:
SELECT Column1, Column2 FROM testTable
REC1_COL1_X,REC1_COL2_X
REC2_COL1_X;REC2_COL2_X
REC1_COL1_Y;REC1_COL2_Y
REC2_COL1_Y;REC2_COL2_Y
REC3_COL1_Y;REC3_COL2_Y
REC1_COL1_Z;REC1_COL2_Z
REC2_COL1_Z;REC2_COL2_Z
REC3_COL1_Z;REC3_COL2_Z
REC4_COL1_Z;REC4_COL2_Z
I learned how to import data using Oracle SQL loader for cases where one input line more or less matches a (new) row in a DB table.
View 9 Replies
View Related
Nov 29, 2012
below requirement..
We have certain records like SQL, PL/SQL, Reports, Forms, OAF etc in a table. We wanted to capture rating for each of these criteria. So we want a form to be displayed dynamically..
SQL 1 2 3 4 (1,2,3,4 represent radio buttons)
PL/SQL 1 2 3 4
Reports 1 2 3 4
Forms 1 2 3 4
OAF 1 2 3 4
If we add another row, XMLP in that table additional radio button should be displayed automatically..
View 4 Replies
View Related
Jun 14, 2011
I have a trigger called DDL_TRIG which is used to audit all DDL level operation on the Database. The trigger script is as below:-
CREATE OR REPLACE TRIGGER ddl_trig
AFTER DDL
ON DATABASE
BEGIN
INSERT INTO ddl_log
(user_name, ddl_date, ddl_type,
[code].....
The Table DDL_LOG exists.Now i want to disable or drop this trigger and it wont allow us. While doing on one schema it fails and with below error:
when logged in schema1 and give drop or disable command it fails
ORA:04098:trigger schema2.ddl_trig is invalid and failed re-validation.
when logged in schema2 and give drop or disable command it fails
ORA:04098:trigger schema1.ddl_trig is invalid and failed re-validation.
how can we drop this trigger in both the schema's. This trigger is not allowing us to do any activity on the Database and causing lot of problem.
View 7 Replies
View Related
Apr 19, 2012
I have schema a and b in the same database with synonym table a (schema a) to schema b. When I try to disable trigger from table a in schema b; I got this message:
ORA-00942: table or view does not exist
I have granted all permissions to schema b and I am able to SELECT FROM table a in schema b
View 11 Replies
View Related
Aug 17, 2012
One of my Customer had followed the document applied pertaining to mitigate against vulnerability CVE-2012-3132.
New Document Mitigation steps for CVE-2012-3132 [ID 1482694.1]
This was applied to a database and it stopped the 'password' command from succeeding in SQLPLUS. Once the trigger was disabled, it worked fine.
ORA-00604: error occurred at recursive SQL level 1
ORA-06531: Reference to uninitialized collection
ORA-06512: at "SYS.NAME_SECURITY", line 165
ORA-06512: at line 2
Why is this behavior seen? By the way, he was able to change the password using TOAD. Only sqlplus is the issue.
View 2 Replies
View Related
Oct 22, 2013
I am using the following code in Java Script function
function notNull(object){ if(object.value=="") alert('This field must contain a value.'); }
I am then calling the function from one of the page item under HTML Form Element Attributes by using the following
onblur="notNull(this);"
But it doesn't seem to work. I am using APEX 4.2.3
View 3 Replies
View Related
Jan 28, 2013
how to create the trigger that count the last 7 day about from sale table if the last 7 day amount is greater then 10000 then update the commission 2% other wise do nothing
View 19 Replies
View Related
May 9, 2013
I cant create a trigger for the following problem "write a trigger to change the "hiredate"(in emp tale) in the default format even if the user enters it in some other format, say year/mon/date..."
View 7 Replies
View Related
Aug 13, 2010
Create a trigger that stamps the date_created and the date_updated column with current date on new and updated records?
View 2 Replies
View Related
Apr 16, 2010
How do I create a trigger for the age. I want an alert to appear when the date of birth field is less than the age of 17. The formula is age=sysdate-dateofbirth
View 11 Replies
View Related
Apr 12, 2013
i would like to create a sequence inside a dml trigger. Is it possible? I created a trigger and it is compiled sucessfully.
create or replace trigger tri_update_test
after delete on test
declare
pragma autonomous_transaction;
[code]...
trigger created sucessfully.And i try to delete data from the test
delete from test where id=5;
Output:
ERROR at line 1:
ORA-01031: insufficient privileges
ORA-06512: at "SCOTT.TRI_UPDATE_TEST", line 4
ORA-04088: error during execution of trigger 'SCOTT.TRI_UPDATE_TEST'
View 4 Replies
View Related
May 11, 2010
I'm trying to create a trigger and procedure to go along with my DDL. Everything is created just fine, but when I try to execute an update on the table monitored by the trigger I get the following error:
update housing set group_num = 1 where room_num = 10
ERROR at line 1:
ORA-00937: not a single-group group function
ORA-06512: at "YANKEEFAN146.VIOLATION_CHK", line 6
ORA-04088: error during execution of trigger 'YANKEEFAN146.VIOLATION_CHK'
/* DDL */
create table violation_type
(violation_num number(1) primary key,
violation_def varchar2(100) not null)
organization index
tablespace mi257_data;
[code]....
View 9 Replies
View Related
Jun 20, 2012
I'm looking to create an after logon trigger... my question is - can this trigger be created by any user (i.e. other than sys) and - if so - what's required to ensure it fires for EVERY other user that log's on to the database?
View 2 Replies
View Related
Feb 1, 2013
Is it possible to create table using trigger?
I tried but failed...
CREATE OR REPLACE TRIGGER tri1
AFTER UPDATE
ON dept
FOR EACH ROW
declare
pragma AUTONOMOUS_TRANSACTION;
BEGIN
execute immediate 'create table dept_dum as select * from dept';
END;
/
SQL> update dept set deptno=23 where deptno=10;
update dept set deptno=23 where deptno=10
*
ERROR at line 1:
ORA-01031: insufficient privileges
ORA-06512: at "SCOTT.TRI1", line 6
ORA-04088: error during execution of trigger 'SCOTT.TRI1'
I am running this as scott user
My requirement is to
create table as select * from table_name where flag=1
This has to be done parallel for all the tables for which this flag is enabled and by that trigger delete all those rows which were backed up as table.
View 4 Replies
View Related
Mar 1, 2012
I´m having a trouble creating a db package. I´ve changed my job and now i´m working full on DB instead of Forms Developer.
So my trouble is that i want to create some like a global cursor on DB package, i know you can create global variables and use it on all the procedures/function inside the package. But how about cursors?
My problem: I dont´know how to declare into the spec. I don´t know how to use it on body.
My actual
I have the structure below:
PackageSpec:
CREATE OR REPLACE PACKAGE [i]MyPackageName[/i]
IS
CURSOR [i]myGlobalCursor[/i](par1 IN VARCHAR2, par2 IN DATE)(
);
PROCEDURE [i]MyProcedure1[/i](par1 IN VARCHAR2, par2 VARCHAR2);
[code]....
View 13 Replies
View Related
Nov 28, 2011
We have an application is must be connected to our database for specific requirements in our company but this application has a very bug thing as we must write the super DB password "Like HR password as example" clear in some files and these files must be shared so developers can use the HR password to do any action !!! I know that this application is a problem but we have to install
I can do this by creating trigger on each table will restrict DML. As example: if the operating system user is XXX, the trigger restrict the action. But not logic at all to create more than 1000 triggers on schema (This will impact badly on DB performance).
So, i need to create one trigger to fire before doing any DML on all schema tables. As example: If "MMM" the administrator operating system user trying to do insert action, he can do the action. BUT If "DEV" the developer operating system user trying to do insert action, the trigger must fire here to restrict this action.
Be noted also, i need this trigger not depend on any specific tool like Toad as any user can simply rename the exe file for toad then he can pass the trigger. At least, trigger must depend on (Operating system user & Action_type)
View 11 Replies
View Related
Aug 16, 2013
i want to give privilege of create trigger,procedures and functions privileges to a user "A"on the schema "B". how can i do it. i've already given select,insert,update,delete privilege to user "A"
how can user "A" create trigger(etc.) on tables of user "B".
View 1 Replies
View Related
Oct 14, 2010
I Created a form just for testing purpose [Which is i attached]
My Table is TEST0
Structure of table :
---------------------------
NOVARCHAR2(5)
NAME VARCHAR2(10)
FLG VARCHAR2(1)
My Task is When i added a record, e.g if on form, i add name - AAD But its must save on TEST0 Table like this way EMPAAD...means always concate with 'EMP'||:Block.name while saving on database..
I know how to do with front end application, but i want to achieve this task by using trigger on backend databse...how to create a Trigger on backend....i try a one trigger but it give me error- Unable to insert Record...
View 12 Replies
View Related
Jun 12, 2013
I have make a new trigger.Create a trigger that inserting a new job_id MAX_SALARY assigned as the employee's salary more than 80 departmental charges
I have that code, is that correct?
CREATE OR REPLACE
TRIGGER TR27
AFTER INSERT ON JOBS FOR EACH ROW
BEGIN
(SELECT MAX(SALARY) FROM EMPLOYEES WHERE DEPARMENT_ID=80);
:NEW.MAX_SALARY := :OLD.MAX_SALARY;
END;
What I need to complete it?
View 2 Replies
View Related