Go Back   Rhinocerus > Newsgroup > Newsgroup comp.databases.oracle.server

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 11-30-2005, 08:00 AM
saurangshu
Guest
 
Posts: n/a
Default Regarding reading records before a transaction started

Hi Oracle Gurus,

I had a bit peculiar requirement where I need to get the records/values
for a table before the current transaction was started. The situation
is as depicted below -

I have got a table say T1 with a row say R1 at the beginning of the
transaction. Now, our application calls a PL/SQL procedure, which
mutates the row R1 and then in turn calls my procedure P1 in the same
transaction. Inside the procedure P1, I need to know the original value
of the mutated row R1 inside this current transaction context and I
don't have a chance to change our API to pass this information from
the caller procedure.

I solved the problem by calling a function from my PL/SQL procedure,
which starts an autonomous transaction and read the value of R1as it
was before the transaction. This strategy works fine for me. Now, I
want to validate whether there is better way of doing this thing rather
than my approach? And, if there is any pitfall of my approach regarding
performance and scaling of the procedure.

I am using Oracle 10gR2 database for this.

Please post you valuable comments/insight on this approach.

Thanks in advance,

Saurangshu

Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 11-30-2005, 10:56 AM
Frank van Bortel
Guest
 
Posts: n/a
Default Re: Regarding reading records before a transaction started

saurangshu wrote:
> Hi Oracle Gurus,
>
> I had a bit peculiar requirement where I need to get the records/values
> for a table before the current transaction was started. The situation
> is as depicted below -
>
> I have got a table say T1 with a row say R1 at the beginning of the
> transaction. Now, our application calls a PL/SQL procedure, which
> mutates the row R1 and then in turn calls my procedure P1 in the same
> transaction. Inside the procedure P1, I need to know the original value
> of the mutated row R1 inside this current transaction context and I
> don't have a chance to change our API to pass this information from
> the caller procedure.
>
> I solved the problem by calling a function from my PL/SQL procedure,
> which starts an autonomous transaction and read the value of R1as it
> was before the transaction. This strategy works fine for me. Now, I
> want to validate whether there is better way of doing this thing rather
> than my approach? And, if there is any pitfall of my approach regarding
> performance and scaling of the procedure.
>
> I am using Oracle 10gR2 database for this.
>
> Please post you valuable comments/insight on this approach.
>
> Thanks in advance,
>
> Saurangshu
>


You don't need an autonomous transaction for reads.
And, depending on the way you update, why isn't the
old value known withing P0?

--
Regards,
Frank van Bortel

Top-posting is one way to shut me up...
Reply With Quote
  #3 (permalink)  
Old 11-30-2005, 11:53 AM
saurangshu
Guest
 
Posts: n/a
Default Re: Regarding reading records before a transaction started

May be I should elaborate a bit more about what I am doing. As
mentioned earlier, I have the table T1 with row R1 having a column say
C1 pointing to an entity in some other table. Now at the beginning of
the transaction, some procedure say P1 mutates the value of C1 from
value say X to Y. Now, this procedure P1 in turn calls my procedure P2
which wants to know the older value of column C1 (i.e. 'X') to process
some transactions. But, if I try to fire an sql like 'select C1 from
T1' in my procedure P2, then I will always get 'Y' and not 'X".
My problem is to get the value of the column before the current
transaction was started.

Please let me know if I was not clear.

Thanks.
--Saurangshu

Frank van Bortel wrote:
> saurangshu wrote:
> > Hi Oracle Gurus,
> >
> > I had a bit peculiar requirement where I need to get the records/values
> > for a table before the current transaction was started. The situation
> > is as depicted below -
> >
> > I have got a table say T1 with a row say R1 at the beginning of the
> > transaction. Now, our application calls a PL/SQL procedure, which
> > mutates the row R1 and then in turn calls my procedure P1 in the same
> > transaction. Inside the procedure P1, I need to know the original value
> > of the mutated row R1 inside this current transaction context and I
> > don't have a chance to change our API to pass this information from
> > the caller procedure.
> >
> > I solved the problem by calling a function from my PL/SQL procedure,
> > which starts an autonomous transaction and read the value of R1as it
> > was before the transaction. This strategy works fine for me. Now, I
> > want to validate whether there is better way of doing this thing rather
> > than my approach? And, if there is any pitfall of my approach regarding
> > performance and scaling of the procedure.
> >
> > I am using Oracle 10gR2 database for this.
> >
> > Please post you valuable comments/insight on this approach.
> >
> > Thanks in advance,
> >
> > Saurangshu
> >

>
> You don't need an autonomous transaction for reads.
> And, depending on the way you update, why isn't the
> old value known withing P0?
>
> --
> Regards,
> Frank van Bortel
>
> Top-posting is one way to shut me up...


