How to store the value a oracle sequence?
952056Sep 28 2012 — edited Oct 2 2012Regards;
I have a Table with a ID column, this column is the Primary Key. I have a sequence for store the value of ID. The code what I use is the next:
(Other form send the value of fields)
$conn = oci_connect("USER","PASSWORD","SID");
for($i=1;$i<=$_POST["hdnLine"];$i++)
{
$strSQL = "INSERT INTO CAT_HOST_IP (ID_CAT_HOST_IP, HOST, IP, AUTORIZACION, COMENTARIOS)";
$strSQL .="VALUES ";
$strSQL .="(".S_CAT_HOST_IP.NEXTVAL.",'".$_POST["txtHost$i"]."', ";
$strSQL .="'".$_POST["txtIP$i"]."','".$_POST["txtAutorizacion$i"]."', ";
$strSQL .="'".$_POST["txtComentarios$i"]."') ";
echo $strSQL. "<br>\n";
$objParse = oci_parse($conn, $strSQL);
$objExecute = oci_execute($objParse, OCI_DEFAULT);
}
oci_close($conn);
When display $strSQL is this the result:
INSERT INTO CAT_HOST_IP (ID_CAT_HOST_IP, HOST, IP, AUTORIZACION, COMENTARIOS)VALUES (S_CAT_HOST_IPNEXTVAL,'HOST', 'IP','SI', 'Comentario')
I can't obtain the value of S_CAT_HOST_IPNEXTVAL. obviously the next message is displayed
Warning: oci_execute() [function.oci-execute]: ORA-00984: column not allowed here in C:\AppServ\www\Multiple_Insert_CatHost02.php on line 55
I hope can Help me. Thanks!