0

我对 DB 很陌生。我是 Java 开发人员,与 SQL 函数无关。但是现在我处于需要检查 sql 函数是否在 db 上正确执行的情况

CREATE OR REPLACE FUNCTION RATELIMIT_OWN.Get_Logs ( p_yyyymm VARCHAR2, p_numec NUMBER )
RETURN LOG_RECORD_TABLE PIPELINED IS

TYPE        ref0 IS REF CURSOR;
cur0        ref0;

out_rec     LOG_RECORD := log_record(NULL,NULL,NULL);

BEGIN

OPEN cur0 FOR
  'SELECT eventid, errormsg, create_date from logs partition (LOGS_P' || p_yyyymm || ') where numec=:1'
USING p_numec;

  LOOP
   FETCH cur0 INTO out_rec.eventid, out_rec.msg, out_rec.create_date;
   EXIT WHEN cur0%NOTFOUND;
   PIPE ROW(out_rec);
  END LOOP;
  CLOSE cur0;

RETURN;
END Get_Logs;
/

如何在 toad 中执行这个 sql 函数。我想看到像正常选择查询输出一样的结果

4

3 回答 3

3

要检查表值函数,请尝试:

select * FROM table(RATELIMIT_OWN.Get_Logs('a', 1));
于 2012-09-07T09:15:15.620 回答
2
FOE EXECUTING THE FUNCTION    
SELECT RATELIMIT_OWN.Get_Logs(....,...) FROM DUAL ;

AND
ORA-00904:  MEAN COLUMN NAME IS NOT VALID PLSS CHECK THE COLUMN NAME 
于 2012-09-07T11:04:56.650 回答
0

尝试:

 select  RATELIMIT_OWN.Get_Logs(...) from dual;
于 2012-09-07T09:21:12.187 回答