not tested, but this should do it.
-----copy from here-------
<?
//I am making the assumption all
//your tables are in the same
//instance, just different schemas
//The user used to connect will need
//to have select privilege on the tables
$Conn = OCILogon('username','password','db');
//db would be what ever is defined in your
//TNSNames.ora file
//construct query
$QueryStr = "select 'MARIN' LOCATION, sum(LENGTH) TOTAL from marin.cable";
$QueryStr .= " UNION";
$QueryStr .= " select 'LA' LOCATION, sum(length) TOTAL from la.cable";
$QueryStr .= " UNION";
$QueryStr .= " select 'SANFRAN' LOCATION, sum(length) TOTAL from sanfran.cable";
//parse query to make sure it is valid
$stmt = ociparse($Conn,$QueryStr);
if (!stmt){
//not a valid SQL statement
print "some error handling";
}
//run the query
ociexecute($stmt,OCI_DEFAULT);
//loop through each row until no more
while (ocifetch($stmt)){
//you can use any Oracle fetch function to get the rows
//when getting field values you must use UPPERCASE for field names
$Location = ociresult($stmt,"LOCATION");
$Total = ociresult($stmt,"TOTAL");
//for each row print the values
print "Location: $Location, Length; $Total";
}
OCILogoff($Conn);
?>