Do you have an example of a procedure that can retrieve a cache key after a cache refresh?

Do you have an example of a procedure that can retrieve a cache key after a cache refresh?

book

Article ID: KB0082915

calendar_today

Updated On:

Products Versions
TIBCO Data Virtualization 7.0.0 and higher

Description

This article discusses how to retrieve a cache key after a cache refresh.

Issue/Introduction

Do you have an example of a procedure that can retrieve a cache key after a cache refresh?

Resolution

Below is a sample procedure that returns the cache key for a cache refresh on a view. The view uses "/shared/DATABASES/ora_ds_JOE/cache_for_Redwood" as its cache table.
 
PROCEDURE get_the_key()
BEGIN
  DECLARE cacheKey INT;
  declare buffer VARCHAR(15);
  DECLARE result CURSOR for SELECT distinct(cacheKey) from /shared/DATABASES/ora_ds_JOE/cache_for_Redwood;
  open result;
  fetch result into cacheKey;
  set buffer = CAST(cacheKey as VARCHAR);
  whileloop:
  while result.found
  do
       begin
             fetch result into cacheKey;
             set buffer = buffer || ',' || CAST(cacheKey as VARCHAR);
      end;
  end while;
  close result;
  call PRINT( 'The cache key is : ' || CAST(cacheKey as VARCHAR));
/* call PRINT( 'The cache key list is : ' || buffer); */
END
 
If a cache refresh is run on the view and the procedure get_the_key() is executed, the procedure will return the cache key generated by the refresh.

Example
[09:06:26 280] The cache key is : 1008