PHP-Oracle I need ROWID of inserted row

Im using Oracle 10g and PHP5.x

on Data insert in return i need CUST_NO which is Primary Key in table

<?php
if ($conn = oci_connect(‘scott’,‘tiger’, ‘192.168.0.225/XE’)) {

$insert = “Insert into CUST (STORE_Name,CUST_TYPE_NO) values (‘my store’,2)”;
$cursor = oci_parse($conn, $insert);
oci_execute($cursor);

oci_close($conn);
}
else
{
$err = oci_error();
echo "Oracle Connect Error " . $err[‘text’];
}
?>


My table structure is

Column Name Data Type Nullable Default Primary Key
CUST_NO NUMBER No - 1
STORE_Name Varchar2(25) No - -
CUST_TYPE_NO NUMBER No - -

my advice to you is

  1. try your INSERT query outside of php, i.e. directly in oracle, and watch what happens – you get an error

  2. now go do some research on oracle sequences

:slight_smile:

My code is working fine but after insert data from PHP code i want inserted data row id which is sequence id of table.
hope u got it now