Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Using cursor to query from data dictionary

movilogoJun 30 2010 — edited Jun 30 2010
Hi

I am having a weird problem.

In a procedure, I like to compress some tables

so I wrote a cursor like this:
CURSOR crs IS SELECT OWNER,TABLE_NAME FROM ALL_TABLES WHERE TABLE_NAME LIKE '%ABC';
then I'm opening the cursor in for loop and running
xSql := 'ALTER TABLE ' || X.OWNER || '.' || X.TABLE_NAME || ' MOVE COMPRESS';

EXECUTE IMMEDIATE (xSql);
Now strangely enough, my cursor is not fetching any record at all inside procedure!

But when I run the cursor select statement of its own in SqlPlus, it does fetch lots of record!

So, what's wrong??

Edited by: movilogo on Jun 30, 2010 9:25 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 28 2010
Added on Jun 30 2010
6 comments
1,012 views