Home

You are most welcome to share your knowledge with me, send your comments about this training.

SQL QUERIES

Sunday, 4 January 2015

Can not Insert null value



Definition:- You are trying to insert a null value which have not null constraint for department_name column define for it.
you will have to specified value for this column or give a default value for it.

Example:-

 DECLARE
  insert_excep EXCEPTION;
  PRAGMA EXCEPTION_INIT   (insert_excep, -01400);
 BEGIN
  INSERT INTO departments (department_id, department_name) VALUES (280,  NULL);
 EXCEPTION
  WHEN insert_excep THEN
  DBMS_OUTPUT.PUT_LINE('INSERT OPERATION FAILED');
  DBMS_OUTPUT.PUT_LINE(SQLERRM);
 END;

No comments:

Post a Comment