Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: substr() woes in GERMAN_GERMANY.WE8MSWIN1252
In article <zCNGc.2$z9.51_at_news.oracle.com>, sunil_franklin_at_hotmail.com
says...
> Experts,
> I have code like the following which works when NLS_LANG env variable is
> not set but the moment I set my nls_lang variable to
> GERMAN_GERMANY.WE8MSWIN1252, it fails with " ORA-06502: PL/SQL: numerisch
> oder Wertefehler : Fehler bei Konvertierung von Zeichen zu Zahl "
> Any ides on how to overcome this.
>
> function get_major_version(p_version_str in varchar2)
> return pls_integer as
> l_position integer;
> l_version_int integer;
> begin
> l_position := instr(p_version_str, '.');
> l_version_int := to_number(substr(p_version_str, 1, l_position));
> return l_version_int;
> end;
>
> Thanks,
> Sunil.
>
>
>
If you just want the integer part of the number, you can also use TRUNC.