How to write Coloumn level Trigger
sir,
using ORACLE9i..
i want a sample code to write a coloumn level triger.plz help me in this rgard.
thanks in advance.
Repeated thread:
how to write Coloumn level Trigger
Similar Messages
-
How To Find Out Table Name At Database Level Trigger
Table Name
How do I will come to know the name of table on which currently DML statement is fired ?
e. g. My current user is SCOTT. So Scott should realize the event of DML Statement fired. Hence my question is how the trigger on User Level is to be written & how to catch the event & table name on which the statement is being executed.
Suppose my table is as follows
Table Name : EMP
EMPNO number
ENAME varchar2(10)
JOB varchar2(9)
MGR number
HIREDATE date
SAL number
COMM number
DEPTNO number
Bcd number
Brcd number
Rec_id number
Scn_no number
Sequences for above table
1. EMP_REC_ID - minimum value is 1 increment by 1 & max value is unlimited
2. EMP_SCN_NO - minimum value is 1 increment by 1 & max value is unlimited
I have written a trigger as follows :
CREATE OR REPLACE TRIGGER UPD_EMP_REC_SCN BEFORE INSERT OR UPDATE OR DELETE ON EMP REFERENCING NEW AS NEW OLD AS OLD FOR EACH ROW
DECLARE
BEGIN
IF (INSERTING) THEN
SELECT EMP_REC_ID.NEXTVAL INTO :NEW.REC_ID FROM DUAL;
ELSIF (UPDATING) THEN
SELECT EMP_SCN_NO.NEXTVAL INTO :NEW.SCN_NO FROM DUAL;
ELSIF (DELETING) THEN
INSERT INTO DELETED_ROWS (TAB_NAME, BCD, BRCD, REC_ID)
VALUES (‘EMP’, :OLD.BCD, :OLD.BRCD, :OLD.REC_ID);
END IF;
END;
Hence My problem is
If my database user contains 800 tables then I have to write down 800 triggers (i.e. for each table).
I want to write only one trigger at database level so that I can dynamically take actions, for this I need table name and the event on which the dml event has taken place.
Any help in this matter will be greatly appreceiated.
Regards
VikrantYou cannot write a single trigger that applies to multiple tables. If you need a trigger for every table, you will need to generate 800 triggers.
Rather than manually generating 800 triggers, you might write a code generator that generates triggers for each of the tables by querying the data dictionary (i.e. DBA_TABLES, DBA_TAB_COLS, etc).
Justin -
How to Write a trigger to hold session data
Hi Everyone,
There are 4 Weblogic Servers which are connected to the database concurrently. In the database I have Application Users table "USERS". When a user is logged to the application let us say userA(from "USERS" table) is logged into the application, whenever that same userA logged into the application from other Weblogic server(other system) it should not allow to login into the application. Is it possible to write a trigger for this. If possible, Can any body suggest how to write a trigger to hold that UserA data into one temporary table as long as that userA is active and removes the data from temporary table when userA logged off (OR) as well as that Weblogic server is goes down.
Thanks in advance.Hi Justin,
First Thank you very much to all of you.
1. Yes Application Users are authenticated only once,
that to at the time of login to the Application.
2. We are not running any script that informing the
message like "connections
from the downed server should be reset". Do you
you think is it suggestable.
It's not mandatory to use triggers only.Can we
achieve this by maintaining any temporary table.
I have one idea is that, Lets create a table name
e "App_Users_Session_Data(User_Id,Is_Active)"
If "User A" logins into the application then User_Id
= 1A and Is_Active = 'T' will be entered
automatically into the table
"App_Users_Session_Data". When same "UserA" logins
from other Weblogic Server then Application first
check this table and informing that "UserA" already
logins and is active.
Whenever "UserA" loggsoff then this entry will be
automatically deleted.
My doubt is "UserA" logins successfully into the
application and corresponding user entry is there in
"App_Users_Session_Data". If Weblogic Server goes
down from where this UserA logins, This entry will
not be deleted. If this entry is still there then the
same UserA should not login into the application from
the same Weblogic server(which is up again). My doubt
is how to remove this entry automatically when
Weblogic server goes down. Can we achieve this by any
other way. If possible can u give some guidelines
thats enough for me.
Thank you everyone
SankarHi,
First off all and as I undeerstood you can change your application.
1- A table say weblogic_servers have to be created:
Several scenarios are possibles. If you want you can have a row per weblogic server in this table with what you want as identifier. Any way this table can have a column (sid for example) which identifies the weblogic database session. This can be managed by logon and logoff triggers for the related database user. The logoff trigger for example deletes all lines in App_users_Sessions_Data (see below) related to the same session as the weblogic server and puts the session sid in weblogic_servers to NULL.
2- Change the table App_Users_Session_Data:
You have to add a column (sid for example) linking the app user to the database session of the weblogic server. When a user connects, you can check if the databse session is always there and decide accordingly.
A good idea in my opinion is to centralize your logic by putting it in an INSERT trigger on App_Users_Session_Data. -
How can we disable Block Level Trigge using Form Personalization
Hi,
I want to disable block level trigger(WHEN-NEW-RECORD-INSTANCE) using forms personalization at responsibility level.
Can any one please give me the answer.
it's urgent
Thanks and Regards,
DhanaNo, Firefox is user choice rules over the "wants" of individual websites as far as disabling contextual menus and the keyboard commands.
Placing a transparent image over the image will keep the less technical user from saving the main image. If they do try to save it all they'll get is the transparent image overlay. -
How to find the level of each child table in a relational model?
Earthlings,
I need your help and I know that, 'yes, we can change'. Change this thread to a answered question.
So: How to find the level of each child table in a relational model?
I have a relacional database (9.2), all right?!
O /* This is a child who makes N references to each of the follow N parent tables (here: three), and so on. */
/↑\ Fks
O"O O" <-- level 2 for first table (circle)
/↑\ Fks
"o"o"o" <-- level 1 for middle table (circle)
↑ Fk
"º"Tips:
- each circle represents a table;
- red tables no have foreign key
- the table in first line of tree, for example, has level 3, but when 3 becomes N? How much is N? This's the question.
I started thinking about the following:
First I have to know how to take the children:
select distinct child.table_name child
from all_cons_columns father
join all_cons_columns child
using (owner, position)
join (select child.owner,
child.constraint_name fk,
child.table_name child,
child.r_constraint_name pk,
father.table_name father
from all_constraints father, all_constraints child
where child.r_owner = father.owner
and child.r_constraint_name = father.constraint_name
and father.constraint_type in ('P', 'U')
and child.constraint_type = 'R'
and child.owner = 'OWNER') aux
using (owner)
where child.constraint_name = aux.fk
and child.table_name = aux.child
and father.constraint_name = aux.pk
and father.table_name = aux.father;Thinking...
Let's Share!
My thanks in advance,
Philips
Edited by: BluShadow on 01-Apr-2011 15:08
formatted the code and the hierarchy for readbilityJustin,
Understood.
Nocycle not work in 9.2 and, even that would work, would not be appropriate.
With your help, I decided a much simpler way (but there is still a small problem, <font color=red>IN RED</font>):
-- 1
declare
type udt_roles is table of varchar2(30) index by pls_integer;
cRoles udt_roles;
begin
execute immediate 'create user philips
identified by philips';
select granted_role bulk collect
into cRoles
from user_role_privs
where username = user;
for i in cRoles.first .. cRoles.count loop
execute immediate 'grant ' || cRoles(i) || ' to philips';
end loop;
end;
-- 2
create table philips.root1(root1_id number,
constraint root1_id_pk primary key(root1_id)
enable);
grant all on philips.root1 to philips;
create or replace trigger philips.tgr_root1
before delete or insert or update on philips.root1
begin
null;
end;
create table philips.root2(root2_id number,
constraint root2_id_pk primary key(root2_id)
enable);
grant all on philips.root2 to philips;
create or replace trigger philips.tgr_root2
before delete or insert or update on philips.root2
begin
null;
end;
create table philips.node1(node1_id number,
root1_id number,
node2_id number,
node4_id number,
constraint node1_id_pk primary key(node1_id)
enable,
constraint n1_r1_id_fk foreign key(root1_id)
references philips.root1(root1_id) enable,
constraint n1_n2_id_fk foreign key(node2_id)
references philips.node2(node2_id) enable,
constraint n1_n4_id_fk foreign key(node4_id)
references philips.node4(node4_id) enable);
grant all on philips.node1 to philips;
create or replace trigger philips.tgr_node1
before delete or insert or update on philips.node1
begin
null;
end;
create table philips.node2(node2_id number,
root1_id number,
node3_id number,
constraint node2_id_pk primary key(node2_id)
enable,
constraint n2_r1_id_fk foreign key(root1_id)
references philips.root1(root1_id) enable,
constraint n2_n3_id_fk foreign key(node3_id)
references philips.node3(node3_id) enable);
grant all on philips.node2 to philips;
create or replace trigger philips.tgr_node2
before delete or insert or update on philips.node2
begin
null;
end;
create table philips.node3(node3_id number,
root2_id number,
constraint node3_id_pk primary key(node3_id)
enable,
constraint n3_r2_id_fk foreign key(root2_id)
references philips.root2(root2_id) enable);
grant all on philips.node3 to philips;
create or replace trigger philips.tgr_node3
before delete or insert or update on philips.node3
begin
null;
end;
create table philips.node4(node4_id number,
node2_id number,
constraint node4_id_pk primary key(node4_id)
enable,
constraint n4_n2_id_fk foreign key(node2_id)
references philips.node2(node2_id) enable);
grant all on philips.node4 to philips;
create or replace trigger philips.tgr_node4
before delete or insert or update on philips.node4
begin
null;
end;
-- out of the relational model
create table philips.node5(node5_id number,
constraint node5_id_pk primary key(node5_id)
enable);
grant all on philips.node5 to philips;
create or replace trigger philips.tgr_node5
before delete or insert or update on philips.node5
begin
null;
end;
-- 3
create table philips.dictionary(table_name varchar2(30));
insert into philips.dictionary values ('ROOT1');
insert into philips.dictionary values ('ROOT2');
insert into philips.dictionary values ('NODE1');
insert into philips.dictionary values ('NODE2');
insert into philips.dictionary values ('NODE3');
insert into philips.dictionary values ('NODE4');
insert into philips.dictionary values ('NODE5');
--4
create or replace package body philips.pck_restore_philips as
procedure sp_select_tables is
aExportTablesPhilips utl_file.file_type := null; -- file to write DDL of tables
aExportReferencesPhilips utl_file.file_type := null; -- file to write DDL of references
aExportIndexesPhilips utl_file.file_type := null; -- file to write DDL of indexes
aExportGrantsPhilips utl_file.file_type := null; -- file to write DDL of grants
aExportTriggersPhilips utl_file.file_type := null; -- file to write DDL of triggers
sDirectory varchar2(100) := '/app/oracle/admin/tace/utlfile'; -- directory \\bmduhom01or02
cTables udt_tables; -- collection to store table names for the relational depth
begin
-- omits all referential constraints:
dbms_metadata.set_transform_param(dbms_metadata.session_transform, 'REF_CONSTRAINTS', false);
-- omits segment attributes (physical attributes, storage attributes, tablespace, logging):
dbms_metadata.set_transform_param(dbms_metadata.session_transform, 'SEGMENT_ATTRIBUTES', false);
-- append a SQL terminator (; or /) to each DDL statement:
dbms_metadata.set_transform_param(dbms_metadata.session_transform, 'SQLTERMINATOR', true);
-- create/open files for export DDL:
aExportTablesPhilips := utl_file.fopen(sDirectory, 'DDLTablesPhilips.pdc', 'w', 32767);
aExportReferencesPhilips := utl_file.fopen(sDirectory, 'DDLReferencesPhilips.pdc', 'w', 32767);
aExportIndexesPhilips := utl_file.fopen(sDirectory, 'DDLIndexesPhilips.pdc', 'w', 32767);
aExportGrantsPhilips := utl_file.fopen(sDirectory, 'DDLGrantsPhilips.pdc', 'w', 32767);
aExportTriggersPhilips := utl_file.fopen(sDirectory, 'DDLTriggersPhilips.pdc', 'w', 32767);
select d.table_name bulk collect
into cTables -- collection with the names of tables in the schema philips
from all_tables t, philips.dictionary d
where owner = 'PHILIPS'
and t.table_name = d.table_name;
-- execution
sp_seeks_ddl(aExportTablesPhilips,
aExportReferencesPhilips,
aExportIndexesPhilips,
aExportGrantsPhilips,
aExportTriggersPhilips,
cTables);
-- closes all files
utl_file.fclose_all;
end sp_select_tables;
procedure sp_seeks_ddl(aExportTablesPhilips in utl_file.file_type,
aExportReferencesPhilips in utl_file.file_type,
aExportIndexesPhilips in utl_file.file_type,
aExportGrantsPhilips in utl_file.file_type,
aExportTriggersPhilips in utl_file.file_type,
cTables in out nocopy udt_tables) is
cDDL clob := null; -- colletion to save DDL
plIndex pls_integer := null;
sTableName varchar(30) := null;
begin
for i in cTables.first .. cTables.count loop
plIndex := i;
sTableName := cTables(plIndex);
* Retrieves the DDL and the dependent DDL into cDDL clob *
* for the selected table in the collection, and writes to file.*
begin
cDDL := dbms_metadata.get_ddl('TABLE', sTableName, 'PHILIPS');
sp_writes_ddl(aExportTablesPHILIPS, cDDL);
exception
when dbms_metadata.object_not_found then
null;
end;
begin
cDDL := dbms_metadata.get_dependent_ddl('REF_CONSTRAINT', sTableName, 'PHILIPS');
sp_writes_ddl(aExportReferencesPhilips, cDDL);
exception
when dbms_metadata.object_not_found2 then
null;
end;
begin
cDDL := dbms_metadata.get_dependent_ddl('INDEX', sTableName, 'PHILIPS');
sp_writes_ddl(aExportIndexesPhilips, cDDL);
exception
when dbms_metadata.object_not_found2 then
null;
end;
begin
cDDL := dbms_metadata.get_dependent_ddl('OBJECT_GRANT', sTableName, 'PHILIPS');
sp_writes_ddl(aExportGrantsPhilips, cDDL);
exception
when dbms_metadata.object_not_found2 then
null;
end;
begin
cDDL := dbms_metadata.get_dependent_ddl('TRIGGER', sTableName, 'PHILIPS');
sp_writes_ddl(aExportTriggersPhilips, cDDL);
exception
when dbms_metadata.object_not_found2 then
null;
end;
end loop;
end sp_seeks_ddl;
procedure sp_writes_ddl(aExport in utl_file.file_type,
cDDL in out nocopy clob) is
pLengthDDL pls_integer := length(cDDL);
plQuotient pls_integer := null;
plRemainder pls_integer := null;
begin
* Register variables to control the amount of lines needed *
* for each DDL and the remaining characters to the last row. *
select trunc(pLengthDDL / 32766), mod(pLengthDDL, 32766)
into plQuotient, plRemainder
from dual;
* Join DDL in the export file. *
* ps. 32766 characters + 1 character for each line break. *
-- if the size of the DDL is greater than or equal to limit the line ...
if plQuotient >= 1 then
-- loops for substring (lines of 32766 characters + 1 break character):
for i in 1 .. plQuotient loop
utl_file.put_line(aExport, substr(cDDL, 1, 32766));
-- removes the last line, of clob, recorded in the buffer:
cDDL := substr(cDDL, 32767, length(cDDL) - 32766);
end loop;
end if;
* If any remains or the number of characters is less than the threshold (quotient = 0), *
* no need to substring. *
if plRemainder > 0 then
utl_file.put_line(aExport, cDDL);
end if;
-- record DDL buffered in the export file:
utl_file.fflush(aExport);
end sp_writes_ddl;
begin
-- executes main procedure:
sp_select_tables;
end pck_restore_philips;<font color="red">The problem is that I still have ...
When creating the primary key index is created and this is repeated in the file indexes.
How to avoid?</font> -
How to write driver programming in smartforms
hi Floks
<i>how to write driver programmig and how many types of driver programs available to trigger smartforms what are they . how to call the url in smartforms ?
help me out .thanking you ,</i>
with regards,
sureshHi
Try to get the Function module name from the smart form
how to find Driver program for a smartform
and now goto SE38 and create a progarm for calling the smartform
smartform driver program
Regards
Kathirve -
How can i creat a trigger error invalid trigger specification
i have a stored procedure which i want it to be triggered when an insertion is done on table A
and that stored procedure accepts values from the insertion performed in table A
and inserts into Table B by either updating the table or insertion into Table B
how can i achieve this
OK fine i have a table called Table A
i want a trigger that can accept values such as
create or replace trigger UpdateMyDoc after insert on Table A
for each row
accoutntno varchar2,
ID varchar2
As
cnt number;
Begin
update Table B value (accoutntno ,ID ); commit;
end ;
is the above possible if it is then i get this [1]: (Error): ORA-04079: invalid trigger specification
any help
Edited by: kama021 on Aug 13, 2009 2:24 AMStop right there, Kama.
update Table B value (accoutntno ,ID ); commit;Do not go any further on triggers, until you at least know how to write an UPDATE
Or is it INSERT
Once you have that in place, carry on by reading a bit about Transactions
Regards
Peter -
How to write the exceptions in function module
dear all,
how to write the exceptions in function modules with example.
thanq
jyothiHi,
Raising Exceptions
There are two ABAP statements for raising exceptions. They can only be used in function modules:
RAISE except.
und
MESSAGE.....RAISING except.
The effect of these statements depends on whether the calling program handles the exception or not. The calling program handles an exception If the name of the except exception or OTHERS is specified after the EXCEPTION option of the CALL FUNCTION statement.
If the calling program does not handle the exception
· The RAISEstatement terminates the program and switches to debugging mode.
· The MESSAGE..... RAISING statement displays the specified message. Processing is continued in relation to the message type.
If the calling program handles the exception, both statements return control to the program. No values are transferred. The MESSAGE..... RAISING statement does not display a message. Instead, it fills the system fields sy-msgid, sy-msgty, sy-msgno , and SY-MSGV1 to SY-MSGV4.
Source Code of READ_SPFLI_INTO_TABLE
The entire source code of READ_SPFLI_INTO_TABLE looks like this:
FUNCTION read_spfli_into_table.
""Local Interface:
*" IMPORTING
*" VALUE(ID) LIKE SPFLI-CARRID DEFAULT 'LH '
*" EXPORTING
*" VALUE(ITAB) TYPE SPFLI_TAB
*" EXCEPTIONS
*" NOT_FOUND
SELECT * FROM spfli INTO TABLE itab WHERE carrid = id.
IF sy-subrc NE 0.
MESSAGE e007(at) RAISING not_found.
ENDIF.
ENDFUNCTION.
The function module reads all of the data from the database table SPFLI where the key field CARRID is equal to the import parameter ID and places the entries that it finds into the internal table spfli_tab. If it cannot find any entries, the exception NOT_FOUND is triggered with MESSAGE ... RAISING. Otherwise, the table is passed to the caller as an exporting parameter.
Calling READ_SPFLI_INTO_TABLE
The following program calls the function module READ_SPFLI_INTO_TABLE:
REPORT demo_mod_tech_fb_read_spfli.
PARAMETERS carrier TYPE s_carr_id.
DATA: jtab TYPE spfli_tab,
wa LIKE LINE OF jtab.
CALL FUNCTION 'READ_SPFLI_INTO_TABLE'
EXPORTING
id = carrier
IMPORTING
itab = jtab
EXCEPTIONS
not_found = 1
OTHERS = 2.
CASE sy-subrc.
WHEN 1.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno.
WHEN 2.
MESSAGE e702(at).
ENDCASE.
LOOP AT jtab INTO wa.
WRITE: / wa-carrid, wa-connid, wa-cityfrom, wa-cityto.
ENDLOOP.
The actual parameters carrier and jtab have the same data types as their corresponding interface parameters in the function module. The exception NOT_FOUND is handled in the program. It displays the same message that the function module would have displayed had it handled the error.
Or
just have to decide what exceptions u want and under what conditions.
then declarethese exeptions under the exceptions tab.
in the source code of ur function module.
if
like this u can code .
now when u call the function module in tme mainprogram.
if some error occurs and u have declared a exception for this then it will set sy-subrc = value u give inthe call of this fm.
in the fm u can program these sy-subrc values and trigger the code for ur exception.
Please reward if useful
Regards,
Ravi
Edited by: Ravikanth Alapati on Mar 27, 2008 9:36 AM -
How to implement row level security?
Hi all,
There is a database which is for 3 companies to use it and how to use row level security to make sure that they can only manipluate their own data? For example, "employee" table, for each company they just can see their own employees information. How to use dynamic view to do it?
Many Thanks
AmyHere are two options to achieve what you want.
A. You can do this by coding, that's if you are ready to. Are you? If yes then try the steps below:
1. create a security codes table. Say for example
001 - company a
002 - company b
2. create a security table that will list all users and which company they should have access to. You can also implement this by roles.
3. alter all tables in the application schema to add a security code column. This will be a foreign key reference to table created in 1 above.
4. update all data in the tables according to which company they belong to.
5. write a procedure or package that does a validity check whenever a user requests for data. This procedure/package determines which company data the user has access/rights to.
With this, you should be able to achieve what you want if you do not want to spend on VPD and FGAC. The problem comes where there are users who would have cross access to data from both companies. In this regard, then you have to modify your security table a little bit to handle this.
B. This option i will admit is not so clean. You can also achieve this by two different views for every table in the application schema. And on each of these views, create a private synonym for every user. For illustration purposes:
Table name = Employee.
Create a view employee_a on employee
create a view employee_b on employee
Let's say you have users x and y. X has access to employees of company a and y has access to employees of company b. You can now create private synonyms for each of these users as follows:
create synonym employee on employee_a in x schema.
create synonym employee on employee_b on y schema.
This i have not tried but believe should work.
Hope one of these options serve your purpose. -
Info package Routine - How to write
Hi ,
Can any body give me the step step by process on how to write Info package routine. Actually my requirement is to load the current month Data automatically through infopackge . I can write the ABAP code , but i am told to write in Infopackage level.
Thanks in advance..Hi,
In our case we had a requirement to load the data for the transactions occuring in the last 15 days only, so we have write the routine on the last modified date feild in the infopackage.so as to select only records modified or created in the last 15 days..
attached is the sample code....
data: l_idx like sy-tabix.
read table l_t_range with key
fieldname = 'LAST_MODIFIED_DA'.
l_idx = sy-tabix.
data : w_cdate type d .
l_idx = sy-tabix.
w_cdate = sy-datum.
w_cdate = w_cdate - 15 .
L_t_RANGE-LOW = w_cdate .
L_t_RANGE-HIGH = sy-datum .
L_t_RANGE-SIGN = 'I'.
L_t_RANGE-OPTION = 'BT'.
append l_t_range.
modify l_t_range index l_idx.
p_subrc = 0.
Hope it helps...
Regards,
Umesh. -
Statement level trigger!!!!
Hi Gurus,
I have an issue here. I am inserting multiple rows in a table say A. so I wrote an after insert trigger for each row referencing new as new and old as old on table A. This trigger when fired inserts rows in table B.
These rows are selected from say table C by using the :new.column (one of the coulmns that are about to be inserted in tableA) of table A as parameter and then inserted into table B. But I want that trigger to fire only once though I am inserting multiple rows.
For this purpose I took out the "for each row and referencing new as new and old as old statements" to make it statement level trigger but in this case I am unable to use the :new.column of table A as parameters. Can anyone please suggest how to read the rows in statement level trigger that are being inserted in table A and pass them as parameters to select the values from table C and again insert them in table B. I know it is kinda confusing. Any suggestions...... Thanks in advance!!!!!Hi warren,
Thnx for ur response. here is the code
CREATE OR REPLACE TRIGGER ALPHA_AIR
AFTER INSERT
ON ALPHA
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
l_source varchar2(10);
l_amount number;
l_comments varchar2(50);
BEGIN
SELECT b_source,
b_amount,
b_comments
INTO l_source,
l_amount,
l_comments
FROM BETA
WHERE beta_id=:new.alpha_id:
INSERT INTO GAMMA
( g_source,
g_amount,
g_comments,
date )
VALUES (
l_source,
l_amount,
l_comments,
sysdate);
END;
The trigger is on table ALPHA and it selects data from BETA using :new.alpha_id as parameter. But for multiple rows inserted in table ALPHA, multiple times rows are inserted in table GAMMA. So I made it statement level trigger but I cannot pass :new.alpha_id as parameter in the select statement. Is there any way to do this. Hope it makes sense. -
Capturing value in after insert or update row level trigger
Hi Experts,
I'm working on EBS 11.5.10 and database 11g. I have trigger-A on wip_discrete_jobs table and trigger-B on wip_requirement_operations table.When ever i create discrete job, it inserts record in both wip_discrete_jobs and wip_requirement_operations.
Note:2 tables are like master-child relation.
Trigger-A: After Insert.Row Level trigger on wip_discrete_jobs
Trigger-B:After Insert,Row Level trigger on wip_requirement_operations
In Trigger A:
I'm capturing wip_entity_id and holding in global variable.
package.variable:=:new.wip_entity_id
In Trigger B:
I'm using the above global variable.
Issue: Let's say i have create discrete job,it's wip_entity_id is 27, but the global variable is holding the previous wip_entity_id(26),not current value.It looks like before trigger A event is complete, trigger B is also in process, i think this could be the reason it's not storing the current wip_entity_id in the global variable.
I need your help how to have the current value in the global variable so that i can use that in the trigger B.
Awaiting response at the earliest.
Thanks798616 wrote:
Hi Experts,
I'm working on EBS 11.5.10 and database 11g. I have trigger-A on wip_discrete_jobs table and trigger-B on wip_requirement_operations table.When ever i create discrete job, it inserts record in both wip_discrete_jobs and wip_requirement_operations.
Note:2 tables are like master-child relation.
Trigger-A: After Insert.Row Level trigger on wip_discrete_jobs
Trigger-B:After Insert,Row Level trigger on wip_requirement_operations
In Trigger A:
I'm capturing wip_entity_id and holding in global variable.
package.variable:=:new.wip_entity_id
In Trigger B:
I'm using the above global variable.
Issue: Let's say i have create discrete job,it's wip_entity_id is 27, but the global variable is holding the previous wip_entity_id(26),not current value.It looks like before trigger A event is complete, trigger B is also in process, i think this could be the reason it's not storing the current wip_entity_id in the global variable.
I need your help how to have the current value in the global variable so that i can use that in the trigger B.
Awaiting response at the earliest.
ThanksMy head hurts just thinking about how this is being implemented.
What's stopping you from creating a nice and simple procedure to perform all this magic?
Continue with the global/trigger magic at your own peril, as you can hopefully already see ... nothing good will come from it.
Cheers, -
i created one table rk with 8 columns and that i designed in forms.
but i have another table grk with 4 columns.
this grk contains data.
this grk 4 columns data i have to retrive in rk table in froms by multiple records.
the both column names are same in the both tables.
because by seeing this 4 columns data i will insert remaining 4 column by entering in rk table in form.
i known that i have to write cursor to retrive the 4 columns data for multiple record from grk table and in trigger i have to produce to rk table.
i have worked but it is not working.
can any body help me out how to write a cursor for 4 column to retrive multple records in formHi,
Try,
DECLARE
CURSOR Cur_Test IS SELECT <field_1>, <field_2>, <field_3>, ... <field_n> FROM <table_name> WHERE <condition>;
BEGIN
OPEN Cur_Test;
LOOP
FETCH Cur_Test INTO <items_or_variables>;
EXIT WHEN Cur_Test%NOTFOUND;
END LOOP;
CLOSE Cur_Test;
END;Regards,
Manu. -
How to write XML with attributes to a table in Oracle?
I tried to find solutions over the internet. Some of the stuff I looked at:https://forums.oracle.com/thread/2182669 http://www.club-oracle.com/forums/how-to-insert-data-from-xml-to-table-t2845/
In all these cases, the solution considers XML structure with only nodes and child nodes but not attributes. In fact, one of the solutions suggests transforming the XML into a canonical form with only nodes w/o attributes.
This is a sample of xml structure I am working with:
Sample XML
<rep type="P" title="P List"> <as> <a id="3" /> <a id="4" /> </as> </rep>
I am working with oracle client 11.2 and SQL developer
My question is: how to write XML data into a table with attributes also as column values, beside the nodes?My question is: how to write XML data into a table with attributes also as column values, beside the nodes
The question you should be asking is : "how do I access attributes in the XPath language?"
and the answer to that is easily found in any XPath tutorial you may find over the Internet, it is not related to Oracle in particular.
Short answer : you use an "attribute::" axis before the attribute name, or more commonly a "@", e.g. @type, @id etc.
Using the method described in the first link, something like this will extract the root attributes :
SELECT x.*
FROM XMLTable(
'/rep'
passing <xmltype variable/column goes here>
columns type varchar2(1) path '@type'
, title varchar2(30) path '@title'
) x ;
For deeper levels, use additional XMLTable calls as described in the mentioned post. -
Which planning function i have to use and how to write this planning fucnti
Hi Bi Guru's,
I have rolled out BW SEM-BPS Planning Layout's for the Annual Budget in my organistaion.
There are two levels of layout given for the each sales person.
1) Sales quantity to be entered Material and country wise for all 12 months ( April 2009 to March 2010)
2) Rate per unit and to entered in second sheet, Material and country wise for the total qty entered in the first layout.
Now i need to calculate the sales vlaue for each period and for the each material.
Which planning function i have to use and how to write this planning fucntion.
Please suggest me some solution ASAP.
Thanks in Advance,
NileshHi Deepti,
Sorry to trouble you...
I require your help for the following scenario for caluclating Sales Value.
I have Plan data in the following format.
Country Material Customer Currency Fiscyear Fiscper Qty Rate Sales Value
AZ M0001 CU001 # 2009 001.2009 100.00
AZ M0001 CU002 # 2009 001.2009 200.00
BZ M0001 CU003 # 2009 001.2009 300.00
BZ M0001 CU003 # 2009 002.2009 400.00
BZ M0002 CU003 # 2009 002.2009 300.00
AZ M0001 # USD 2009 # 10.00
BZ M0001 # USD 2009 # 15.50
BZ M0002 # USD 2009 # 20.00
In the Above data the Rate lines are entered in the Second Layout, Where the user enters on the Country Material Level with 2009 value for FISCYEAR.
I am facing problem with this type of data.
I want to store the sales value for each Material Qty.
Please suggest some solution.
Re
Nilesh
Maybe you are looking for
-
Good mail going to Junk folder -- even Apple mail
I know there are other threads on this, but no one seems to have a resolve for it. Mac OS X 10.6.8 Just got my computer repaired at Apple, new harddrive, new video card. So it's starting anew. However, even my MacBookAir is putting my GOOD MAIL in m
-
How to develop plSQL Packages using jDeveloper
Working in one schema with multiple packages and having multiple programmers all working at the same time with in the schema and packages. How do you all work on maybe the same package at the same time and not walk on each other(save code over each o
-
How do I retroactively tag a photo with a Facebook profile?
I tagged a number of photos before we "friended" on Facebook and would like to connect that profile to her Facebook profile, now that we friended. How do I retroactively get that set up?
-
YOUTube through WiFi on iPhone 3G
I have a problem with watching youtube videos through WiFi. I can watch and download only little part of movie, then i need reload it and marked another part of movie to watch.
-
What about all these files/folders?
* I looked through my Applications and located the following files that do not seem to be applications and perhaps should not be in Applications at all: -Epson LFP Remote Panel empty folder; -Epson Printer Utilities 57kb Alias; -Epson Stylus Pro 3800