<html>
<title>Demo:
<?php echo $PHP_SELF; ?></title>
<body bgcolor="white"&
gt;
<h1>
<?php echo $PHP_SELF; ?></h1>
<hr>
<!-- Demo&n
bsp;begin -->
<?php
// Connect to Oracle using SID= $ORACLE_SID
og $TWO_TASKS
$con = OCILogon(
"scott",
"tiger");
function DisplayTable
( $con, $sql
) {
echo
"<p>SQL: ".$sql;
echo
"<p>\n";
&nbs
p;$stmt = OCIParse($con, $sql);
OCIExecute($stmt);
echo
"<table border=\"1\"><tr>\n";
for ($i=1; $i<=OCINumCols($stmt); $i++) {
echo
"<th>";
&nb
sp; echo OCIColumnName($stmt,$i);
echo
"</th>\n";
}
echo
"</tr>\n";
&n
bsp;echo
"";
while (OCIFetchInto($stmt, &$result, OCI_ASSOC)) { echo
"<tr>";
&nb
sp; for ($i
=1; $i<=OCINumCols(<
/FONT>$stmt); $i
++) {
&
nbsp; echo
"<td>";
&nb
sp; echo $result[OCIColumnNa
me($stmt,$i)];
e
cho
"</td>";
&n
bsp; }
echo
"</tr>\n";
}
echo&n
bsp;
"</table>\n";
}
$sql =
"select cols.column_name as Name, nullable, da
ta_type as Type, Decode( data_type, 'NUMBER', dat
a_precision + data_scale, data_length ) Length, d
ata_precision Precision, data_scale Scale, data_length 
;dlength, data_default, ' ' comments FROM user_ta
b_columns cols where cols.table_name = 'EMP' orde
r by column_id";
&nbs
p;DisplayTable($con, $sql);
$sql =
"SELECT table_name, tablespace_name, pct_free, pct_
used, initial_extent, next_extent, pct_increase, degree,&nb
sp;instances, decode(ltrim(cache),'Y', 'CACHE', 'NOCACHE')
cache FROM user_tables where table_name='EMP'";
DisplayTable(<
/FONT>$con, $sql);
$sql =
"SELECT A.UNIQUENESS, A.INDEX_NAME , A.TABLES
PACE_NAME AS Tablespace, A.INITIAL_EXTENT AS InitialEx
tentSize, A.PCT_INCREASE AS PercentIncrease, A.PCT_FREE&nbs
p;AS MinimumPercentFree, A.next_extent FROM USER_INDE
XES A WHERE (A.TABLE_NAME = 'EMP')";
DisplayTable(
$con, $sql);
$sql =
"Select comments from user_tab_comments where
table_name = 'EMP' and comments is not null"
;
DisplayTable($con, $sql);
$sql =
"Select column_name, comments from user_col_comment
s where table_name = 'EMP' and column_name =
'EMPNO'";
DisplayTa
ble($con, $sql)<
FONT color="#007700">;
//while (OCIFetchInto($stmt, &$result, OCI_ASSOC)) {
// echo $result['TABLE_NAME'];
// echo "<br>\n";
//}
// Disconnect from Oracle
OCILogoff($con);
?>
<!-- Demo en
d -->
<hr>
<i>by Hans Schou <a 
;href="mailto:chlor@schou.dk"><chlor@schou.dk></a></i
>
<a href="http://www.schou.dk">http://www.schou.dk</a><
br><br>
<?php
// Display source file if exists
if (fi
le_exists($fn = basename($PHP_SELF.
"s")
))
echo
"<i>Source file: <a href=\"".$f
n.
"\">$fn</a></i>\n"
;
else
echo
"<i>Source file $fn is not available<
/i>\n";
?>
<
/body>
</html>