What does "Select Distinct Null As xxxxx" mean?
- by Soylent Green
Background: I am mapping Sybase stored procedure return values to java objects using Spring.
For example I map a Sybase datatype of varchar as a String type in Java, and a Sybase datatype of int as an int type in Java, etc.
I have come across the following code in one of the stored procedures:
SELECT DISTINCT
A.Col1 AS val1,
A.Col2 AS val2,
NULL AS someVal,
A.col3 AS val3,
...
A.col9 AS val9
FROM #SomeTable A
ORDER BY Col2, Col3
I have 2 related questions:
What does Null mean in this scenario? I am confused as to what is happening here.
I am able to determine the data type of Col1, Col2, etc. of course by looking at the table definition of Table A defined earlier in the stored procedure. Thus I know what datatype I can define in my Java object for val1, val2, etc.. But what about "someVal"? What datatype mapping am I supposed to perform for this Null value?
I am fairly inexperienced in SQL. Perhaps the answer is much simpler than I realize.