Requirements:
If the field value is not a numeric or numeric string, update the field value''
1. Function Method (batch release is not allowed ):
[SQL]
- CreateOrReplaceFunctionIsNumber (p_in varchar2)ReturnBooleanAs
- I number;
- Begin
- I: = to_number (p_in );
- ReturnTrue;
- Exception
- WhenOthersThen
- ReturnFalse;
- End;
However, it seems that this can only be judged one by one and cannot be performed in batches.
2.
[SQL]
- SQL>SelectNvl2 (translate ('123','\ 100','\'),'IsCharacters','IsNumber ')FromDual;
- NVL2 (TRANSLATE ('123', '\ 1234567
- ------------------------------
- IsNumber
- SQL>SelectNvl2 (translate (333,'\ 100','\'),'IsCharacters','IsNumber ')FromDual;
- NVL2 (TRANSLATE (333, '\ 123456789
- ------------------------------
- IsNumber
- SQL>SelectNvl2 (translate ('Aaaaa','\ 100','\'),'IsCharacters','IsNumber ')FromDual;
- NVL2 (TRANSLATE ('Aaaaa', '\ 12345
- ------------------------------
- IsCharacters
- SQL>
3. It is said that batch query is required. You can check it out first, but you have not tried it:
[SQL]
- SelectDecode (nvl2 (translate (Column,'\ 100','\'),'0','1'),'1', Column ,'')FromDual;
I wrote:
[SQL]
- UpdateT_87_MtbufSetSpCode ='' WhereNvl2 (translate (SpCode,'\ 100','\'),'IsCharacters','IsNumber') ='IsCharacters ';
Add:
To_number (...) can only accept numbers such as 122 or numeric string '123456'. If 'aaa' is accepted, an error "invalid character" is returned ".