我是这样写的 select to_char(sysdate,'yyyy/mm/dd hh:mi:ss') from dual 我在sql_plus中对的,但Delphi中用就不对
我用了没有问题啊: Query1.SQL.Text:='select To_Char(SysDate,''YYYY/MM/DD hh:mi:ss'') from dual'; Query1.Open;
最好取得Oracle系统时间前5分种Select TO_CHAR(sysdate-to_date('00:05:00','hh:mi:ss'), 'yyyy/mm/dd hh:mi:ss') MyDate from dual试试吧,没试验,不知是否可行。
strTemp:='select to_char(sysdate,''yyyy/mm/dd hh:mi:ss'') from dual'; with qryOraInventoryItemFile do begin CursorLocation:=clUseServer; CursorType:=ctOpenForwardOnly; LockType:=ltReadOnly; Connection:=cnnOracle; CacheSize:=200; CommandTimeout:=60; SQL.Clear; SQL.Add(strTemp); DisableControls; Active:=true; end; WriteLog(0,qryOraInventoryItemFile.Fields[0].Value); qryOraInventoryItemFile.close; 我这样不对吗?
strTemp:='select to_char(sysdate,''yyyy/mm/dd hh:mi:ss'') from dual'; with qryOraInventoryItemFile do begin CursorLocation:=clUseServer; CursorType:=ctOpenForwardOnly; LockType:=ltReadOnly; Connection:=cnnOracle; CacheSize:=200; CommandTimeout:=60; SQL.Clear; SQL.Add(strTemp); DisableControls; Active:=true; end;应该对了,不过后面那句就不知道对不对了,你可以跟踪运行一下啊
这样不对的 strTemp:='select to_char(sysdate,''yyyy-mm-dd hh:mm:ss'') from dual'; 而这样是对的 strTemp:='select to_char(sysdate,''yyyy-mm-dd'') from dual'; 是对的,我不知道为什么?
select SyDate from dual先把时间取过来 然后在DELPHI中格式化时间格式不就可以了吗?
就是很妖呀 strTemp:='select to_char(sysdate,''yyyy-mm-dd'') from dual'; strTemp:='select to_char(sysdate,''hh:mm:ss'') from dual'; 上面都对。 就是不能一起出来 strTemp:='select to_char(sysdate,''yyyy-mm-dd hh:mm:ss'') from dual';
select to_char(sysdate,'yyyy/mm/dd hh:mi:ss') from dual
我在sql_plus中对的,但Delphi中用就不对
Query1.SQL.Text:='select To_Char(SysDate,''YYYY/MM/DD hh:mi:ss'') from dual';
Query1.Open;
TO_CHAR(sysdate-to_date('00:05:00','hh:mi:ss'), 'yyyy/mm/dd hh:mi:ss') MyDate
from dual试试吧,没试验,不知是否可行。
begin
CursorLocation:=clUseServer;
CursorType:=ctOpenForwardOnly;
LockType:=ltReadOnly;
Connection:=cnnOracle;
CacheSize:=200;
CommandTimeout:=60;
SQL.Clear;
SQL.Add(strTemp);
DisableControls;
Active:=true;
end; WriteLog(0,qryOraInventoryItemFile.Fields[0].Value);
qryOraInventoryItemFile.close;
我这样不对吗?
begin
CursorLocation:=clUseServer;
CursorType:=ctOpenForwardOnly;
LockType:=ltReadOnly;
Connection:=cnnOracle;
CacheSize:=200;
CommandTimeout:=60;
SQL.Clear;
SQL.Add(strTemp);
DisableControls;
Active:=true;
end;应该对了,不过后面那句就不知道对不对了,你可以跟踪运行一下啊
strTemp:='select to_char(sysdate,''yyyy-mm-dd hh:mm:ss'') from dual';
而这样是对的
strTemp:='select to_char(sysdate,''yyyy-mm-dd'') from dual';
是对的,我不知道为什么?
然后在DELPHI中格式化时间格式不就可以了吗?
strTemp:='select to_char(sysdate,''yyyy-mm-dd'') from dual';
strTemp:='select to_char(sysdate,''hh:mm:ss'') from dual';
上面都对。
就是不能一起出来
strTemp:='select to_char(sysdate,''yyyy-mm-dd hh:mm:ss'') from dual';