你的问题究竟是什么?没有交代清楚啊我猜问题的关键是你的select .. d 有问题,如果要在select statement中使用函数,该函数必须在包头中定义pragma,如下例中在包头中对函数的定义部分:
....
FUNCTION add_weeks (p_year_week   NUMBER,
                    p_no_of_weeks NUMBER) RETURN NUMBER;
   PRAGMA restrict_references (add_weeks, WNDS, WNPS, RNDS, RNPS);这是保证在select statement中的函数不会进行对数据库表和包中变量的修改
WNDS specifies the constraint writes no database state (does not modify database tables).
WNPS specifies the constraint writes no package state (does not modify packaged variables).
RNDS specifies the constraint reads no database state (does not query database tables).
RNPS specifies the constraint reads no package state (does not reference packages variables).

解决方案 »

  1.   

    你的问题究竟是什么?没有交代清楚啊我猜问题的关键是你的select .. d 有问题,如果要在select statement中使用函数,该函数必须在包头中定义pragma,如下例中在包头中对函数的定义部分:
    ....
    FUNCTION add_weeks (p_year_week   NUMBER,
                        p_no_of_weeks NUMBER) RETURN NUMBER;
       PRAGMA restrict_references (add_weeks, WNDS, WNPS, RNDS, RNPS);这是保证在select statement中的函数不会进行对数据库表和包中变量的修改
    WNDS specifies the constraint writes no database state (does not modify database tables).
    WNPS specifies the constraint writes no package state (does not modify packaged variables).
    RNDS specifies the constraint reads no database state (does not query database tables).
    RNPS specifies the constraint reads no package state (does not reference packages variables).
      

  2.   

    我的问题是怎样通过B,C为条件从PK2.F2中返回D和PK1.F1中的CURSOR一起返回A,B,C,D....谢谢关照!
      

  3.   

    关于如何通过过程或函数返回CURSOR,参见:
    http://www.csdn.net/Expert/TopicView2.asp?id=338638&datebasetype=now
    http://www.vbip.com/books/1861001789/chapter_1789_10.asp关于如何在SELECT STATEMENT中调用函数,如下:
    SELECT A,B,C,PK2.F2(B,C) D FROM TB1;