The error is "Internal Server Error". As soon as I comment out the (2)lines below: -- TO_CHAR(ie_dollar_amt, '$999,999.99'), it works just fine. Here's the code: ================== #!c:/activeperl/bin/perl use strict; use DBI; use DBD::Oracle; use CGI qw(:standard *table *Tr ); my $dbh = DBI->connect('DBI:Oracle:xx', 'yyy', 'zzz') || die "Couldn't connect to database: " . DBI->errstr; my $NUM_OF_ROWS=0; my %bgca = ( -bgcolor => "#ffffff", -align => "left", ); my $sql = param('sql'); my @cols = param('select'); my $select_list; foreach (@cols) { $select_list .= " $_,"; } chop($select_list) if $select_list; unless ($select_list) { $select_list = '*'; } $sql = " SELECT coban.c_oac_oban ,c_fund_code, DECODE(d_doc_nbr, null, ' ' , d_doc_nbr), TO_CHAR(ie_dollar_amt, '$999,999.99'), DECODE(ie_dollar_amt, null, ' ' , ie_dollar_amt), DECODE(d_cost_cd, null, ' ' , d_cost_cd), DECODE(d_coc, null, ' ', d_coc) FROM cpas_difms cd, (SELECT c_oac_oban, ie_infile, ie_seq_nbr FROM CPAS_LOAD WHERE (ie_infile, ie_seq_nbr) IN (SELECT ie_infile, ie_seq_nbr FROM CPAS_DIFMS WHERE ie_proc_cd='1')) coban WHERE ie_proc_cd='1' AND coban.ie_infile = cd.ie_infile and coban.ie_seq_nbr = cd.ie_seq_nbr UNION ALL SELECT goban.g_oac || goban.g_asn_oban OAC_OBAN, g_fund_code, DECODE(d_doc_nbr, null, ' ', d_doc_nbr), TO_CHAR(ie_dollar_amt, '$999,999.99'), DECODE(ie_dollar_amt, null, ' ' , ie_dollar_amt), DECODE(d_cost_cd, null, ' ' , d_cost_cd), DECODE(d_coc, null, ' ', d_coc) FROM gafs_difms gd, (SELECT g_oac, g_asn_oban,ie_infile, ie_seq_nbr FROM GAFS_LOAD WHERE (ie_infile, ie_seq_nbr) IN (SELECT ie_infile, ie_seq_nbr FROM GAFS_DIFMS WHERE ie_proc_cd='1')) goban WHERE ie_proc_cd='1' AND goban.ie_infile = gd.ie_infile and goban.ie_seq_nbr = gd.ie_seq_nbr"; if (param('sql')) { $sql .= ' '.param('sql'); } my $sth; eval { $sth = $dbh->prepare($sql); }; if ($@) { errman($@); exit; } my $rv; eval { $rv = $sth->execute; }; if ($@) { errman($@); exit; } my (@row_ary, $ar); eval { $ar = $sth->fetchall_arrayref; }; if ($@) { errman($@); exit; } eval { $sth->finish; }; if ($@) { errman($@); exit; } eval { $dbh->disconnect; }; if ($@) { errman($@); exit; } print header( -type =>"text/html" ), start_html( -title => "...", -bgcolor => "#FEF3DE", -font face => "tahoma", -font size => "1",), start_table( { -border => 0, -cellspacing => 3, -width => 700, } ), th( \%bgca, [EMAIL PROTECTED] );
foreach (@$ar) { print start_Tr(), td( \%bgca, $_ ), end_Tr; $NUM_OF_ROWS++; } print end_table; my ($name, $value); print end_html; warn "error: $DBI::errstr\n" if $DBI::err; print ("<p><font size='2'><b>","Query returned $NUM_OF_ROWS records" , "</font></b></p>"); exit(0); ================== -----Original Message----- From: Wiggins d Anconia [mailto:[EMAIL PROTECTED] Sent: Thursday, May 27, 2004 1:31 PM To: MCMULLIN, NANCY; [EMAIL PROTECTED] Subject: Re: displaying to_char formatting in Perl > When attempting to display a formatted string in Perl using Oracle - > > SELECT > TO_CHAR(dollar_amt, '$999,999.99') > FROM > table; > > It breaks the code. It does work as a straight SQL query outside of Perl. Any ideas? > "It breaks the code" is a rather vague statement. How does it break the code? What is the error reported? Are you using DBI? http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>