我目前正在尝试使用PL / pgSQL进行试验,并想知道是否存在一种更优雅的方法来执行以下操作:
select c.data into data from doc c where c.doc_id = id and c.group_cur > group_cur order by c.id desc limit 1;
EXCEPTION
WHEN NO_DATA_FOUND THEN
select c.data into data from doc c where c.doc_id = id and c.global_cur > global_cur order by c.id desc limit 1;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RETURN NULL;
select into
不返回任何数据的仍然会引发异常,对吗?