在Oracle过程中检查UDT表是否为可为空性

时间:2012-05-29 07:27:42

标签: oracle user-defined-types

type NumberTable is table of number index by binary_integer;

create procedure TestNumberTable
(
    p_NumTable         IN NumberTable Default Cast(Null as NumberTable)
)
as
    /* code body */

两个问题:

  1. 如何检查存储过程中的可为空性参数?

  2. 如何查找计数(*)[即存储过程中参数的行数?

1 个答案:

答案 0 :(得分:0)

您无法使用二进制整数"创建"索引的UDT,您可以这样做:

create type NumberTable is table of number;

Q1:通过" nullability",你的意思是"它是否为空"?如果是这样,这将有效:

create procedure TestNumberTable
( p_NumTable IN NumberTable Default null)
as 
  if p_NumTable is null then
     ...

Q2:计数:

create procedure TestNumberTable
( p_NumTable IN NumberTable Default null)
as 
  dbms_output.put_line ('count is '||p_NumTable.count);
  ...