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.

Ausgabeformatierung in Oracle

Empfohlene Antworten

Veröffentlicht

Hallo,

kann ich in Oracle Daten formatiert ausgeben?

Bsp.:

Ich will Datensätze einlesen (select * from tabelle). Es gibt in der Tabelle eine Spalte die möchte ich etwas anders ausgeben als sie drin steht.

Sprich in der Spalte steht eine 40. Als Ausgabe möchte ich aber 040 haben. Er soll alle Zahlen in dieser Spalte dreistellig ausgeben und wenn es weniger als drei Stellen sind, dann von vorne mit Nullen auffüllen.

Frank

geht mit format() ... genaue syntax kenn ich grad net, sorry. aber vllt. hast du ja ein book/tut da, wo du nachschlagen kannst...

ansonsten morgen die komplette syntax... :)

schoenen feierabend... :P

ohoh... wie peinlich... :rolleyes:

format() gibt es net... :P

naja, versuch mal das hier:


SELECT LPAD(table_name, 3, '0') FROM table;

LPAD fuegt zeichen links an dem string an... RPAD ist das gleiche fuer rechts... 3 bedeutet, dass der string 3 zeichen lang sein soll und '0' wird angefuegt...

so long

  • 2 Wochen später...

du kannst das z.b. so machen:

select 'Hier kann text Stehen'||sysdate||'und hier wieder' from dual;

oder meintest du das anders ?

oh jetzt hab ich nochmal deinen beitrag angekuckt!

schreib dir doch ne kleine funktion die das für die erledigt!

beispiel:

Function FORMAT

( der_select IN number)

RETURN varchar2 IS

neue_ausgabe varchar2(20);

BEGIN

if der_select < 10 then

neue_ausgabe := '00'||der_select;

end if;

if der_select < 100 then

neue_ausgabe := '0'||der_select;

end if;

RETURN neue_ausgabe;

END;

viel spaß damit

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.