Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: substr() woes in GERMAN_GERMANY.WE8MSWIN1252

Re: substr() woes in GERMAN_GERMANY.WE8MSWIN1252

From: Sunil <sunil_franklin_at_hotmail.com>
Date: Wed, 7 Jul 2004 13:49:56 +0530
Message-ID: <_wOGc.12$z9.33@news.oracle.com>


> 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.
>
>

Angelo solved my problem with :



I dont know exactly what u want,
but try this instead:

         l_version_int := to_number(substr(p_version_str, 1, l_position - 1));

If the '.' is in Position 5, you have to take 4 characters with substr to get the first number in a version-vumber.

Gruss,
Angelo


Received on Wed Jul 07 2004 - 03:19:56 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US