note 77462 added to function.ocinewdescriptor

From: Date: Thu, 30 Aug 2007 13:51:26 +0000
Subject: note 77462 added to function.ocinewdescriptor
Groups: php.notes 
Request: Send a blank email to php-notes+get-129909@lists.php.net to get a copy of this message
If you just want to retrieve an auto-increment field like an integer, you don't have to use the oci_new_descriptor function: $dbh = ociplogon("username","pw","sid"); $query = "INSERT INTO employees (name) VALUES ('Jones') RETURNING employee_no INTO :employee_no"; $stmt = oci_parse($dbh, $query); // oci_new_descriptor not necessary... // Bind the variable to the parsed statement. // I used '8' as the minimum length - otherwise it was setting the default length to '1', so when an employee_no like 18366 was returned, the variable would be set to '1' (the first digit), so make sure you set a length. oci_bind_by_name($stmt, ":employee_no", $employee_no, 8); oci_execute($stmt, OCI_DEFAULT); // Commit the change oci_commit($dbh); // Free resources associated with the statement oci_free_statement($stmt); print "new employee no is: $employee_no"; ---- Server IP: 208.69.120.35 Probable Submitter: 216.166.37.78 ---- Manual Page -- http://www.php.net/manual/en/function.ocinewdescriptor.php Edit -- https://master.php.net/note/edit/77462 Del: integrated -- https://master.php.net/note/delete/77462/integrated Del: useless -- https://master.php.net/note/delete/77462/useless Del: bad code -- https://master.php.net/note/delete/77462/bad+code Del: spam -- https://master.php.net/note/delete/77462/spam Del: non-english -- https://master.php.net/note/delete/77462/non-english Del: in docs -- https://master.php.net/note/delete/77462/in+docs Del: other reasons-- https://master.php.net/note/delete/77462 Reject -- https://master.php.net/note/reject/77462 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#129909) next »