MySQL Forums
Forum List  »  Delphi

Error in MySQL routine
Posted by: Jim Sawyer
Date: November 25, 2022 08:42PM

I receive the error message "Active cannot have a null value" when I run the following routine:

ptQuery := TFDQuery.Create( AConnection );
ptQuery.Connection := AConnection;
ptQuery.SQL.Text := 'Update Patient P ' +
'set P.Active = ' +
'( select R.RecDate from Records R ' +
'where R.Patno = P.Patno and R.RecDate between :Dt1 and :Dt2 ' +
'order by R.RecDate desc limit 1 )';
ptQuery.ParamByName('Dt1').AsDate := DateOf( StrToDate('09/13/1936') );
ptQuery.ParamByName('Dt2').AsDate := DateOf( IncYear( Date, -4 ) );
ptQuery.ExecSQL;

How does it need to be altered to prevent the error?

Thanks,
Jim Sawyer

Options: ReplyQuote


Subject
Written By
Posted
Error in MySQL routine
November 25, 2022 08:42PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.