PL/SQL Unique Constraints


create table supplier
(
  supplier_id numeric(10) not null,
  supplier_name varchar2(50) not null,
  contact_name varchar2(50),
  constraint u_supplier_id unique(supplier_id)
);
end;


create table supplier
(
  supplier_id numeric(10) not null,
  supplier_name varchar2(50) not null,
  contact_name varchar2(50),
  constraint u_supplier unique(supplier_id, supplier_name)
);
end;


declare
  v_supplier_name supplier.contact_name%type;
begin
  select user
  into v_supplier_name
  from dual;
  insert into supplier
  (
    supplier_id,
    supplier_name,
    contact_name
  )
  values
  (
    seq_supplier_id.nextval,
    v_supplier_name,
    'Test'
  );
end;

select * from supplier;

Comments

Popular posts from this blog

Solution for "Can not obtain Oracle client information from registry"

Solution for the fault: "System.Diagnostics.Process.Start is not working on IIS, but working on ASP.NET Development Server"