1 Reply Latest reply: Dec 4, 2012 4:33 AM by Jim Smith RSS

    Store a File in BLOB field throught stored procedure - ORA-01460 error

    977822
      The gool is to memorize files in database in BLOB fields . For that we use the folowing stored procedure and Delphi software (ODAC components)

      CREATE OR REPLACE
      PROCEDURE ADD_DOC (pID_DOC IN INTEGER, pDOC IN BLOB DEFAULT NULL)
      IS
      BEGIN
      BEGIN
      INSERT INTO TABLE_DOC ID_DOC, DOC) VALUES ( pID_DOC, pDOC );
      EXCEPTION
      when OTHERS then
      raise_application_error(-20294, '{8}-Erreur lors de l''ajout d''une PJ de la documentation commerciale n° ['||pID_DOC||'] ' ||SQLERRM);
      END;
      END;

      Begin
      IF OpenDialog1.Execute = true
      then
      begin
      OraStoredProc1.Params.Clear;
      OraStoredProc1.StoredProcName := 'ADD_DOC';
      OraStoredProc1.Params.CreateParam(ftInteger,'pID_DOC',ptinput);
      OraStoredProc1.Params.CreateParam(ftBlob,'pDOC',ptinput);
      OraStoredProc1.ParamByName('pID_DOC').AsInteger := pID_DOC;
      OraStoredProc1.ParamByName('pDOC').LoadFromFile(OpenDialog1.FileName, ftBlob);
      try
      OraStoredProc1.ExecProc;
      except
      ON E : Exception do
      ShowMessage(e.Message);
      end;
      end;

      For files < 32k, no problem, for files > 32k the following message appear :

      ORA-01460: unimplemented or unreasonable conversion requested

      Thanks for any answer

      Edited by: user8273449 on 4 déc. 2012 01:51