Teradata中用单引号表示“值”,双引号表示“字段名”,若要插入带有单引号的记录,需要将单引号改为两个单引号

因此Teradata中批量生成查询语句可这样写。

表A:

ID CLASS SEX AGE
1 1 0 12
2 1 0 12
3 2 1 13

 

 

 

 

 

select distinct 'select ''class1'',id,sex,age from a where class = '''||class||''';'

结果:

select class1,id,sex,age from a where class = '1';

select class1,id,sex,age from a where class = '2';

 

相关文章:

  • 2021-12-04
  • 2021-10-04
  • 2022-02-13
  • 2022-12-23
  • 2021-06-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-06
  • 2022-12-23
  • 2022-12-23
  • 2022-01-16
  • 2021-12-07
  • 2021-07-13
  • 2022-12-23
相关资源
相似解决方案