问题已经解决,
两个错误:
1.声明变量应该在BEGIN 之外的DECLARE中;
2.赋值语句应该改为:str:=to_char(789);
楼上的兄弟,谢谢顶贴~

解决方案 »

  1.   

    我拖一下结贴,
    想问问为什么str:=select to_char(789)from dual;这句语法报下面的错误.
    PLS-00103: 出现符号 "SELECT"在需要下列之一时:
     ( - + case mod new not
       null <an identifier> <a double-quoted delimited-identifier>
       <a bind variable> avg count current exists max min prior sql
       stddev sum variance execute forall mer
    ORA-06550: 第 5 行, 第 1 列:
      

  2.   

    select to_char(678) into str from dual;
    应该这样,用select赋值用into。