Home » Fusion Middleware & Colab Suite » SOA Suite, BPEL and OWSM » Fetching data from base table without trigger
Fetching data from base table without trigger [message #345378] |
Wed, 03 September 2008 04:57  |
suraj_an
Messages: 15 Registered: February 2008
|
Junior Member |
|
|
Hi
I'm not sure which thread to post my query in.
Basically, whenever a new row or an existing row in an Oracle Standard (Base) table, say AAA, is inserted (or updated) with a status X, I need to fetch those records immediately whenever those insertion or updation operations are performed.
This can ideally be done using triggers.
But I need to perform the above without using DB triggers. I do not wish to use triggers on Oracle base tables.
I want to know if there is an alternate method of fetching these records.
One more thing. These records after being fetched must be passed on to a BPEL process. I thought of using BPEL to directly poll the table, but it wouldnt work if the volume of data is huge, as it would result in a full table scan.
Thanks a lot.
|
|
|
|
|
|
|
|
|
Re: Fetching data from base table without trigger [message #345404 is a reply to message #345378] |
Wed, 03 September 2008 07:36   |
joy_division
Messages: 4963 Registered: February 2005 Location: East Coast USA
|
Senior Member |
|
|
suraj_an wrote on Wed, 03 September 2008 05:57 |
Basically, whenever a new row or an existing row in an Oracle Standard (Base) table, say AAA, is inserted (or updated) with a status X, I need to fetch those records immediately
|
I don't even think triggers are correct. What does "fetching" a record mean? Triggers do stuff in the background. They cannot display any records back to you. for example, you update 10,000 rows, what do you expect to happen? display those 10,000 records? Cannot be done without another select operation.
|
|
|
|
Re: Fetching data from base table without trigger [message #345417 is a reply to message #345413] |
Wed, 03 September 2008 08:44   |
 |
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
If you don't want to create a trigger on a "base table", perhaps you could use a materialized view instead. Something like this example (fetching changes on the Scott's DEPT table): first, let's create our testing environment:SQL> create materialized view log on dept;
Materialized view log created.
SQL> create materialized view mv_dept
2 refresh fast on commit
3 as select * from dept;
Materialized view created.
SQL> create table log_dept (deptno number, datum date);
Table created.
SQL> create or replace trigger trg_mv_dept
2 after insert or update on mv_dept
3 for each row
4 begin
5 insert into log_dept
6 (deptno, datum)
7 values
8 (:new.deptno, sysdate);
9 end;
10 /
Trigger created.
Here's how the DEPT table looks like at the moment, and what happens when we do some insert and update:SQL> select * from dept;
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NY
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
SQL> insert into dept (deptno, dname, loc)
2 values (80, 'Test 1', 'Some location');
1 row created.
SQL> update dept set
2 loc = 'New York'
3 where deptno = 10;
1 row updated.
SQL> commit;
Commit complete.
SQL> select * from log_dept;
DEPTNO DATUM
---------- -------------------
80 03.09.2008 15:40:26
10 03.09.2008 15:40:26
Another insert, a little bit later:SQL> insert into dept (deptno, dname, loc)
2 values (85, 'CSI', 'Miami');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from log_dept;
DEPTNO DATUM
---------- -------------------
80 03.09.2008 15:40:26
10 03.09.2008 15:40:26
85 03.09.2008 15:41:39
SQL>
As you can see, the LOG_DEPT table contains information about changes which were originally made on the "base table".
How does this sound?
|
|
|
|
|
|
|
Re: Fetching data from base table without trigger [message #426499 is a reply to message #345378] |
Fri, 16 October 2009 00:40  |
idris.ali
Messages: 34 Registered: June 2008 Location: Hyderabad
|
Member |
|
|
Hi,
Oracle Applications has a standard functionality called "Business Events". Though its not available for all entity but you may check to see if it exists for your entity(table).
For Example there is a table hz_parties which can store a Person party or an Organization Party.
Following business events are fired when you perform insert/update on hz_parties table.
oracle.apps.ar.hz.Organization.create
oracle.apps.ar.hz.Organization.update
oracle.apps.ar.hz.Person.create
oracle.apps.ar.hz.Person.update
You can subscribe your plsql(or any other) code to the business event in Work flow responsibility and make plsql code instantiate BPEL.
Or make your bpel read the AQ WF_DEFERRED (which stores the Business events as CORRID "APPS:<bussiness event>"
NOTE : Business events are raised only when you create/update
record in base table using standard oracle API.
Idris
|
|
|
Goto Forum:
Current Time: Sun May 04 17:33:59 CDT 2025
|