List Info

Thread: note 77462 added to function.ocinewdescriptor




note 77462 added to function.ocinewdescriptor
user name
2007-08-30 08:51:26
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  -- h
ttps://master.php.net/note/delete/77462/integrated
Del: useless     -- http
s://master.php.net/note/delete/77462/useless
Del: bad code    -- htt
ps://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     -- http
s://master.php.net/note/delete/77462/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/77462
Reject      -- https://mast
er.php.net/note/reject/77462
Search      -- https://
master.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )