EDP_EDP_EXTERNAL_PLANT_REPORT_U_$RUN_DATE.dat与 SELECT BYTES FROM USER_SEGMENTS WHERE SEGMENT_NAME = 'table_name_bad';与 SELECT NUM_ROWS FROM USER_TABLES WHERE TABLE_NAME = 'table_name_bad'; 及$RUN_DATE 如何将上面语句结果集拼接为复合的SELECT语句并将结果用空格隔开?
时间: 2023-08-03 08:05:31 浏览: 88
nouveau_connector.rar_LVDS EDP_LVDS to EDP_The Power_edp
以下是将上述语句结果集拼接为复合的SELECT语句并将结果用空格隔开的示例代码:
```
SELECT
EDP_EDP_EXTERNAL_PLANT_REPORT_U_$RUN_DATE.dat || ' ' || BYTES || ' ' || NUM_ROWS AS result
FROM
(SELECT
(SELECT COUNT(*) FROM USER_SEGMENTS WHERE SEGMENT_NAME = 'table_name_bad') AS BYTES,
(SELECT NUM_ROWS FROM USER_TABLES WHERE TABLE_NAME = 'table_name_bad') AS NUM_ROWS
FROM
dual)
CROSS JOIN
(SELECT TO_CHAR(SYSDATE, 'YYYYMMDD') AS $RUN_DATE FROM dual);
```
其中,EDP_EDP_EXTERNAL_PLANT_REPORT_U_$RUN_DATE.dat、table_name_bad和$RUN_DATE需要替换为实际的值。
阅读全文