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 > For Read Only

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-11-03, 13:03
vaddadik vaddadik is offline
Registered User
 
Join Date: Oct 2003
Location: Hyderabad, India
Posts: 14
Unhappy For Read Only

Hello Group,
I have couple of errors occuring when i try to add the "FOR READ ONLY" Clause in the SP's As well as in Functions.
Here are the Cases where im getting Compilation Errors
1. select count(1) into var1 from tab1 where <condition> for read only --> when i have this statement in the SP im getting compilation error.
So Can we have For Read only clause in this scenerio Or not?
2. insert into table1 (select * from table2 for read only ) --> Same case as the above.. getting compilation errors. Any Reasons?
3. when i have a "FOR READ ONLY" clause in a SQL statement which is in Function the function is not getting built. Can't we have for read only clause in functions?

I have tested this on Latest DB2 V8.1 Fix pack 3 as well as on older sytems.

Can some one throw some light on the Read Only clauses and its restrictions and if possible could some one share some documentation on the same..

I would be happy if i could help documentation both on SP's i& Functions Creationg in DB2 .

Looking for Early help on this.
Regards,
Krishna
Reply With Quote
  #2 (permalink)  
Old 11-12-03, 08:34
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Krishna,
The FOR READ ONLY clause is only vaild on Select-Statement. In your examples, none are Select-Statements. 1) is a SELECT INTO and 2) is a full-select inside an INSERT. Maybe if you see the grammar for a Select-Statement (see page 601 of the V8 SQL REference Manual Volume 1) it might make more sense.

I do not know why you cannot use it in a function, although I suspect that it is not on a Select-Statement.

HTH

Andy
Reply With Quote
  #3 (permalink)  
Old 11-12-03, 09:05
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
The FOR READ ONLY clause indicates that the result table is read-only and therefore the cursor cannot be referred to in Positioned UPDATE and DELETE statements.

This applies to cursor operations where one may later perform an UPDATE (or DELETE) WHERE CURRENT OF CURSOR (positioned UPDATE and DELETE statements).

I would not worry about it in your situations.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
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