[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: Upper/Lower
>
> This method within SQR is better because, unless you can do the
> processing within a select statement in the first place, it's better to
> manipulate data within SQR than opening a database cursor just to carry
> out something like this.
[...]
>
> >This can be done in SQR with the following command:
> >
> > let $str = upper(substr($str,1,1)) || substr($str,2,length($str) -1)
One important point: this will uppercase the first character in the string,
while using the Oracle "initcap" function uppercases the first character *of
each word* in the string. Also, initcap will make all the other characters
in the string lower case (e.g. "hELLO tHerE" becomes "Hello There"). This
kind of processing isn't easy to do within SQR itself.
Staying within SQR is definitly preferable, both in order to avoid opening a
new cursor and so that the SQR program can be portable across databases.
It would be nice if MITI added a "proper"/"initcap" function to the
language for those situations when you want to capitalize all the words in
a string (rather than just the first one), such as printing a $variable as a
title of a report.
Nathan
----------------------------------------------------------------------------
Nathan Treadway | Ray Ontko & Co. | info@ontko.com (auto-reply server)
nathant@ontko.com | Richmond, IN | ftp.ontko.com, http://www.ontko.com/