PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: Unable to format sproc output
Date: Apr 28 2004 1:53PM

On Tue, 2004-04-27 at 18:26, Mark Sutfin wrote:
> If there's a better list for this question, please point me in the
> right direction..!
> 
> $ perl -MDBI -le 'print $DBI::VERSION' = 1.42
> $ perl -MDBD::Sybase -le 'print $DBD::Sybase::VERSION' = 1.02
> $ perl -v This is perl, v5.8.2 built for PA-RISC2.0
> Sybase 11.9.2
> HPUX 11i
> 
> I have a stored procedure called from a .pl script. The final
> statement in the sproc is a SELECT from a temporary table, the result
> set from which is stored in a flat file. 
> 
> In the origin table, all columns except col1 are NULLABLE, there are
> no indexes and all columns are CHAR(nn) datatypes.

A NULLABLE char() column will be treated the same way as a varchar()
column, i.e. trailing whitespace will be truncated.

isql will display the formating correctly because it post-processes the
data for display, fetching the max column width and doing something like
a printf("%${width}s", $coldata). 

If you need to output the data in fixed width format then you need to
get this data as well, and do the post-processing in the same way.

IIRC you can use $sth->{PRECISION} to get the length of columns.

Michael   
-- 
Michael Peppler                              Data Migrations, Inc.
mpeppler@peppler.org                       http://www.peppler.org/
Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short
or long term contract positions - http://www.peppler.org/resume.html