Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread SELECT NULL
Sun, Nov 30 2008 1:03 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim

Messing around to help Leslie I found

ElevateDB Error #700 An error was found in the statement at line 1 and column 28 (Invalid expression null found, a constant NULL value is not allowed as a SELECT expression)

Why?

I can see a valid use for having constant NULLs in a SELECT especially in CREATE TABLE AS

Roy Lambert
Mon, Dec 1 2008 7:08 AMPermanent Link

"Ole Willy Tuv"
<< ElevateDB Error #700 An error was found in the statement at line 1 and
column 28 (Invalid expression null found, a constant NULL value is not
allowed as a SELECT expression)

Why? >>

Because there's no data type associated with the NULL value (can be any
type).
You need to cast it to the data type you want the SELECT column shall have,
e.g.:

select cast(null as char varying(50)) ...

Ole Willy Tuv
Mon, Dec 1 2008 7:45 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ole


Thanks - that makes sense, even to a null hater.

Roy Lambert
Image