I'm trying to merge some data into an oracle db but I cannot manage to let it works. I tried a lot of combination but without success. Here is my simple code
`
$sql ="MERGE INTO test IG";
$sql .=" USING (SELECT 'test' as rep,'test'as usr FROM dual) po";
$sql .=" on (ig.report= po.rep and ig.utente=po.usr)";
$sql .=" WHEN MATCHED THEN UPDATE SET ig.datamod = sysdate, ig.giorni_utilizzo = ig.giorni_utilizzo + 1 where ig.datamod > sysdate";
$sql .=" WHEN NOT MATCHED THEN INSERT (ig.report,ig.utente, ig.datains, ig.datamod, ig.giorni_utilizzo)";
$sql .=" VALUES (po.rep, po.usr, sysdate, sysdate, 1);";
#$sql ="insert into test IG (report, utente, datains, datamod, giorni_utilizzo) values('prova','prova',sysdate,sysdate,1)";
$stid = OCIParse($conn, $sql);
echo $sql;
$res = OCIExecute($stid);
if($res){
echo "OK";
} else {
echo "KO";
}`
The connection is not a problem because i tried an insert and it works.
if I run the query on the gui it works so I think the code is right.
I recive the warning: ORA-00911: invalid character in this line "$res = OCIExecute($stid);"
Can someone tell me where I'm wrong?? Thanks
I found out the problem. here: $sql .=" VALUES (po.rep, po.usr, sysdate, sysdate, 1);"; instead of $sql .=" VALUES (po.rep, po.usr, sysdate, sysdate, 1)"; i don't have to put the ";" at the end of the query