Quantcast
Channel: Teradata Forums - All forums
Viewing all articles
Browse latest Browse all 27759

Comparing row count of two tables called by cursor - response (1) by Fred

$
0
0

You need to use "dynamic SQL that returns a result set", something like this:
 
DECLARE SqlStr VARCHAR(1000);
DECLARE C1 CURSOR FOR S1;
SET SqlStr = 'SELECT COUNT(*) FROM '||a||'.'||T_name;
PREPARE S1 FROM SqlStr;
OPEN C1;
FETCH C1 INTO DB_A_CT;
CLOSE C1;
 


Viewing all articles
Browse latest Browse all 27759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>