Subject Re: [firebird-support] Working with SQL (might be using loop)
Author Tomasz Tyrakowski
On 04.10.2018 at 10:34, Vishal Tiwari vishualsoft@...
[firebird-support] wrote:
> Hi,
> I am trying to get below stuff using SQL only.
> 1. If I have any statement like "World is good enough to enjoy..." then in I need to get SQL out put as"WorlD IS GooD EnougH TO EnjoY..." that is first and last character of each word should be capital letter and rest should be in small letters.
> 2. If I give any number like 007, 10002, 5645 then if the first digit of the integer value is 0 or 1 then a minus sign should be prefixed and if it is not 0 or 1 then it should prefix + sign. We can enter integer value in string format as well if needed. like -007, -10002, +5645...
> 3. Also, I need to make odd position character in capital letter in a given statement like  "World is good enough to enjoy..." should be output as  "WoRlD Is GoOd EnUuGh To EnJoY..."
> SQL for every above points could be sepearte.
> Thanks In Advance.
> With Best Regards.
> Vishal

Don't take offense, but it looks to me like an academic homework rather
than a real world problem (and shouldn't you do your homework by yourself?).
Can you give some justification for this kind of text transformation via
1 and 3 can be done in a stored procedure or execute block statement,
where you have loops at your disposal and you can traverse a string
character by character, I can't think of a simple query doing that.
2 is an easy one, a simple iif and substring should suffice, e.g.:
iif(substring(AFIELD from 1 for 1) in ('0','1'), '-', '+') || AFIELD


__--== Tomasz Tyrakowski ==--__
__--== SOL-SYSTEM ==--__
__--== ==--__