1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
Connected to Oracle9i Enterprise Edition Release 9.2.0.7.0
Connected as mni
SQL>
SQL> create table t_uni
2 (
3 col_type varchar2(10),
4 col_val varchar2(100)
5 )
6 /
Table created
SQL> insert into t_uni
2 select 'CARACT' col_type, 'toto' col_val from dual union all
3 select 'NUM' , '120' from dual union all
4 select 'NUM' , '1180' from dual union all
5 select 'CARACT', 'tutu' from dual
6 /
4 rows inserted
SQL> commit
2 /
Commit complete
SQL> create view v_dif as
2 Select case when col_type = 'CARACT' Then col_val Else Null end val_char,
3 case when col_type = 'NUM' Then to_number(col_val) Else Null end val_num
4 from t_uni
5 /
View created
SQL> select 1
2 from v_dif
3 Where val_num <= 120
4 /
1
----------
1
SQL> |
Partager