我用的是ORACE,存储过程定义如下:
CREATE PROCEDURE UpdateSon(Pno in char,Eno out integer,Lno out char)
我是这样调用的:
char* strSQL = new char[200];
int error = 0 ;
char * itemno= new char[14];
strcpy(itemno,"");
sprintf(strSQL,"{call UpdateSON('%s','%d','%s')}",m_Btl.ItemNo,error,itemno);
TRY
  {
     m_Mxl.m_pframetempset.m_pDatabase->ExecuteSQL(strSQL);
  }
CATCH(CDBException,e)//出错处理
 {
    AfxMessageBox(e->m_strError);
 }
END_CATCH
出现以下错误:
ORA-06550: 第 1 行, 第 36 列: 
PLS-00363: 表达式 '0' 不能用作赋值目标
ORA-06550: 第 1 行, 第 41 列: 
PLS-00363: 表达式 '' 不能用作赋值目标
ORA-06550: 第 1 行, 第 7 列: 
PL/SQL: Statement ignored
这是怎么回事?我这些语句在哪些地方有问题?谢了

解决方案 »

  1.   

    你先输出sql语句,把sql语句放在sqlplus中执行试试看
      

  2.   

    最起码下面是错的sprintf(strSQL,"{call UpdateSON('%s','%d','%s')}",m_Btl.ItemNo,error,itemno);应该如下:
    sprintf(strSQL,"{call UpdateSON('%s',%d,'%s')}",m_Btl.ItemNo,error,itemno);
      

  3.   

    还有Oracle存储过程定义时尽量不要使用char,使用varchar2(1);
    注意一下在Oracle中创建存储过程是否正确,一定要保证存储过程正确。
      

  4.   

    还有问题:
    CATCH(CDBException,e)//出错处理
     {
        AfxMessageBox(e->m_strError);
     }
    应该为:
    CATCH(CDBException *e)//出错处理
     {
        AfxMessageBox(e->m_strError);
     }
    --------------------
    这几个问题说明你没有仔细进行过调试。
    最好自己先好好想想。
      

  5.   

    to Free_Man(浪迹天涯) :
    存储过程别人已在DELPHI中已调,没有问题
    我的
    CATCH(CDBException,e)//出错处理
     {
        AfxMessageBox(e->m_strError);
     }
    也行,不信你试试
    我试了:
    sprintf(strSQL,"{call UpdateSON('%s',%d,'%s')}",m_Btl.ItemNo,error,itemno);
    问题依旧
    非常感激你的帮助!!!!
      

  6.   

    m_Mxl.m_pframetempset.m_pDatabase->ExecuteSQL这样只能执行不带参数的存储过程.
    http://expert.csdn.net/Expert/topic/1173/1173605.xml?temp=.2388117
    http://expert.csdn.net/Expert/topic/1184/1184458.xml?temp=.6566584我记得回过这个帖子啊。难道提交失败了?
      

  7.   

    那在ODBC中使用CRecordSet类怎样调用带参数的存储过程呢?
      

  8.   

    to 52001314(★新年快乐★) ( ):
    我按你的方法实现如下:
    char* strSQL = new char[200];
    int  error = 0;
    char * itemno= new char[14];
    strcpy(itemno,"");
    sprintf(strSQL,"{call UpdateSON('%s','error','itemno')}",m_Btl.ItemNo);
    if (m_Mxl.m_pframetempset.IsOpen())
    m_Mxl.m_pframetempset.Close();
    TRY
      {
        m_Mxl.m_pframetempset.m_pDatabase = m_Mxl.m_pframeSet.m_pDatabase;
        m_Mxl.m_pframetempset.Open(AFX_DB_USE_DEFAULT_TYPE,strSQL);
      }
    CATCH(CDBException,e)//出错处理
      {
    AfxMessageBox(e->m_strError);
      }
    END_CATCH
    出现以下错误:
     Syntax error or access violation
    怎么回事,怎么办???
      

  9.   

    http://expert.csdn.net/Expert/topic/1173/1173605.xml?temp=.2388117small wei的方法是可以的啊。你的m_pframetempset有没有像他那样重载?
      

  10.   

    与重载有关系吗?是不是我带参数的SOL语句没写对?
      

  11.   

    我用这种方法调存储过程,不带参数的存储过程也出现这种错误(Syntax error or access violation),真不知道这是为什么?
      

  12.   

    改正上面所说的:
    我用这种方法调存储过程,不带参数的存储过程也出现这种错误(Syntax error or access violation),但是ORACLE中数据已经改变了,真不知道这是为什么?