PLSQL 过程中的 IF EXISTS 语句

IF EXISTS Statement in a PLSQL Procedure

我是 plsql 的新手,尝试实现我的程序。

我的程序签名看起来像

PROCEDURE signal_merge(s1 IN SIGNAL_STRUCT, s2 IN SIGNAL_STRUCT, rs OUT SIGNAL_STRUCT)

SIGNAL_STRUCT 有一个(我称之为字段?)"updated" 是 UPDATED_STRUCT

类型

现在我想做一些类似的事情

if s2.updated exists
   do something

即使 Google 我也找不到解决方案,有人可以解释一下我如何实现吗?

谢谢大家

I need to know its null or not

然后测试一下:

if s2.updated is not null then
  -- do something
end if;

Read more.

您想知道s2.updated是否被填满:

IF s2.updated IS NOT NULL THEN
  do something
END IF;

我宁愿使用不可为 null 的布尔变量,但是,它要么是 true 要么是 false。那你会问

IF s2.updated THEN
  do something
END IF;

我认为更易读。

结构声明看起来像

TYPE signal_struct IS RECORD 
( 
  updated BOOLEAN NOT NULL,
  ...
);