
Новые сообщения [новые:0]
Дайджест
Горячие темы
Избранное [новые:0]
Форумы
Пользователи
Статистика
Статистика нагрузки
Мод. лог
Поиск
|
|
24.06.2003, 10:51:42
|
|||
|---|---|---|---|
Вопрос по 8 Ораклу и сонверсии типов |
|||
|
#18+
Господа.. Имеем Оракл 8 и : SQL> create table t24 (name char(250)); Таблица создана. SQL> create table t25 (name varchar2(30)); Таблица создана. SQL> insert into t24 values ('SYSDBA'); 1 строка создана. SQL> insert into t25 values ('SYSDBA'); 1 строка создана. SQL> select t24.name from t24, t25 where t24.name = t25.name and t24.name = 'SYSDBA'; строки не выбраны В то время как на 9 Оракле все пучком. Я понимаю, что собака где - то порылась в типах данных. С одной стороны это char, с другой varchar2. Но все же.. как устранить эту ситуацию и почему она возникает? Спасибо. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
|
|
|
24.06.2003, 11:12:32
|
|||
|---|---|---|---|
Вопрос по 8 Ораклу и сонверсии типов |
|||
|
#18+
Используй trim проверка Код: plaintext 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. решение Код: plaintext 1. 2. 3. 4. 5. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
|
|
|
24.06.2003, 11:41:59
|
|||
|---|---|---|---|
Вопрос по 8 Ораклу и сонверсии типов |
|||
|
#18+
Странно... Проверил на 9.2 - no rows selected. Код: plaintext 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
|
|
|
24.06.2003, 11:49:48
|
|||
|---|---|---|---|
Вопрос по 8 Ораклу и сонверсии типов |
|||
|
#18+
to Al Это вы по поводу В то время как на 9 Оракле все пучком. ? PS На 9.0 тоже no rows selected ... |
|||
|
:
Нравится:
Не нравится:
|
|||
|
|
|
24.06.2003, 12:08:47
|
|||
|---|---|---|---|
Вопрос по 8 Ораклу и сонверсии типов |
|||
|
#18+
As Al's example shows in 9i все пучком - statement does not return any rows as it supposed to be . Read about Blank-Padded Comparison Semantics and Nonpadded Comparison Semantics. If one of the operands is VARCHAR2, Oracle will use Nonpadded Comparison Semantics. As a result, t24.name is not equal to t25.name, since "If two values of different length are identical up to the end of the shorter one, the longer value is considered greater". At the same time t24.name = 'SYSDBA' is true since here Oracle uses Blank-Padded Comparison Semantics (t24.name is CHAR). One thing to remember is text literals. They are treated as either CHAR or VARCHAR2 depending on circumstances ("Text literals have properties of both the CHAR and VARCHAR2 datatypes"). For example in t24.name = 'SYSDBA' literal 'SYSDBA' is treated as CHAR to match t24.name while in t25.name = 'SYSDBA' literal 'SYSDBA' is treated as VARCHAR2 to match t25.name. And when comparing two literals they both are treated as CHAR enforcing Blank-Padded Comparison Semantics. For example 'SYSDBA' = 'SYSDBA ' is TRUE. SY ... |
|||
|
:
Нравится:
Не нравится:
|
|||
|
|
|
24.06.2003, 12:09:08
|
|||
|---|---|---|---|
Вопрос по 8 Ораклу и сонверсии типов |
|||
|
#18+
to Al Это вы по поводу В то время как на 9 Оракле все пучком.? PS На 9.0 тоже no rows selected Чес слово.. у меня все ок... на 9-ке ... |
|||
|
:
Нравится:
Не нравится:
|
|||
|
|
|

start [/forum/topic.php?fid=52&mobile=1&tid=1989844]: |
0ms |
get settings: |
10ms |
get forum list: |
18ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
230ms |
get topic data: |
8ms |
get forum data: |
2ms |
get page messages: |
36ms |
get tp. blocked users: |
1ms |
| others: | 234ms |
| total: | 545ms |

| 0 / 0 |
