Create table of words.
create table words (word varchar2(10))
Table created.
Create trigger that strips leading and trailing blanks from words before they are inserted into table.
create or replace trigger trim_word
before insert on words
for each row
begin
:new.word := trim(:new.word);
end;
Trigger created.
Insert word with leading and trailing blanks.
insert into words (word) values (' Hello ')
1 row(s) inserted.
Insert another word with leading and trailing blanks.
insert into words (word) values (' World ')
1 row(s) inserted.
Display words and their lengths.
select word, length(word) from words
WORD | LENGTH(WORD) | Hello | 5 | World | 5 |
---|