'ytd'||To_char(sysdate,'yyyy') in alias [message #431060] |
Sat, 14 November 2009 02:50 |
|
I wants the string and to_char(sysdate,'yyyy')..
i tried like this..am getting an error
SELECT NAME AS 'ytd'||TO_CHAR(SYSDATE,'YYYY')
FROM CTYPES
error
ORA-00923: FROM keyword not found where expected
How can i achieve this ?..
thanks in advamnce
|
|
|
Re: 'ytd'||To_char(sysdate,'yyyy') in alias [message #431061 is a reply to message #431060] |
Sat, 14 November 2009 02:59 |
|
Michel Cadot
Messages: 68718 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Alias must be a constant.
You cannot achieve it in one statement.
Here's an example of what you can do:
SQL> col nm new_value nm
SQL> select 'ytd'||TO_CHAR(SYSDATE,'YYYY') nm from dual;
NM
-------
ytd2009
1 row selected.
SQL> col &nm format a8
SQL> select dummy &nm from dual;
YTD2009
--------
X
1 row selected.
Regards
Michel
[Updated on: Sat, 14 November 2009 02:59] Report message to a moderator
|
|
|