我想delcare一个变量并在同一个oracle sql中使用它
假设我们有以下脚本正常工作
select id
,NAME
,ADDRESS
,DATE
FROM MYTABLE
WHERE COMPANY= 'LENOVO'
AND DATEBETWEEN systimestamp - INTERVAL '10' MINUTE
AND SYSTIMESTAMP
在这段代码的最后,我想将ID的值存储在变量中,然后将其删除记录,我尝试了这个但是它没有用
declare
_name varchar(100);
select id
,NAME
,ADDRESS
,DATE
FROM MYTABLE
WHERE COMPANY= 'LENOVO'
AND DATEBETWEEN systimestamp - INTERVAL '10' MINUTE
AND SYSTIMESTAMP
Returning to _name;
delete _name;
请帮忙,谢谢