OraclE错误缺少表达式,oracle - PL / SQL:ORA-00936:缺少表达式::我在代码中哪里出了错? - 堆栈内存溢出...

我需要在数据库中添加新记录,或者如果已经存在则对其进行更新。 我使用了IF else子句。 我对我的oracle数据库有一个SQL查询,如下所示:

DECLARE EXISTS number;

BEGIN

SELECT count(*) INTO EXISTS

FROM reports

WHERE report_id=27;

IF(EXISTS =0) THEN

INSERT INTO reports (REPORT_ID,TITLE,CATEGORY,DISPLAY_ORDER,QUERY,DESCRIPTION,CONTENT_SEQ,DELD,ADMIN_ID,DATE_UPD)

VALUES (27,

'Check user entered keywords have valid resource link',

'zData checks',

9120,

'Select Rk.Resource_Id As "Resource IDs", Rp.Display_Title As "Title", St.Title As "Type",

Decode(Rp.Deld, Null, ''Missing resource'',''Resource deleted (DELD is '' || Rp.Deld || '')'') As "Reason",

rk.keyword,L.Email As "Owner" from resource_keywords rk

Left Join Resources Rp On rk.Resource_Id = Rp.Resource_Id

Left Join Special_Types St On Rp.Special_Id = St.Special_Id

Left Join Login L On rk.Admin_Id = L.Login_Id

Where Rk.Deld = 0 And (Rp.Resource_Id Is Null Or Rp.Deld Is Null Or Rp.Deld <> 0);',

'Check resource_keywords entries for valid and not deleted resource_id.',

1,

0,

1,

CURRENT_TIMESTAMP);

ELSE

UPDATE reports

SET TITLE = 'Check user entered keywords have valid resource link',

CATEGORY = 'zData checks',

DISPLAY_ORDER= 9120,

QUERY ='Select Rk.Resource_Id As "Resource IDs", Rp.Display_Title As "Title", St.Title As "Type",

Decode(Rp.Deld, Null, ''Missing resource'',''Resource deleted (DELD is '' || Rp.Deld || '')'') As "Reason",

rk.keyword,L.Email As "Owner" from resource_keywords rk

Left Join Resources Rp On rk.Resource_Id = Rp.Resource_Id

Left Join Special_Types St On Rp.Special_Id = St.Special_Id

Left Join Login L On rk.Admin_Id = L.Login_Id

Where Rk.Deld = 0 And (Rp.Resource_Id Is Null Or Rp.Deld Is Null Or Rp.Deld <> 0);',

DESCRIPTION='Check resource_keywords entries for valid and not deleted resource_id.',

CONTENT_SEQ=1,

DELD=0,

ADMIN_ID=1,

DATE_UPD = CURRENT_TIMESTAMP

WHERE REPORT_ID = 27;

END IF;

END;

这在ORACLE SQL开发人员中引发以下错误:

Error report:

ORA-06550: line 3, column 22:

PL/SQL: ORA-00936: missing expression

ORA-06550: line 3, column 1:

PL/SQL: SQL Statement ignored

ORA-06550: line 7, column 11:

PLS-00103: Encountered the symbol "=" when expecting one of the following:

(

06550. 00000 - "line %s, column %s:\n%s"

*Cause: Usually a PL/SQL compilation error.

我要去哪里错了?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值