I'm trying to create a NULL column in the SELECT statement but it doesn't work:
SELECT mytable. *, NULL as ColumnName
FROM mytable;
The error code is
Error report -
SQL Error: ORA-01723: zero-length columns are not allowed
01723. 00000 - "zero-length columns are not allowed"
*Cause: Columns with zero length were not allowed.
*Action: Correct the use of the column.
So it seems like it's not possible to do that. Is there any choice to create a NULL column in the SELECT statement?
Thank you,
You can cast()
NULL
to whatever type you want:
SELECT t.*, CAST(NULL as VARCHAR2(100)) as ColumnName
FROM mytable t;
Note: Your code should work just as a SELECT
. The issue comes if you are trying to save the data.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.