SUBSTR HELP. [message #61387] |
Tue, 20 April 2004 12:12 |
Yass Zoel
Messages: 7 Registered: April 2004
|
Junior Member |
|
|
Here is the situation:
SQL> select distinct(load_id) from clm where grpmo_prcsmnth_dt >=200301 and grpmo_prcsmnth_dt <200401;
LOAD_ID
----------
0
14
15
16
17
18
19
20
9 rows selected.
LOAD_ID is NUMBER(3)
Now I created a new field clmfac_drg_vsn NUMBER(2)
I wanted to update the new field with the same number of LOAD_ID, so I tried the follwoing:
update CLM set clmfac_drg_vsn=substr(load_id,1,2) where grpmo_prcsmnth_dt >= 200301;
AND
update CLM set clmfac_drg_vsn=substr(load_id,2,2) where grpmo_prcsmnth_dt >= 200301;
for BOTH times I got the same result which is :
SQL> select distinct(clmfac_drg_vsn) from clm where grpmo_prcsmnth_dt >=200301 and grpmo_prcsmnth_dt <200401;
CLMFAC_DRG_VSN
--------------
0
4
5
6
7
8
9
8 rows selected.
Of course they suppose to be exactly Like LOAD_ID
What am I missing here?
PLease HELP, Thanks in advance....
|
|
|
Re: SUBSTR HELP. [message #61389 is a reply to message #61387] |
Tue, 20 April 2004 21:21 |
Anatol Ciolac
Messages: 113 Registered: December 2003
|
Senior Member |
|
|
try
update CLM set clmfac_drg_vsn=substr(to_char(load_id),2,2) where grpmo_prcsmnth_dt >= 200301;
I am not verified but think that will work.
|
|
|
Re: SUBSTR HELP. [message #61390 is a reply to message #61387] |
Tue, 20 April 2004 21:22 |
Anatol Ciolac
Messages: 113 Registered: December 2003
|
Senior Member |
|
|
try
update CLM set clmfac_drg_vsn=substr(to_char(load_id),1,2) where grpmo_prcsmnth_dt >= 200301;
I am not verified but think that will work. If will not work then try to change numbers in substr function.
|
|
|