我有一个错误,我现在很沮丧。我认为由于这个错误,我还有另一个错误,即在表中添加检查约束时无法引用其他列。我必须在检查约束中使用此函数来与结束时间进行比较。
1 create or replace function timing(dat in date, bran in varchar2(30), audi in number)
2 return number is time number
3 begin
4 select s_end into time from checking
5 where s_date=dat and branch=bran and a_id = audi;
6 return time;
7* end timing
SQL> /
我的桌子是
Name Null? Type
----------------------------------------- -------- -------------
S_ID NOT NULL NUMBER
M_ID NUMBER
A_ID NUMBER
S_DATE DATE
S_START NUMBER
S_END NUMBER
BRANCH VARCHAR2(30)
错误是:
1/46 PLS-00103: Encountered the symbol "(" when expecting following: := . ) , @ % default character The symbol ":=" was substituted for "(" to continue.
3/1 PLS-00103: Encountered the symbol "BEGIN" when expecting the following: := . ( @ % ; not null range default character
The symbol ";" was substituted for "BEGIN" to continue.
7/10 PLS-00103: Encountered the symbol "end-of-file" when expecting
您以稍微不同的形式发布了相同的问题。我会在这里以稍微不同的形式回答。检查约束不能引用用户定义的函数。Oracle 不允许这样做,因此您的争用“必须在检查约束中使用此函数”不能!
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句