我的perl脚本:
my $dbh = DBI->connect("DBI:Oracle:MIGSTG","AI","migrate") or die " can't connect to db";
$data = "select package_id,action,line_seq,status,entry_date from pack_pr_queue where package_id = :p1";
$sth = $dbh->prepare($data) or die " cannnot prepare the select";
$sth->bind_param( ":p1", $package );
$sth->execute() or die "cannot execute";
while (@row = $sth->fetchrow_array) {
print "@row";
为p1
我从脚本
获得此输出3687898 Planned Release 2 OPEN 20-MAY-13
但是从Toad我得到了
3687898 Planned Release 2 OPEN 5/20/2013 3:40:36 AM
我希望获得完整日期和时间的输出(2013年5月20日上午3:40:36)
请给我一个建议
答案 0 :(得分:2)
在entry_date上使用to_char:
to_char(entry_date,'DD/MM/YYYY HH:MI:SS AM')
$data = "select package_id,action,line_seq,status,to_char(entry_date,'DD/MM/YYYY HH:MI:SS AM') from pack_pr_queue where package_id = :p1";