Reply With Quote
  #4 (permalink)  
Old 11-30-2005, 02:09 PM
Jim Kennedy
Guest
 
Posts: n/a
Default Re: Regarding reading records before a transaction started


"saurangshu" <saurangshu@gmail.com> wrote in message
news:1133355228.689033.171600@z14g2000cwz.googlegr oups.com...
> May be I should elaborate a bit more about what I am doing. As
> mentioned earlier, I have the table T1 with row R1 having a column say
> C1 pointing to an entity in some other table. Now at the beginning of
> the transaction, some procedure say P1 mutates the value of C1 from
> value say X to Y. Now, this procedure P1 in turn calls my procedure P2
> which wants to know the older value of column C1 (i.e. 'X') to process
> some transactions. But, if I try to fire an sql like 'select C1 from
> T1' in my procedure P2, then I will always get 'Y' and not 'X".
> My problem is to get the value of the column before the current
> transaction was started.
>
> Please let me know if I was not clear.
>
> Thanks.
> --Saurangshu
>
> Frank van Bortel wrote:
> > saurangshu wrote:
> > > Hi Oracle Gurus,
> > >
> > > I had a bit peculiar requirement where I need to get the

records/values
> > > for a table before the current transaction was started. The situation
> > > is as depicted below -
> > >
> > > I have got a table say T1 with a row say R1 at the beginning of the
> > > transaction. Now, our application calls a PL/SQL procedure, which
> > > mutates the row R1 and then in turn calls my procedure P1 in the same
> > > transaction. Inside the procedure P1, I need to know the original

value
> > > of the mutated row R1 inside this current transaction context and I
> > > don't have a chance to change our API to pass this information from
> > > the caller procedure.
> > >
> > > I solved the problem by calling a function from my PL/SQL procedure,
> > > which starts an autonomous transaction and read the value of R1as it
> > > was before the transaction. This strategy works fine for me. Now, I
> > > want to validate whether there is better way of doing this thing

rather
> > > than my approach? And, if there is any pitfall of my approach

regarding
> > > performance and scaling of the procedure.
> > >
> > > I am using Oracle 10gR2 database for this.
> > >
> > > Please post you valuable comments/insight on this approach.
> > >
> > > Thanks in advance,
> > >
> > > Saurangshu
> > >

> >
> > You don't need an autonomous transaction for reads.
> > And, depending on the way you update, why isn't the
> > old value known withing P0?
> >
> > --
> > Regards,
> > Frank van Bortel
> >
> > Top-posting is one way to shut me up...

>


I use the :new and ld values in a row trigger and pass them to the
procedure.
Jim


Reply With Quote
  #5 (permalink)  
Old 11-30-2005, 02:25 PM
saurangshu
Guest
 
Posts: n/a
Default Re: Regarding reading records before a transaction started

I don't have a trigger on the table as I don't own them and we can't
change the called API signature. Hence, we couldn't use this.

Thanks for the reply.

Reply With Quote
  #6 (permalink)  
Old 11-30-2005, 05:09 PM
Sybrand Bakker
Guest
 
Posts: n/a
Default Re: Regarding reading records before a transaction started

On 30 Nov 2005 07:25:55 -0800, "saurangshu" <saurangshu@gmail.com>
wrote:

>I don't have a trigger on the table as I don't own them and we can't
>change the called API signature. Hence, we couldn't use this.
>
>Thanks for the reply.


Triggers don't need to be owned by the table owner.

--
Sybrand Bakker, Senior Oracle DBA
Reply With Quote
  #7 (permalink)  
Old 11-30-2005, 05:30 PM
saurangshu
Guest
 
Posts: n/a
Default Re: Regarding reading records before a transaction started

True. But, in my case the triggers on tables are not there and the
people are not ready to provide it due to various performance reasons.
Any comments on the current approach particularly from a performance &
scalability stand point?

Any other alternate idea if any?

thanks,

--saurangshu

Reply With Quote
  #8 (permalink)  
Old 11-30-2005, 05:57 PM
Sybrand Bakker
Guest
 
Posts: n/a
Default Re: Regarding reading records before a transaction started

On 30 Nov 2005 10:30:17 -0800, "saurangshu" <saurangshu@gmail.com>
wrote:

>True. But, in my case the triggers on tables are not there and the
>people are not ready to provide it due to various performance reasons.
>Any comments on the current approach particularly from a performance &
>scalability stand point?
>
>Any other alternate idea if any?
>
>thanks,
>
>--saurangshu


