1

My perl script :

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";

passing the value 3687898 for p1

I'm getting this output from the script

3687898 Planned Release 2 OPEN 20-MAY-13

But from Toad I get

3687898 Planned Release 2   OPEN    5/20/2013 3:40:36 AM

I want to get a output with complete date and timing ( 5/20/2013 3:40:36 AM )

Please give a suggestion to me

mpapec
  • 50,217
  • 8
  • 67
  • 127
Kalaiyarasan
  • 267
  • 3
  • 6
  • 13
  • What is the data type of the `entry_date` column? If it's just a `DATE` you're out of luck because that doesn't include a time. – TypeIA Mar 15 '14 at 16:37
  • 2
    http://stackoverflow.com/q/1837974/223226 or check [to_char](http://www.techonthenet.com/oracle/functions/to_char.php) – mpapec Mar 15 '14 at 20:01

1 Answers1

3

Use to_char on entry_date:

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";
Jakub P
  • 542
  • 4
  • 21