ExecSQLEx and Date-Values

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
mxwx
Posts: 25
Joined: Mon 14 Nov 2005 08:22

ExecSQLEx and Date-Values

Post by mxwx » Sat 01 Mar 2008 22:42

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

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Mon 03 Mar 2008 08:27

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]);

Post Reply