我正在尝试在SELECT语句中创建一个NULL列,但它不起作用:
SELECT mytable. *, NULL as ColumnName
FROM mytable;
错误代码是
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.
所以似乎不可能这样做。有没有选择在SELECT语句中创建NULL列?
谢谢,
答案 0 :(得分:3)
您可以cast()
NULL
添加任何类型的内容:
SELECT t.*, CAST(NULL as VARCHAR2(100)) as ColumnName
FROM mytable t;
注意:您的代码应该像SELECT
一样工作。如果您尝试保存数据,则会出现此问题。