// Returns 6 digit 3 section version string, e.g. '09.02.00' for Oracle 9.2
function DBVersion(Session: TOracleSession): string;
var s, ds: string;
p, digit: Integer;
begin
Result := '';
if Session.Connected then
begin
s := ' ' + UpperCase(Session.ServerVersion);
p := Pos('RELEASE', s);
if p <= 0 then
begin
p := Pos('.', s);
while (p > 0) and (s[p] <> ' ') do Dec(p);
end;
if p > 0 then
begin
for digit := 1 to 3 do
begin
ds := '';
while (p <= Length(s)) and not (s[p] in ['0'..'9']) do Inc(p);
while (p <= Length(s)) and (s[p] in ['0'..'9']) do
begin
ds := ds + s[p];
Inc(p);
end;
while Length(ds) < 2 do ds := '0' + ds;
Result := Result + ds;
if digit < 3 then Result := Result + '.';
end;
end;
end;
end;