oci_server_version
(PHP 5, PHP 7, PHP 8, PECL OCI8 >= 1.1.0)
oci_server_version — Oracle データベースのバージョンを返す
パラメータ
connection
-
戻り値
バージョン情報を表す文字列、あるいはエラー時に false
を返します。
例
例1 oci_server_version() の例
<?php
$conn = oci_connect("hr", "hrpwd", "localhost/XE");
echo "サーバーのバージョン: " . oci_server_version($conn);
// 出力は
// サーバーのバージョン: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
// With the Partitioning, OLAP, Data Mining and Real Application Testing option
oci_close($conn);
?>
+add a note
User Contributed Notes 1 note
Anonymous ¶
5 years ago
Here's now to extract just the major.minor version number:
<?php
$link = oci_new_connect($username, $password, $server, "AL32UTF8");
$server_info = oci_server_version($link);
$version = preg_replace('~^.* (\d+\.\d+)\.\d+\.\d+\.\d+.*~s', '\1', $server_info);
echo "$server_info<br>";
// Oracle Database 11g Release 11.2.0.4.0 - 64bit Production
echo "$version<br>";
// 11.2
?>
And here's how to look up version via SQL:
https://www.oracle.com/pls/topic/lookup?ctx=db122&id=ADMIN11039
SELECT * FROM PRODUCT_COMPONENT_VERSION;
PRODUCT VERSION STATUS
---------------------------------------- ----------- -----------
NLSRTL 12.1.0.0.1 Production
Oracle Database 12c Enterprise Edition 12.1.0.0.1 Production
PL/SQL 12.1.0.0.1 Production
?>
↑ and ↓ to navigate •
Enter to select •
Esc to close
Press Enter without
selection to search using Google