Ответить

 

Опции темы
Старый 22.10.2010, 09:36   #11
belov-evgenii
Модератор раздела
 
Аватар для belov-evgenii
 
Регистрация: 03.03.2009
Сообщений: 151
Благодарности: 0
Поблагодарили 45 раз(а) в 45 сообщениях

Обратиться по нику
Цитата выделенного
По умолчанию

Я не спрашивал, возвращает или нет ошибку, я спрашивал, что он возвращает. Где-то идет переполнение строки.
 
В Минюст Цитата Спасибо
Старый 22.10.2010, 18:08   #12
raus
Модератор ФССП
 
Аватар для raus
 
Регистрация: 16.01.2009
Адрес: Россия / /
Сообщений: 3,373
Благодарности: 153
Поблагодарили 548 раз(а) в 528 сообщениях

Обратиться по нику
Цитата выделенного
По умолчанию

ну вот


токмо это бесполезно, ибо не укладывается в 1000 символов

а вот который должен работать, и возвращать сумму прописью - по тому же ИП (да и по всем другим)

__________________
Yo Way Yo, Home Va-Ray,
Yo Ay-Rah, Jerhume Brunnen-G
 
В Минюст Цитата Спасибо
Старый 22.10.2010, 19:46   #13
raus
Модератор ФССП
 
Аватар для raus
 
Регистрация: 16.01.2009
Адрес: Россия / /
Сообщений: 3,373
Благодарности: 153
Поблагодарили 548 раз(а) в 528 сообщениях

Обратиться по нику
Цитата выделенного
По умолчанию

всеж таки пока решил обойтись селектами на каждый разряд, пока дописал до четвертого, дальше лень пока, что хорошо все они влезают в 1000 символов

это еденицы

Код:
select 
case 
when substring(ip.sum_ from position('.' IN ip.sum_) -1 for 1) = 1 then 'один' 
when substring(ip.sum_ from position('.' IN ip.sum_) -1 for 1) = 2 then 'два' 
when substring(ip.sum_ from position('.' IN ip.sum_) -1 for 1) = 3 then 'три' 
when substring(ip.sum_ from position('.' IN ip.sum_) -1 for 1) = 4 then 'четыре' 
when substring(ip.sum_ from position('.' IN ip.sum_) -1 for 1) = 5 then 'пять' 
when substring(ip.sum_ from position('.' IN ip.sum_) -1 for 1) = 6 then 'шесть' 
when substring(ip.sum_ from position('.' IN ip.sum_) -1 for 1) = 7 then 'семь' 
when substring(ip.sum_ from position('.' IN ip.sum_) -1 for 1) = 8 then 'восемь' 
when substring(ip.sum_ from position('.' IN ip.sum_) -1 for 1) = 9 then 'девять' else '' end 
from 
ip 
where 
ip.sum_ > 10 
and 
substring(ip.sum_ from position('.' IN ip.sum_) -2 for 1) <> 1  and ip.pk = :pkip

это неправильные десятки


Код:
select case when substring(ip.sum_ from position('.' IN ip.sum_) -1 for 1) = 0 then 'десять' 
when substring(ip.sum_ from position('.' IN ip.sum_) -1 for 1) = 1 then 'одиннадцать' 
when substring(ip.sum_ from position('.' IN ip.sum_) -1 for 1) = 2 then 'двенадцать' 
when substring(ip.sum_ from position('.' IN ip.sum_) -1 for 1) = 3 then 'тринадцать' 
when substring(ip.sum_ from position('.' IN ip.sum_) -1 for 1) = 4 then 'четырнадцать' 
when substring(ip.sum_ from position('.' IN ip.sum_) -1 for 1) = 5 then 'пятьнадцать' 
when substring(ip.sum_ from position('.' IN ip.sum_) -1 for 1) = 6 then 'шестнадцать' 
when substring(ip.sum_ from position('.' IN ip.sum_) -1 for 1) = 7 then 'семнадцать' 
when substring(ip.sum_ from position('.' IN ip.sum_) -1 for 1) = 8 then 'восемнадцать' 
when substring(ip.sum_ from position('.' IN ip.sum_) -1 for 1) = 9 then 'девятнадцать' else '' end 
from 
ip where ip.sum_ > 10 and substring(ip.sum_ from position('.' IN ip.sum_) -2 for 1) = 1 and ip.pk = :pkip
это правильные десятки

