Page 1 of 1

Oracle - PHP --Help!!!

Posted: Mon Mar 14, 2005 5:33 am
by Cesar
Please help me.
I like to save the blob data from PHP to Oracle db with oracle stored procedure
this is a my PHP code

Code: Select all

$stmt = "begin photo_ins($a_cnt,$card_flags,'$curr_volume[2]','$curr_volume[1]',EMPTY_BLOB(),$curr_volume[4],$curr_volume[5],1,sysdate,:out_flags) RETURNING [b]photos_img[/b] INTO :the_blob; end;";
$result=OCIParse($link,$stmt) or die ("");
$blob = OCINewDescriptor($link, OCI_D_LOB); 
OCIBindByName($result, ":the_blob", &$blob, -1, OCI_B_BLOB); 
OCIBindByName ( $result, ":out_flags", &$out_flags, 5);
OCIExecute($result, OCI_DEFAULT); 
$blob->save($FileContents); 
OCIFreeStatement($result);
the photos_img is my table blob field name.

this is a oracle stored procedure

Code: Select all

CREATE OR REPLACE  PROCEDURE &quote;PHOTO_INS&quote;
(nphotos_id in integer, card_id in integer, nphotos_type in varchar2, 
nphotos_name in varchar2, nphotos_img in blob, nphotos_w in integer, nphotos_h in integer, nstatusid in integer, nmoddate in date, flags out integer) is
begin
  insert into photos values(nphotos_id, card_id, nphotos_type, nphotos_name, nphotos_img, nphotos_w, nphotos_h, nstatusid, nmoddate);
  flags := 1;
  commit;

    EXCEPTION 
WHEN OTHERS THEN
    begin
      flags := 0;
      rollback;
    end;
end;
After run i have the error

Code: Select all

Warning: ociexecute() їfunction.ociexecute]: OCIStmtExecute: ORA-06550: line 1, column 99: PLS-00103: Encountered the symbol &quote;RETURNING&quote; when expecting one of the following: := . ( % ; ORA-06550: line 1, column 138: PLS-00103: Encountered the symbol &quote;END&quote; in untitle.php

Warning: OCI-Lob::save() їfunction.save]: OCILobWrite: OCI_INVALID_HANDLE in untitle.php

feyd | Please use

Code: Select all

and

Code: Select all

tags where approriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Posted: Thu Mar 24, 2005 8:44 am
by total
did you ever resolve this? i just posted pretty much the same question.

thankx
Shane