chrisgarvey
Technical User
I want to enter a default value if no title is entered into this field. For example 'Untitled'?
I have wrote the following to create the table:
CREATE TABLE my_table
(id number not null
,...
,title varchar2(60) DEFAULT 'Untitled' NOT NULL
, ...);
This allows me to create the table fine.
I now want to enter data into the table, I am using the following insert staitment:
INSERT INTO IPhotograph
(PhotoID, Title, SubjectType, DateTaken, PrintSize, Finish, Colour, PrintExVat, ActualPhotoLoca
VALUES (SEQPhotoID.NEXTVAL, '' , 'Still life', '20-sep-2003', 'A3', 'matt', 'multi', '340.44
/
This code still produces an error message saying Title cannot be null. If I take out the '' totally SQL says there are not enough values.
How do i input a blank field in the Title field. Which should then input by defeault 'Untilited' into the Title field.
Any help would be much appreciated,
Chris
I have wrote the following to create the table:
CREATE TABLE my_table
(id number not null
,...
,title varchar2(60) DEFAULT 'Untitled' NOT NULL
, ...);
This allows me to create the table fine.
I now want to enter data into the table, I am using the following insert staitment:
INSERT INTO IPhotograph
(PhotoID, Title, SubjectType, DateTaken, PrintSize, Finish, Colour, PrintExVat, ActualPhotoLoca
VALUES (SEQPhotoID.NEXTVAL, '' , 'Still life', '20-sep-2003', 'A3', 'matt', 'multi', '340.44
/
This code still produces an error message saying Title cannot be null. If I take out the '' totally SQL says there are not enough values.
How do i input a blank field in the Title field. Which should then input by defeault 'Untilited' into the Title field.
Any help would be much appreciated,
Chris