If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > UR with sub-query ??

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-18-10, 12:53
DBFinder DBFinder is offline
Registered User
 
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
UR with sub-query ??

Friends,

Is there a way to use UR in sub-query ?

Quote:
SELECT msg_id, create_date, admin_id, casino_id, active_start, active_end,

msg_type, msg_content, segment

from Broadcast_Message b

Where CURRENT TIMESTAMP between active_start and active_end and coalesce(cancel,'N') != 'Y'

and 0 = (select count(*) from delivered_message d where acc_num=? and d.msg_id = b.msg_id
with UR)

and (casino_id = ? or segment in (? ,?))

order by active_start

with UR


As seen practically Main with UR does not work for subquery.

Help appreciated.
Reply With Quote
  #2 (permalink)  
Old 06-18-10, 12:58
dav1mo dav1mo is offline
Registered User
 
Join Date: Dec 2007
Location: Richmond, VA
Posts: 782
In a word, NO. Though, why would you need the multiple WITH UR statements? The one at the end of the statement, where it IS allowed, makes the entire statement WITH UR.
Dave
Reply With Quote
  #3 (permalink)  
Old 06-18-10, 13:01
DBFinder DBFinder is offline
Registered User
 
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
Does it ?? with whole.

My experience says NO. that's why. We had locking problem because of that.


Can I query DB2 to find if a select on a table was at what isolation level .
I want to perform a test.

Regards
Reply With Quote
  #4 (permalink)  
Old 06-18-10, 14:34
tonkuma tonkuma is online now
Registered User
 
Join Date: Feb 2008
Location: Japan
Posts: 2,195
You can specify isolation-clause in a subselect on DB2 for LUW 9.7,
by referring to "IBM DB2 9.7 for Linux, UNIX, and Windows SQL Reference, Volume 1".

Here is an example:
Code:
------------------------------ Commands Entered ------------------------------
SELECT empno , workdept
  FROM (SELECT deptno
          FROM department
         WHERE admrdept = 'A00'
        WITH UR
       )
     , employee
 WHERE workdept = deptno
;
------------------------------------------------------------------------------

EMPNO  WORKDEPT
------ --------
000010 A00     
000020 B01     
000030 C01     
000050 E01     
000110 A00     
000120 A00     
000130 C01     
000140 C01     

  8 record(s) selected.
Reply With Quote
  #5 (permalink)  
Old 06-18-10, 14:41
DBFinder DBFinder is offline
Registered User
 
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
Thanks,

I am at DB2V9.5.5 on Win 2K3

Is there a way to find isolation level of a select on a table ?
I want to see whether main with UR also affect subquery or not.

I would like to run the query and would like to know at what isolation level main query ran and same for su-query.


What do I need to set up - event or turn on auditing. I had never needed this befor. Someone might have tried this.



Regards
Reply With Quote
  #6 (permalink)  
Old 06-18-10, 15:06
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Use an event monitor. It will tell you the isolation level of the statements that were executed.

Andy
Reply With Quote
  #7 (permalink)  
Old 06-18-10, 16:04
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Quote:
Originally Posted by DBFinder View Post
I would like to run the query and would like to know at what isolation level main query ran and same for su-query.
Explain plan output usually shows that.
Reply With Quote
  #8 (permalink)  
Old 06-18-10, 16:25
DBFinder DBFinder is offline
Registered User
 
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
Thanks,

Accept my regards, I will do test both ways today.

DBFinder
Reply With Quote
  #9 (permalink)  
Old 06-18-10, 17:59
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
I also think that the one at the end of the statement applies to the entire statement (unless you specify something else at the subquery level)
Reply With Quote
  #10 (permalink)  
Old 06-19-10, 01:07
DBFinder DBFinder is offline
Registered User
 
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
That will make my job easy. However, I was told that it is not working as we all had expected. Our java developers do not usually get satisfied until I do a prctical test on the issue.

I did believe same way ( that it should be applicable to whole query). I will do the test and will post back.

Thanks Bella for your time. Have nice weekend ! How is traffic this weekend !

Regards
DBFinder
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On