Unix Technical Forum

Scope of SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

This is a discussion on Scope of SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED within the Sybase forums, part of the Database Server Software category; --> In a Sybase 12 Stored procedure, what is the scope of SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED in the ...


Go Back   Unix Technical Forum > Database Server Software > Sybase

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 06:05 PM
Pat
 
Posts: n/a
Default Scope of SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

In a Sybase 12 Stored procedure, what is the scope of

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

in the following. Does it apply to both of the select statements?

CREATE procedure (@param1 int = NULL,
@param2 int= NULL)
as
BEGIN

IF (@param1 IS NULL) or (@param2 IS NULL)
begin
print 'Parameters not entered correctly!'
return -1
end

begin
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
SELECT * FROM source1 into tempDB.tempTable
INSERT INTO tempDb.tempTable SELECT * from source2
end
end

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 06:05 PM
DBAGAL
 
Posts: n/a
Default Re: Scope of SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

Hi Pat,

Yes, the scope applys to both (and any subsequent queries) after you
issue the "set TRANSACTION ISOLATION LEVEL READ UNCOMMITTED" command.
If you want to limit the scope of the altered transaction isolation
level to a single query then you can issue the query as:

"SELECT * FROM source1 into tempDB.tempTable at isolation read
uncommitted"

Also, be aware that in order for the dirty reads to happen on a table
there must be a unique index on that table.

Hope this help!!

Cheers,

Sara ...

Pat wrote:
> In a Sybase 12 Stored procedure, what is the scope of
>
> SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
>
> in the following. Does it apply to both of the select statements?
>
> CREATE procedure (@param1 int = NULL,
> @param2 int= NULL)
> as
> BEGIN
>
> IF (@param1 IS NULL) or (@param2 IS NULL)
> begin
> print 'Parameters not entered correctly!'
> return -1
> end
>
> begin
> SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
> SELECT * FROM source1 into tempDB.tempTable
> INSERT INTO tempDb.tempTable SELECT * from source2
> end
> end


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-08-2008, 06:05 PM
bret@sybase.com
 
Posts: n/a
Default Re: Scope of SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

I have to disagree here, at least for the ASE product - the READ
UNCOMMITTED cannot apply to a statement doing data modification (i.e.
select into or insert); the statement will be processed at the next
higher isolation level.

-bret

DBAGAL wrote:
> Hi Pat,
>
> Yes, the scope applys to both (and any subsequent queries) after you
> issue the "set TRANSACTION ISOLATION LEVEL READ UNCOMMITTED" command.
> If you want to limit the scope of the altered transaction isolation
> level to a single query then you can issue the query as:
>
> "SELECT * FROM source1 into tempDB.tempTable at isolation read
> uncommitted"
>
> Also, be aware that in order for the dirty reads to happen on a table
> there must be a unique index on that table.
>
> Hope this help!!
>
> Cheers,
>
> Sara ...
>
> Pat wrote:
> > In a Sybase 12 Stored procedure, what is the scope of
> >
> > SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
> >
> > in the following. Does it apply to both of the select statements?
> >
> > CREATE procedure (@param1 int = NULL,
> > @param2 int= NULL)
> > as
> > BEGIN
> >
> > IF (@param1 IS NULL) or (@param2 IS NULL)
> > begin
> > print 'Parameters not entered correctly!'
> > return -1
> > end
> >
> > begin
> > SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
> > SELECT * FROM source1 into tempDB.tempTable
> > INSERT INTO tempDb.tempTable SELECT * from source2
> > end
> > end


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-08-2008, 06:05 PM
DBAGAL
 
Posts: n/a
Default Re: Scope of SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

Thanks Bret ... I missed that caveat in the docs but it makes sense ...

Cheers,

Sara ...

bret@sybase.com wrote:
> I have to disagree here, at least for the ASE product - the READ
> UNCOMMITTED cannot apply to a statement doing data modification (i.e.
> select into or insert); the statement will be processed at the next
> higher isolation level.
>
> -bret
>
> DBAGAL wrote:
> > Hi Pat,
> >
> > Yes, the scope applys to both (and any subsequent queries) after you
> > issue the "set TRANSACTION ISOLATION LEVEL READ UNCOMMITTED" command.
> > If you want to limit the scope of the altered transaction isolation
> > level to a single query then you can issue the query as:
> >
> > "SELECT * FROM source1 into tempDB.tempTable at isolation read
> > uncommitted"
> >
> > Also, be aware that in order for the dirty reads to happen on a table
> > there must be a unique index on that table.
> >
> > Hope this help!!
> >
> > Cheers,
> >
> > Sara ...
> >
> > Pat wrote:
> > > In a Sybase 12 Stored procedure, what is the scope of
> > >
> > > SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
> > >
> > > in the following. Does it apply to both of the select statements?
> > >
> > > CREATE procedure (@param1 int = NULL,
> > > @param2 int= NULL)
> > > as
> > > BEGIN
> > >
> > > IF (@param1 IS NULL) or (@param2 IS NULL)
> > > begin
> > > print 'Parameters not entered correctly!'
> > > return -1
> > > end
> > >
> > > begin
> > > SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
> > > SELECT * FROM source1 into tempDB.tempTable
> > > INSERT INTO tempDb.tempTable SELECT * from source2
> > > end
> > > end


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 01:09 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com