Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 26 Dec 2003 @ 10:54:53 GMT


     
  <Prev Next>  
<<First
<Prev
Next> Last>>  


Subj:   Dynamic SQL in Tera data
 
From:   Sukanya_banik

Hi All,

I have a teradata related problem. I have a table with approx 300 columns. I need to check the following

SELECT count (*) from abc where abc.a = null


The problem is that i have to do this operation for all the columns in the table.

This was easy in Oracle with the help of DD views. Something like

   declare
   cursor cur is
   select column_name from user_tab_columns where table_name ='abc';
   sqlstr varchar2(100);
   temp number;

   begin

   for c in cur
   loop
   sqlstr := 'select count (*) into temp from abc where' c.column_name '=null';
   exec sqlstr;
   dbms_output.put_line 'count = ' temp ;
   end loop;

   end ;

Is this kind of a DD operation supported in Teradata .. ?? Is there some metadata repository in Teradata ?? I want some kind of a script that wud enable me to do this instead of running the query 300 times.

I have found out the Data Dictionary view in Teradata similar to user_tab_columns in Oracle. But in the above script i wud need to use the Dynamic SQL as in Oracle. Is there a similar feature in Teradata ? If yes, then pls let me know how to use it in the abve context. Or if there are any tools to support my task mentioned above.

Pls let me know


Regards

Sukanya.



     
  <Prev Next>  
<<First
<Prev
Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 27 Dec 2016