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
答案 0 :(得分:2)
您以略微不同的形式发布了同样的问题。我会以稍微不同的形式回答这里。检查约束不能引用用户定义的函数。 Oracle不允许这样做,所以你的争论“必须在check约束中使用这个函数”不能!
答案 1 :(得分:0)
试试这个
int mark_sum;