oracle中sum()遇到空字符会怎样?

建表语句:

-- Create table
create table CXPS_TEST
(
  id             NUMBER(19) not null,
  create_user_id NUMBER(19),
  update_user_id NUMBER(19),
  report_type    NUMBER(10)
)
tablespace TEST
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );
-- Create/Recreate primary, unique and foreign key constraints 
alter table CXPS_TEST
  add primary key (ID)
  using index 
  tablespace TEST
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );

原始数据:

oracle中sum()遇到空字符会怎样?_第1张图片

select sum(create_user_id),sum(update_user_id),sum(report_type) from CXPS_TEST
 

select nvl(sum(create_user_id),0) from CXPS_TEST

你可能感兴趣的:(oracle,每日一问)