你的问题究竟是什么?没有交代清楚啊我猜问题的关键是你的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).
....
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).
解决方案 »
- Oracle 11g安装出错,m_bReaderStarted: false,在线等
- oracle 中NULL 不匹配date 类型?
- 特急,在线等,如何实现将ORACLE中数据导入SQL SERVER中
- 为什么要创建那么多表空间呢,所有的用户共用一个大的表空间不行吗?
- 跪求:请问再sqlplus里面如何调用oracle stored procedure
- 为什么我安装的ORACLE要区分大小写。如何设置ORACLE才可以让他不区分大小写~~~~~~~~~~~~~
- 这个存储过程while里面的update为什么不起作用,又不报错! 在线等,高手请进,UP有分!
- 有什么好的方法能取回我刚刚插入表中的序列号?
- 刚安装完oracale的用户名和密码是多少?
- 用手机控制sqlplus
- 一个关于sql的日期查询问题
- ***!!求教SQL简单问题!关于通配符的使用!100分求教,在线等待!
....
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).
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;