Page 1 of 1

ExecSQLEx and Date-Values

Posted: Sat 01 Mar 2008 22:42
by mxwx
Hello together,

I am using the following corerctly working code right now

sqltext := 'begin Select to_char(HBEAT,''dd.mm.yyyy hh24:mi:ss'') into :tmpval from USR where idx = 100; end;';
DM1.OraS1.ExecSQLEx(sqltext, ['tmpval', '0']);
Label1.Caption := DM1.OraS1.ParamByName('tmpval').AsString;

what I would really like is to prevent to use to_char and convert the datevalue to a string value. I would rather like to have a "native" date value in tmpval. But when I don't convert I get an ORA-00932 error complaining that either a number (without ' around the 0 in the parameter list) or a string is expected but a date value is given.

How do I tell ExecSQLEx or Oracle that the param is a date value.

Thanks


Michael

Posted: Mon 03 Mar 2008 08:27
by Plash
You can pass a TDateTime value to ExecSQLEx to set the parameter type to ftDateTime. For example:

Code: Select all

DM1.OraS1.ExecSQLEx(sqltext, ['tmpval', Now]);