My problem can be simplified to the following example:
create table dsort(dfrom date,dto date,pname varchar(10)); insert into dsort(dfrom,dto,pname) values(20