Collections:
Define a Data Field as NOT NULL in Oracle
How To Define a Data Field as NOT NULL in Oracle?
✍: FYIcenter.com
When defining a specific RECORD type, you can define a data field as NOT NULL to make sure variables with this RECORD type to always have values in this field. A field defined as NOT NULL must have a default value. Here is a tutorial script showing you how to define a data field as NOT NULL:
CREATE OR REPLACE PROCEDURE HELLO AS
TYPE student IS RECORD (
id NUMBER(5) NOT NULL DEFAULT 0,
first_name VARCHAR(80),
last_name VARCHAR(80)
);
best_student student;
another_student student;
class_name VARCHAR2(80);
BEGIN
class_name := 'FYI Center 2006';
best_student.first_name := 'The';
best_student.last_name := 'Best';
DBMS_OUTPUT.PUT_LINE('Best student ID = '
|| best_student.id);
DBMS_OUTPUT.PUT_LINE('Best student = ' ||
best_student.first_name || ' '
|| best_student.last_name);
END;
/
Best student ID = 0
Best student = The Best
⇒ Define a RECORD Variable for a Table Row in Oracle
⇐ Retrieve Field Values from RECORD Variables in Oracle
2018-09-01, 2387🔥, 0💬
Popular Posts:
Why I Can Not Enter 0.001 Second in DATETIME values in SQL Server Transact-SQL? If you enter millise...
How To Select All Columns of All Rows from a Table with a SELECT statement in SQL Server? The simple...
How To Get the Definition of a Stored Procedure Back in SQL Server Transact-SQL? If you want get the...
How To Revise and Re-Run the Last SQL Command in Oracle? If executed a long SQL statement, found a m...
How To Format DATETIME Values to Strings with the CONVERT() Function in SQL Server Transact-SQL? SQL...