I have a select statement which may or may not return more than 1 row
select col_nm , col_val into returned_col_nm,returned_col_val from tbl
If the above SQL Statement returns only 1 row then select x , y , z from tbl2 where returned_col_nm = returned_col_val Else If the above SQL Statement returns more than 1 row select x , y ,z from tbl2 where returned_col_nm = returned_col_val and returned_col_nm_2nd_record = returned_col_val_2nd_record and returned_col_nm_3rd_record = returned_col_val_2nd_record .......so on
basically i have to append a "And Clause " dynamically if the count of records in my 1st query is more than 1.
Please let me know if this is achievable in Teradata and how ?