OCI_FETCH_ROW(3)OCI_FETCH_ROW(3)oci_fetch_row - Returns the next row from a query as a numeric arraySYNOPSIS
array oci_fetch_row (resource $statement)
DESCRIPTION
Returns a numerically indexed array containing the next result-set row of a query. Each array entry corresponds to a column of the row.
This function is typically called in a loop until it returns FALSE, indicating no more rows exist.
Calling oci_fetch_row(3) is identical to calling oci_fetch_array(3) with OCI_NUM + OCI_RETURN_NULLS.
PARAMETERS
o $statement
-A valid OCI8 statement identifier created by oci_parse(3) and executed by oci_execute(3), or a REF CURSOR statement identifier.
RETURN VALUES
Returns a numerically indexed array. If there are no more rows in the $statement then FALSE is returned.
EXAMPLES
Example #1
oci_fetch_row(3) Example
<?php
$conn = oci_connect('hr', 'welcome', 'localhost/XE');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
$stid = oci_parse($conn, 'SELECT department_id, department_name FROM departments');
oci_execute($stid);
while (($row = oci_fetch_row($stid)) != false) {
echo $row[0] . " " . $row[1] . "<br>
";
}
oci_free_statement($stid);
oci_close($conn);
?>
NOTES
Note
See oci_fetch_array(3) for more examples of fetching rows.
SEE ALSO oci_fetch(3), oci_fetch_all(3), oci_fetch_array(3), oci_fetch_assoc(3), oci_fetch_object(3).
PHP Documentation Group OCI_FETCH_ROW(3)
Check Out this Related Man Page
OCI_RESULT(3)OCI_RESULT(3)oci_result - Returns field's value from the fetched rowSYNOPSIS
mixed oci_result (resource $statement, mixed $field)
DESCRIPTION
Returns the data from $field in the current row, fetched by oci_fetch(3).
For details on the data type mapping performed by the OCI8 extension, see the datatypes supported by the driver
PARAMETERS
o $statement
-
o $field
- Can be either use the column number (1-based) or the column name. The case of the column name must be the case that Oracle meta
data describes the column as, which is uppercase for columns created case insensitively.
RETURN VALUES
Returns everything as strings except for abstract types (ROWIDs, LOBs and FILEs). Returns FALSE on error.
EXAMPLES
Example #1
oci_fetch(3) with oci_result(3)
<?php
$conn = oci_connect('hr', 'welcome', 'localhost/XE');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
$sql = 'SELECT location_id, city FROM locations WHERE location_id < 1200';
$stid = oci_parse($conn, $sql);
oci_execute($stid);
while (oci_fetch($stid)) {
echo oci_result($stid, 'LOCATION_ID') . " is ";
echo oci_result($stid, 'CITY') . "<br>
";
}
// Displays:
// 1000 is Roma
// 1100 is Venice
oci_free_statement($stid);
oci_close($conn);
?>
NOTES
Note
In PHP versions before 5.0.0 you must use ociresult(3) instead. This name still can be used, it was left as alias of oci_result(3)
for downwards compatability. This, however, is deprecated and not recommended.
SEE ALSO oci_fetch_array(3), oci_fetch_assoc(3), oci_fetch_object(3), oci_fetch_row(3), oci_fetch_all(3).
PHP Documentation Group OCI_RESULT(3)
Hi all,
I have a interresting problem. My application is as follows:
From a shell script i will conn to a oracle database and fetch few rows using a select statement.
Then i want to sort these rows and return a column (collection of values of a column from the selected results) as array... (3 Replies)
Hi,
I have an array in which one column can contain any statement.
From multiple rows of that column I want to match the statement like "Execution Started."
If that row contains "Execution started." then only I have to fetch other data of other columns of that particular row.
I dont want... (2 Replies)
Hi,
I want to test a var, $inputPin to see if is 3 digits in a row or not in a Bash script.
I am getting stuck on the regex to do this.
And the equality test if it is in an if statement as below?
-ne is for comparing numbers
But I guess it would be != in this case
if \{3,3\]}]
... (6 Replies)
Hi,
I have a file containing details of different departments . Infomration of departments is in various tags
file is as below
I want to create a new file from the above file which should contain only two fields belonging to one department
format
There are multiple files... (1 Reply)
I have file like
1 0 0 2 0 0 4 0 0....
2 0 1 3 0 0 0 1 0....
i need to find the max value of a row and store it in a file...similarly of all the rows to file..
and also minimum value except zero ...and store them in other file..and also number of such values that are greater than minimum... (2 Replies)
Hello All,
I am new to shell scripting. I am working on Solaris O/S, bash script and sybase programming.
I want to loop through multiple values in an array and for each value, I
want to select a row from the database.
following is the code written for it.
output="loop.csv" ... (8 Replies)
Hi there
Everytime it calls the second if statement it keeps calling the first echo message from the first if statement.
how do I get it to display the second echo message in the second if statement?
Thanks.
function (verbose) {
if ; then
echo "rm: cannot remove $1 : is a... (8 Replies)
Hi,
I'm a rookie who is trying to learn this stuff. What I need help with is putting together a non complicated "while" loop within the below "if" statement. I also need the while loop to keep looping until the user types a key to end the loop. Please reveal the proper insertion points. Thank... (4 Replies)