Код:
select case 
when substring(ip.sum_ from position('.' IN ip.sum_) -2 for 1) = 2 then 'двадцать' 
when substring(ip.sum_ from position('.' IN ip.sum_) -2 for 1) = 3 then 'тридцать' 
when substring(ip.sum_ from position('.' IN ip.sum_) -2 for 1) = 4 then 'сорок' 
when substring(ip.sum_ from position('.' IN ip.sum_) -2 for 1) = 5 then 'пятьдесят' 
when substring(ip.sum_ from position('.' IN ip.sum_) -2 for 1) = 6 then 'шестьдесят' 
when substring(ip.sum_ from position('.' IN ip.sum_) -2 for 1) = 7 then 'семьдесят' 
when substring(ip.sum_ from position('.' IN ip.sum_) -2 for 1) = 8 then 'восемьдесят' 
when substring(ip.sum_ from position('.' IN ip.sum_) -2 for 1) = 9 then 'девяносто' else '' end 
from 
ip where ip.sum_ > 19 
and ip.pk = :pkip
это сотни

Код:
select  case 
when substring(ip.sum_ from position('.' IN ip.sum_) -3 for 1) = 1 then 'сто' 
when substring(ip.sum_ from position('.' IN ip.sum_) -3 for 1) = 2 then 'двести' 
when substring(ip.sum_ from position('.' IN ip.sum_) -3 for 1) = 3 then 'триста' 
when substring(ip.sum_ from position('.' IN ip.sum_) -3 for 1) = 4 then 'четыреста' 
when substring(ip.sum_ from position('.' IN ip.sum_) -3 for 1) = 5 then 'пятьсот' 
when substring(ip.sum_ from position('.' IN ip.sum_) -3 for 1) = 6 then 'шестьсот' 
when substring(ip.sum_ from position('.' IN ip.sum_) -3 for 1) = 7 then 'семьсот' 
when substring(ip.sum_ from position('.' IN ip.sum_) -3 for 1) = 8 then 'восемьсот' 
when substring(ip.sum_ from position('.' IN ip.sum_) -3 for 1) = 9 then 'девятьсот' else '' end 
from 
ip where ip.sum_ > 99 
and ip.pk = :pkip
это до девяти тысяч (потом опять неправильные *цать -как они меня достали)

Код:
select case 
when substring(ip.sum_ from position('.' IN ip.sum_) -4 for 1) = 1 then 'одна тысяча' 
when substring(ip.sum_ from position('.' IN ip.sum_) -4 for 1) = 2 then 'две тысячи ' 
when substring(ip.sum_ from position('.' IN ip.sum_) -4 for 1) = 3 then 'три тысячи' 
when substring(ip.sum_ from position('.' IN ip.sum_) -4 for 1) = 4 then 'четыре тысячи' 
when substring(ip.sum_ from position('.' IN ip.sum_) -4 for 1) = 5 then 'пять тысяч' 
when substring(ip.sum_ from position('.' IN ip.sum_) -4 for 1) = 6 then 'шесть тысяч' 
when substring(ip.sum_ from position('.' IN ip.sum_) -4 for 1) = 7 then 'семь тысяч' 
when substring(ip.sum_ from position('.' IN ip.sum_) -4 for 1) = 8 then 'восемь тысяч' 
when substring(ip.sum_ from position('.' IN ip.sum_) -4 for 1) = 9 then 'девять тысяч' else '' end 
from 
ip where ip.sum_ between  1000 and 9999 
and ip.pk = :pkip
вот пока так, есть ошибки? или что то можно оптимизировать?
__________________
Yo Way Yo, Home Va-Ray,
Yo Ay-Rah, Jerhume Brunnen-G
 
В Минюст Цитата Спасибо
Старый 22.10.2010, 19:58   #14
raus
Модератор ФССП
 
Аватар для raus
 
Регистрация: 16.01.2009
Адрес: Россия / /
Сообщений: 3,373
Благодарности: 153
Поблагодарили 548 раз(а) в 528 сообщениях

Обратиться по нику
Цитата выделенного
По умолчанию

ну и копейки отделяем

Код:
select 
substring(ip.sum_ from position('.' IN ip.sum_) +1   for 2) 
from 
ip 
where 
ip.pk = :pkip
__________________
Yo Way Yo, Home Va-Ray,
Yo Ay-Rah, Jerhume Brunnen-G
 
В Минюст Цитата Спасибо
Старый 24.10.2010, 18:32   #15
raus
Модератор ФССП
 
Аватар для raus
 
Регистрация: 16.01.2009
Адрес: Россия / /
Сообщений: 3,373
Благодарности: 153
Поблагодарили 548 раз(а) в 528 сообщениях

Обратиться по нику
Цитата выделенного
По умолчанию

ну и в довесок целая часть числа
Код:
select 
substring(ip.sum_ from 1   for position ('.' IN ip.sum_)-1) 
from 
ip 
where 
ip.pk = :pkip
так проще чем когда то было на форуме....
__________________
Yo Way Yo, Home Va-Ray,
Yo Ay-Rah, Jerhume Brunnen-G
 
В Минюст Цитата Спасибо
Ответить


Быстрый ответ

Сообщение:
Опции


Ваши права в разделе