Oracle:将值存储到表中的游标后,从pl / sql中的游标中获取日期数据类型值

时间:2015-04-03 04:15:21

标签: oracle plsql cursor

将值存储到表中的游标后,我无法从游标中获取日期数据类型值。这是我的pl / sql代码

declare
   pname varchar(20);
        dename varchar(20);
        dname varchar(20);
    addate patient.addate%type;
cursor cur is select p.pname,p.pdisease,p.addate,d.dname from patient p,doctor d where p.pno=d.pno;
begin
dbms_output.put_line('details');
open cur;
loop
fetch cur into pname,dename,addate,dname;
exit when cur%notfound;
dbms_output.put_line(pname||' '||pdisease||' 'addate||' 'dname);
end loop;
end;
/

Here in this code I am getting error like
ERROR at line 13:
ORA-06550: line 13, column 47:

    PLS-00103: Encountered the symbol "ADDATE" when expecting one of the following:
    ) , * & = - + < / > at in is mod remainder not rem =>
    <an exponent (**)> <> or != or ~= >= <= <> and or like like2
    like4 likec as between from using || member submultiset

我用来将值存储到游标中的select语句工作正常我已经检查过了。但问题在于获取。

请帮帮我。

1 个答案:

答案 0 :(得分:0)

  

dbms_output.put_line(pname ||&#39;&#39; || pdisease ||&#39;&#39; addate ||&#39;&#39; dname);

您缺少addatedname连接运算符。纠正它,它应该工作:

dbms_output.put_line(pname||' '||pdisease||' '||addate||' '||dname);