create or replace package pkg_query is     --包定义
procedure AddSbPic --插入图片
(
  p_blob in blob,
  p_sbid in varchar2,
  tablename in varchar2
);
end pkg_query;
create or replace package body pkg_query is                --包主体procedure AddSbPic --插入图片
(
p_blob in blob,
p_sbid in varchar2,
tablename in varchar2

is 
begin
execute immediate 'update :1 set pic=:2 where id=:3'
using tablename,p_blob,p_sbid;
end AddSbPic;end pkg_query;

解决方案 »

  1.   

    存入图片过大的时候是会出现这个转换错误的。
    可以试用一下方法
    public void SavePhoto(int data_id,byte[] p_Blob,string p_Zip,string id,string Zip,string BolbPic,string tablename)
    {
    try
    {
    OracleDataAdapter photoAdapter;
    DataSet photoDataSet;
    DataTable photoTable;
    DataRow photoRow; photoAdapter = new OracleDataAdapter(
    "SELECT "+id+","+BolbPic+","+Zip+"" +
    "  FROM "+tablename+" WHERE "+id+" = " + data_id,mConn);
    photoDataSet= new DataSet(tablename);
    photoAdapter.UpdateCommand = new OracleCommand
    ("UPDATE "+tablename+" SET " +
    ""+BolbPic+" = :vPHOTO, " +
    ""+Zip+" = :vZip " +
    "WHERE "+id+" = :vID",mConn);
    photoAdapter.UpdateCommand.Parameters.Add(":vPHOTO",
    OracleType.Blob, p_Blob.Length, BolbPic);
    photoAdapter.UpdateCommand.Parameters.Add(":vID",
    OracleType.Number, 0, data_id);
    photoAdapter.UpdateCommand.Parameters.Add(":vZip",
    OracleType.VarChar,1000,Zip); photoAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey; photoAdapter.FillSchema(photoDataSet, SchemaType.Source, tablename); photoAdapter.Fill(photoDataSet,tablename); photoTable = photoDataSet.Tables[tablename];
    photoRow = photoTable.Rows.Find(data_id); photoRow.BeginEdit();
    if (p_Blob.Length != 0)
    {
    photoRow[BolbPic] = p_Blob;
    }
    photoRow[Zip]=p_Zip;
    photoRow.EndEdit();
    photoAdapter.Update(photoDataSet,tablename);
    Etm.ID=data_id;
    if(Bum.EditMMS(Etm))
    {
    Jscript.Alert("录入成功!");
    Jscript.GotoPage("AddMMS.aspx");
    } }
    catch(Exception e)
    {
    throw e;
    }
    }