So far, you have never provided anything but political cover your ass
answers why a viable approach wasn't possible.
As you are evidently not trying to address the political reasons, the
only choice you have if to learn to live with it, and to get in
writing why you can't change, in order to slam your management in the
face with their signatures, once the app becomes unscalable (which it
obviously will, as you are, if I'm understanding you correctly,
executing fake transactions to get what you want).

--
Sybrand Bakker, Senior Oracle DBA
Reply With Quote
  #9 (permalink)  
Old 11-30-2005, 11:01 PM
Joel Garry
Guest
 
Posts: n/a
Default Re: Regarding reading records before a transaction started

What if two other users change the value of X to Z and W?

jg
--
@home.com is bogus.
"What is that knot in your stomach trying to tell you?
" - part of my horoscope for today.

Reply With Quote
  #10 (permalink)  
Old 11-30-2005, 11:17 PM
xhoster@gmail.com
Guest
 
Posts: n/a
Default Re: Regarding reading records before a transaction started

"Joel Garry" <joel-garry@home.com> wrote:
> What if two other users change the value of X to Z and W?


Then you are not using Oracle.

The "outer" transaction locks the row when it performs the initial update.
Other users trying to update that row will be blocked.

Xho

--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
Reply With Quote
  #11 (permalink)  
Old 12-01-2005, 06:06 PM
Joel Garry
Guest
 
Posts: n/a
Default Re: Regarding reading records before a transaction started


xhoster@gmail.com wrote:
> "Joel Garry" <joel-garry@home.com> wrote:
> > What if two other users change the value of X to Z and W?

>
> Then you are not using Oracle.
>
> The "outer" transaction locks the row when it performs the initial update.
> Other users trying to update that row will be blocked.


Shoot, you are right. I've been corrupted by db-blind apps.

jg
--
@home.com is bogus.
http://www.signonsandiego.com/uniont...1b1patent.html

Reply With Quote
  #12 (permalink)  
Old 12-03-2005, 10:02 AM
saurangshu
Guest
 
Posts: n/a
Default Re: Regarding reading records before a transaction started

Sybrand,

It is not at all correct that I have been playing as a 'political' game
to devise this problem. This is the fact that you can't add triggers or
changes existing PL/SQL api that is getting called. And, the reason for
this is that we are customizing oracle e-business suite and they will
*NOT* support a trigger kind of customization on their base table due
to performance reason. This is the everyday fact & pain for all the
product customization personnel and they have to live with it. If you
have worked on such things you will know otherwise not.
My intent of the post was to judge the merit and demerit of my approach
and to find out a better approach if available (with some solid backing
of facts) in my domain of constraints and it was not to defy 'viable
approaches'.

I will not touch rest of the comment.

Reply With Quote
  #13 (permalink)  
Old 12-03-2005, 02:55 PM
Frank van Bortel
Guest
 
Posts: n/a
Default Re: Regarding reading records before a transaction started

saurangshu wrote:
> Sybrand,
>
> It is not at all correct that I have been playing as a 'political' game
> to devise this problem. This is the fact that you can't add triggers or
> changes existing PL/SQL api that is getting called. And, the reason for
> this is that we are customizing oracle e-business suite and they will
> *NOT* support a trigger kind of customization on their base table due
> to performance reason. This is the everyday fact & pain for all the
> product customization personnel and they have to live with it. If you
> have worked on such things you will know otherwise not.
> My intent of the post was to judge the merit and demerit of my approach
> and to find out a better approach if available (with some solid backing
> of facts) in my domain of constraints and it was not to defy 'viable
> approaches'.
>
> I will not touch rest of the comment.
>

Oh my god - do you think any oracle eBusiness configuration
will actually perform?!?
Of course not - the got the many end on the wrong side (or you have )
--
Regards,
Frank van Bortel

Top-posting is one way to shut me up...
Reply With Quote
  #14 (permalink)  
Old 12-05-2005, 08:56 AM
saurangshu
Guest
 
Posts: n/a
Default Re: Regarding reading records before a transaction started

I know

Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
reading an ascii file with variations in the number of records per observation Dee Newsgroup comp.soft-sys.sas 2 12-14-2006 02:38 PM
Re: Reading unique records Choate, Paul@DDS Newsgroup comp.soft-sys.sas 0 06-20-2006 04:06 PM
Re: Reading unique records Kevin Roland Viel Newsgroup comp.soft-sys.sas 0 06-18-2006 09:31 PM
Re: Reading records that are pointed to by other records Peter Crawford Newsgroup comp.soft-sys.sas 0 03-01-2005 03:31 PM
Reading records that are pointed to by other records Friar Broccoli Newsgroup comp.soft-sys.sas 1 02-28-2005 06:25 PM



All times are GMT. The time now is 03:49 PM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.