简体   繁体   English

缺少括号错误

[英]missing parenthesis error

So I created the following code: 因此,我创建了以下代码:

Select c_id, c_name 
From bk_CustWithOrders 
where to_char(order_date,'MM-YYYY')=prevMonth(sysdate '2014-11-27', 4)
INTERSECT 
Select c_id, c_name 
From bk_CustWithOrders 
where to_char(order_date,'MM-YYYY')=prevMonth(sysdate '2014-11-27', 3)
INTERSECT 
Select c_id, c_name 
From bk_CustWithOrders
where to_char(order_date,'MM-YYYY')=prevMonth(sysdate '2014-11-27', 2);

and I get the following error message: 我收到以下错误消息:

ORA-00907: missing right parenthesis
00907. 00000 -  "missing right parenthesis"
*Cause:    
*Action:
Error at Line: 3 Column: 55

I've tried adding parenthesis but then I incur another error. 我尝试添加括号,但随后出现另一个错误。 Not sure what to do. 不知道该怎么办。

I dont know anyting about the function prevMonth . 我不知道有关函数prevMonth

But, What I noticed is there is no separator between sysdate and '2014-11-27'. 但是,我注意到sysdate和'2014-11-27'之间没有分隔符。

prevMonth(sysdate '2014-11-27', 2);

Use ',' between sysdate and '2014-11-27' and recheck: sysdate and '2014-11-27'之间使用', sysdate and '2014-11-27'并重新检查:

prevMonth(sysdate, '2014-11-27', 2); else you have to use any one of sysdate or '2014-11-27' 否则您必须使用sysdate or '2014-11-27'任何一个

prevMonth(sysdate, 2);

prevMonth('2014-11-27', 2);

Line 3, column 55 is exactly at start of this part: 第3行第55列恰好在本部分的开头:

'2014-11-27', 4) '2014-11-27',4)

He's saying : I don't understand why you put a whitespace as separator. 他是在说:我不明白您为什么要使用空格作为分隔符。

sysdate '2014-11-27' is invalid. sysdate '2014-11-27'无效。

If you only want to specify a date literal, it should be: date '2014-11-27' 如果只想指定日期文字,则应为: date '2014-11-27'

sysdate is a function that returns the current date. sysdate是一个返回当前日期的函数。 If you just want to pass the current date to the function, then use only sysdate . 如果只想将当前日期传递给函数,则使用sysdate

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM