Yanıtlar:
Oracle:
null
Değişmezi bir türü var, ama yok
null
herhangi bir türe dökülebilir ve bu,
decode
işlevin dönüş türünü denetleme , örneğin:
select decode('A','B',to_char(null),'A','1') from dual;
DECODE('A','B',TO_CHAR(NULL),'A','1')
-------------------------------------
1
select decode('A','B',to_number(null),'A','1') from dual;
DECODE('A','B',TO_NUMBER(NULL),'A','1')
---------------------------------------
1
union
ilk sorgu bloğu içerdiğindenull
null
veritabanında saklanan değerlerin her zaman bir türü vardır:
create table t(n integer, s varchar(10));
insert into t values(null, null);
select decode('A','B',n,'A','1') from t;
DECODE('A','B',N,'A','1')
-------------------------
1
select decode('A','B',s,'A','1') from t;
DECODE('A','B',S,'A','1')
-------------------------
1
SQL Server, int
SELECT NULL AS foo INTO dbo.bar
SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'bar'
DROP TABLE dbo.bar
MySQL, ikili (0)
CREATE TABLE mydb.foo (select NULL AS bar);
EXPLAIN mydb.foo;
DROP TABLE mydb.foo;
select isnumeric(null)
= 0 ... ilginç
Oracle bir anlamda bazı dize türüdür.
ADO Reader bana bunu söylüyor. İşte bir Powershell Betiği:
[System.Reflection.Assembly]::LoadWithPartialName("System.Data.OracleClient")
$ConnectionString = "Data Source=myTNS;User ID=myUSER;Password=myPassword"
$conn=new-object System.Data.OracleClient.OracleConnection
$conn.ConnectionString=$ConnectionString
$conn.Open()
$sql = "Select NULL xx from DUAL"
$cmd=new-object System.Data.OracleClient.OracleCommand($sql,$conn)
$r = $cmd.ExecuteReader()
$r.GetSchemaTable() | % { $_
}
Bu verir
ColumnName : XX
ColumnOrdinal : 0
ColumnSize : 0
NumericPrecision : 0
NumericScale : 0
DataType : System.String
ProviderType : 22
IsLong : False
AllowDBNull : True
IsAliased :
IsExpression :
IsKey :
IsUnique :
BaseSchemaName :
BaseTableName :
BaseColumnName :
ProviderSpecificDataType : System.Data.OracleClient.OracleString
Çizgiyi not edin
ProviderSpecificDataType: System.Data.OracleClient.OracleString
postgres:
create table foo as select null as bar;
WARNING: column "bar" has type "unknown"
DETAIL: Proceeding with relation creation anyway.
postgres=> \d foo
Column | Type | Modifiers
--------+---------+-----------
bar | unknown |