select ( SELECT listagg(column_name,',') within group (order by column_name) FROM user_tab_columns T WHERE table_name = 'INSURANTLISTNEW' AND t.COLUMN_NAME != 'INSURANTNO' and t.COLUMN_NAME != 'CORRECTIONSTATUS' ) from proposal.insurantlistnew p where p.insurantno = 'e53924eed00b4787933674e538057d57'; 怎么做,才能查出对应的列名的值
时间: 2024-01-31 19:02:16 浏览: 62
SELECT column_name(s)
您可以使用以下 SQL 查询来查找对应列名的值```sql
SELECT column_name,
( column_value
FROM proposal.insurantnew p
WHERE p.insurantno = 'e53924eed004787933674e538057d57' AND p.column_name = t.column_name) column_value
FROM user T
WHERE table_name 'INSURANTLISTNEW
AND t.COLUMN != 'INSURANTNO'
AND t.COLUMN_NAME != 'CORRECTIONSTATUS';
```
这个查询会返回一个结果集,其中包含列名和对应的值。请注意,您需要将 `INSURANTLIST` 替换为您实际的表名,以及在 `WHERE` 子句将 `'e53924eed00b4787933674e538057d57'` 替换为您要的具体 `insurantno` 值。
阅读全文