我有此过程:
SQL> create or replace procedure KORELACJA (START IN DATE, END IN DATE) AS
2 BEGIN
3 SELECT T.City, Corr(T.Value, H.Value)
4 FROM TEMP T
5 INNER JOIN HUMIDITY H
6 on T.City = H.City
7 and T.mDate = H.mDate
8 WHERE T.mDate between to_date(START,'YYYY-MM-DD') and to_date(END,'YYYY-MM-DD')
9 GROUP BY T.City
10 END;
11 /
出现错误:ORA-06550:第1行,第7列:
有人知道如何解决此问题吗?
[编辑]
SQL> show error procedure KORELACJA;
Errors for PROCEDURE KORELACJA:
LINE/COL ERROR
-------- -----------------------------------------------------------------
4/1 PLS-00428: an INTO clause is expected in this SELECT statement
答案 0 :(得分:0)
看看这个例子;阅读代码中的注释。
我已经创建了示例表,只是为了确保过程代码能够编译。
SQL> create table temp (city varchar2(10), value number, mdate date);
Table created.
SQL> create table humidity (city varchar2(10), value number, mdate date);
Table created.
过程本身:
SQL> create or replace procedure korelacja
2 (p_start in date, p_end in date) --> renamed parameters
3 is
4 l_city temp.city%type; --> declared local variables for SELECT
5 l_corr number; -- statement's results
6 begin
7 select t.city, corr(t.value, h.value)
8 into l_city, l_corr --> missing INTO clause
9 from temp t join humidity h on t.city = h.city
10 and t.mdate = h.mdate
11 where t.mdate between p_start and p_end --> parameters already are DATEs; you don't
12 group by t.city; -- need TO_DATE against them
13 end;
14 /
Procedure created.
SQL>