在Oracle过程中检查UDT表的可空性

在Oracle过程中检查UDT表的可空性,oracle,user-defined-types,Oracle,User Defined Types,两个问题: 如何在存储过程中检查参数的可空性 如何在存储过程中查找参数的计数(*)(即行计数) 不能使用“按二进制整数索引”创建UDT,可以执行以下操作: type NumberTable is table of number index by binary_integer; create procedure TestNumberTable ( p_NumTable IN NumberTable Default Cast(Null as NumberTable) ) a

两个问题:

  • 如何在存储过程中检查参数的可空性

  • 如何在存储过程中查找参数的计数(*)(即行计数)


  • 不能使用“按二进制整数索引”创建UDT,可以执行以下操作:

    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:“可空性”是指“是否为空”吗?如果是这样,这将起作用:

    create type NumberTable is table of number;
    
    问题2:对于计数:

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