以前用sybase数据库,对oracle不熟。
现在现在pb 中建oracle存储过程,总是报错。现在写一个最简单的,让大家看看哪里错了?create or replace procedure xa_clr
is
begin
select * from v_ch;
end xa_clr;

解决方案 »

  1.   

    create or replace procedure proc_alarms
    AS
    teim date;
    BEGIN
    teim := sysdate;
    insert into qiudf_alarms(alarm_status,alarm_datetime) values(0,teim);
    commit;
    end proc_alarms;
      

  2.   

    select * from v_ch;
    个地方有错不是这样实现的
      

  3.   

    select V_CH字段 INTO 你过程中定义的变量 from v_ch;
    不能直接select * from v_ch;这样字...
      

  4.   

    你要是查询全部的话就要么使用游标 然后遍历游标要么使用变量,把你查询出来的值赋给变量。给两列子:
    一:给游标create or replace procedure xa_clr
    as
    CURSOR CUR_DTBID IS
        select * from v_ch;
      begin
    变量游标
    end xa_clr;二:制定字段赋给变量create or replace procedure xa_clr
    as
     M_DLBLM VARCHAR2(100);
      begin
    select t.字段 into M_DLBLM  from v_ch t;
    然后使用变量
    end xa_clr;
      

  5.   

    create or replace procedure xa_clr
    as
    tjrq varchar(10);
    begin
    select tjdate into tjrq from v_ch 
    commit;
    end xa_clr;
    又仿照您的格式写了一个,还是报错。麻烦看看。
      

  6.   

    tjdate  这是日前类型吧 你定义的varchar换成date
      

  7.   

    返回值可能不止一行,查询语句没有分号结尾create or replace procedure xa_clr
    as
    tjrq varchar(10);
    begin
    select tjdate into tjrq from v_ch where rownum=1;
    end xa_clr;
      

  8.   


    create or replace procedure xa_clr
    as
    tjrq varchar(10);
    begin
    select tjdate into tjrq from v_ch where rownum = 1; 
    --commit;
    end xa_clr;
      

  9.   

    tjdate 是字符型
    可是按9楼,10楼还是不行啊。
    第一个报错:无效的SQL语句
    第二个报错:第1行,第7列,出现符号。。
    第三个报错同一
      

  10.   


    create or replace procedure xa_clr
    as
    tjrq varchar(10);
    begin
    select tjdate into tjrq from v_ch ;
    commit;
    end xa_clr;
     测试了 不错啊 不知道你那为什么。
      

  11.   

    你得表里面没有数据吧
    create or replace procedure xa_clr
    as
    tjrq varchar(10);
    begin
    select tjdate into tjrq from v_ch where rownum = 1; 
    --commit;
    exception
     when others then
       null;
    end xa_clr;
      

  12.   

    包头package,定义下 procedure xa_clr;
      

  13.   

    你要简单的就别写查询 写增删改 
    create or replace procedure xa_clr(rs out sys_refcursor)
    is
    begin
       open rs for select * from v_ch;
    end xa_clr;