Htaccess    html   Php    javascript   Asp   css    maths  Past Questions  Practice Tests Online

ocinewcursor function syntax tag tutorial 2013





Alert! Connect with 10,000 Chating Online. Join Now

Php ocinewcursor () function

Write your php code

 
<?php ?>

Php Result


Your code below



(PHP 3>= 3.0.8, PHP 4 , PHP 5)

ocinewcursor --  Return a new cursor (Statement-Handle)

Syntax

resource ocinewcursor ( resource conn )

ocinewcursor() allocates a new statement handle on the specified connection.

Example 1. Using a REF CURSOR from a stored procedure in Oracle

<?php   
// suppose your stored procedure info.output returns a ref cursor in :data

$conn = OCILogon("scott", "tiger");
$curs = OCINewCursor($conn);
$stmt = OCIParse($conn, "begin info.output(:data); end;");

ocibindbyname($stmt, "data", $curs, -1, OCI_B_CURSOR);
ociexecute($stmt);
ociexecute($curs);

while (
OCIFetchInto($curs, $data)) {
    
var_dump($data);
}

OCIFreeStatement($stmt);
OCIFreeCursor($curs);
OCILogoff($conn);
?>

Example 2. Using a REF CURSOR in a select statement in Oracle

<?php   
echo "<html><body>";
$conn = OCILogon("scott", "tiger");
$count_cursor = "CURSOR(select count(empno) num_emps from emp " .
                
"where emp.deptno = dept.deptno) as EMPCNT from dept";
$stmt = OCIParse($conn, "select deptno,dname,$count_cursor");

ociexecute($stmt);
echo
"<table border=\"1\">";
echo
"<tr>";
echo
"<th>DEPT NAME</th>";
echo
"<th>DEPT #</th>";
echo
"<th># EMPLOYEES</th>";
echo
"</tr>";

while (
OCIFetchInto($stmt, &$data, OCI_ASSOC)) {
    echo
"<tr>";
    
$dname  = $data["DNAME"];
    
$deptno = $data["DEPTNO"];
    echo
"<td>$dname</td>";
    echo
"<td>$deptno</td>";
    
ociexecute($data["EMPCNT"]);
    while (
OCIFetchInto($data["EMPCNT"], &$subdata, OCI_ASSOC)) {
        
$num_emps = $subdata["NUM_EMPS"];
        echo  
"<td>$num_emps</td>";
    }
    echo
"</tr>";
}
echo
"</table>";
echo
"</body></html>";
OCIFreeStatement($stmt);
OCILogoff($conn);
?>

Note: This function was renamed to oci_new_cursor() after PHP >= 5.0.0. For downward compatibility ocinewcursor() can also be used. This is deprecated, however.

Php ocinewcursor Function syntax tag

ocinewcursor php code on this is provided for your study purpose, it will guide you to know how create and design a website using php. use it to practice and train your self online



Php ocinewcursor syntax tutorial

php tutorial guide and code design are for easy learning and programming. The code practice section provided at the top is for practising of this syntax. Use the code section up to practice your php programming online. Learning php is very easy, all you need is to use the examples on this site and practice them to perfect your skills.


Function index

Variables

Expressions

Operators

Control-Structures

Cookies

Array

Date & Time

Directory function

File

Image

Operators

Form data handling

Mathematics operators

Mail

Php Mysql

Network Functions

Strings

php tutorial guides,functions, classes, code examples and tags for creating simple dynamic site to mysql database driven sites
 
 
Htaccess    html   Php    javascript   Asp   css    maths  Past Questions  Practice Tests Online