Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

PL/SQL - Abfrage nach Zahl

Empfohlene Antworten

Veröffentlicht

Hallo,

ich habe folgendes Problem:

In einer Oracle-Datenbank soll ich eine Funktion schreiben, die u.a. überprüft, ob in einem String ein nummerischer Wert steht.

Weiß da einer von euch, mir welcher Funktion ich das machen könnte.

Wenn ihr noch weitere Informationen braucht, dann fragt bitte.

Ich danke euch.

Stammt nicht von mir, sondern von nem Kollegen, muss entsprechend umbauen, aber das Pronzip ist, dass man den ASCII Code prüft und schaut, ob es in der Coderange von Zahlen ist.


FUNCTION Check(

     pi_str_ToCheck IN VARCHAR2

  ) 

RETURN

  boolean

IS

    l_num_Char            NUMBER;

    l_num_Length          NUMBER;

    --

  BEGIN


    l_num_Length := LENGTH(pi_str_ToCheck);

    IF l_num_Length > 0 THEN

      --

      FOR idx IN 1..l_num_Length LOOP

  	    --

        l_num_Char := ASCII(SUBSTR(pi_str_ToCheck,idx,1));

        --

        IF NOT (l_num_Char BETWEEN 48 AND 57)  -- 0 ... 9


        THEN

          return FALSE

        END IF;

      END LOOP;

    END IF;

Probiers mal so:

FUNCTION isnumeric ( string IN VARCHAR2) RETURN boolean

IS

n NUMBER;

BEGIN

n := to_number(string);

return(TRUE);

EXCEPTION

when others then

return(FALSE);

END;

Gruß, Axl

Funktioniert.

Ich danke euch.

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.