Autor Beitrag
gamoes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 86



BeitragVerfasst: Do 15.06.06 16:19 
Hallo,
ich hab mal wieder ein Problem was ich nicht lösen kann.

In meinem Programm will ich fortlaufende Rechnungsnummern erstellen. Dafür habe ich in meiner Oracle9-DB eine Tabelle erstellt in der ich die Rechnungsnummern eintrage und dann über :

SELECT MAX(RENR)+1 AS nr FROM renummer

abrufe und hochzähle. Die Spalte ReNr ist vom Typ Number
Nun will ich aber nicht mit Nr 1 sondern mit 0001 beginnen. Wenn ich diese Nummer in die DB speichern will, wird dort nur 1 und nicht 0001 abgelegt.
Habe nun schon mal versucht mit einem MaskEdit-Feld das Format festzulegen, aber da werden mir dann auch keine führenden Nullen ausgegeben.

Kann mir da jemand helfen?

Vorab schon mal ein dickes Dankeschön.

Gruß
Gabi
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Do 15.06.06 16:25 
1.) Würde ich die Fähigkeit von Oracle per sequences den wert hozuzählen wählen.
2.) Um die führenden Nullen anzuzeigen, mußt du die zahlen in einen String mit führenden Nullen wandeln.

_________________
Markus Kinzler.
gamoes Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 86



BeitragVerfasst: Do 15.06.06 17:44 
1.)wie geht das hochzählen per sequence?
2) hab ich versucht mit:

if (qry_ReNr['nr']<10) THEN
b:=qry_ReNr['nr'];
//mEd_RNR.Text:='000'+qry_ReNr['nr'];
mEd_RNR.Text:=IntToStr(000+b);

aber da gab es keine Reaktion, führende Nullen erscheinen da nicht.

Gruß
Gabi
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Do 15.06.06 17:50 
Zum Formatieren gibt es die Funktion Format().
Sequences werden beim Erzeugen von Feldern (DDL) angegeben. Genau Syntax müßtes du im Oracle-Manual finden.

_________________
Markus Kinzler.
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Do 15.06.06 22:55 
Format-String '%.4d' sollte helfen. Alles Weitere solltest Du in der DOH unter Format finden ...

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
gamoes Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 86



BeitragVerfasst: Fr 16.06.06 09:43 
Vielen Dank für Eure Hilfe.

Gruß
Gabi