我只想知道是否可以为列分配动态名称。例如:
SQL> select sysdate+1 from dual;
SYSDATE+1
---------
09-JUL-08
列名是SYSDATE + 1。我可以这样做:
SQL> select 1 as (select sysdate from dual) from dual;
(this throws error)
这个要求的原因是我需要根据来自参数的值来分配列名。所以,而不是返回类似的东西:
SQL> select sysdate, sysdate+1 from dual;
SYSDATE SYSDATE+1
--------- ---------
08-JUL-08 09-JUL-08
我需要找到一种方法来返回类似的内容:
SQL> select sysdate as <<dynamic column name based on parameter that has been passed in>>, sysdate+1 AS <<dynamic column name based on parameter that has been passed in>> from dual;
显然我可以使用类似的东西:
select sysdate as "08-JUL-08", sysdate+1 AS "09-JUL-08" from dual;
但在这种情况下,我很难编码。我需要这个别名是动态的。
有什么办法吗?