Here I have few records.
Id is primary key and auto increment.
Name is Varchar2
Result is Char
Registration Number is unique key and it is combination of Name-Id. How can I make my registration number insert in default like this?
My table looks like:
id. Name. Result. Registration Number
___________________________________________
1. John P. John-1
2. Tom. P. Tom-2
3. John. P. John-3
4. Jerry. F. Jerry-4
CodePudding user response:
try this
CREATE TABLE t1
(
id NUMBER NOT NULL,
FirstName VARCHAR2(20),
LastName VARCHAR2(20),
FullName VARCHAR2(100) GENERATED ALWAYS AS (FirstName || ' ' || LastName || '' || id) VIRTUAL,
PRIMARY KEY (id)
);