-
It's too late in the afternoon to translate this into German 
Have you maybe read this article? SQL: Made to Order.
The above link does not work anymore, but you can still access it here SQL: Made to Order. (with some extra info as well**).
IMO, using too many "case when" statements makes the statement hard to maintain for the next developer (as you have found). In your example I would definitely use traditional dynamic SQL (at the cost of a slight performance hit) and build the statement into a string.
**For example, you can put your sort sequences into a file and simply fetch the sequence needed. This means should you have a new sequence option, you add it to the file and don't need to even change the program anymore.
Hope this helps.
-
Thank you for your article.
I have to admit that it's getting complex, but until today I used different SQL-Statements for each accumulation criterion and therefore only one criteria could be used at the same time.
Since I wanted to offer our users more possibilities it's necessary to have a dynamic statement.
IMO, the current statement is not too complex (furthermore I'm the only programmer in our team who is able to code RPGIV and SQL ).
In the meantime I've helped myself by arranging the "order by" criterias in a common way, which works in 99% of upcoming cases.
Thanks again and have good remainder of the day.
-- Tobias
-
Für die Sortierung brauchst du Namen und keine Konstanten.
-
Ja... hab' mich nun auch damit abgefunden.
Aber wie oben schon beschrieben, habe ich nun eine passable Lösung für 99% der Fälle. Sollte ein Benutzer die Konstellation für das eine Prozent erwischen, dann muss er sich halt in Excel die Darstellung optimieren
Dankeschön und einen erholsamen Feierabend.
-- Tobias
-
... das ist doch mit dynamic SQL kein Hexenwerk. Du hast bereits eine fixe Tabellenstruktur mit allen potentiellen Feldern in die du eine Variable Struktur mapst, indem du die nicht belegbaren Felder mit Konstanten belegst. Jetzt brauchst du nur noch das SQL Statement für den Insert, das du dir in deinem Programm zusammen baust, inklusive dem order by, ohne das ganze case Gedöns, das macht die Programmlogik - und dieses zusammengebastelte Statement schickst du mit execute gegen die Datenbank und das wars. Warum mit aller Gewalt so kompliziert?
D*B
 Zitat von Tobse77
Ja... hab' mich nun auch damit abgefunden.
Aber wie oben schon beschrieben, habe ich nun eine passable Lösung für 99% der Fälle. Sollte ein Benutzer die Konstellation für das eine Prozent erwischen, dann muss er sich halt in Excel die Darstellung optimieren
Dankeschön und einen erholsamen Feierabend.
-- Tobias
Similar Threads
-
By remo2010 in forum IBM i Hauptforum
Antworten: 2
Letzter Beitrag: 23-11-06, 13:31
-
By ChrisX in forum IBM i Hauptforum
Antworten: 1
Letzter Beitrag: 11-10-06, 15:31
-
By linguin in forum IBM i Hauptforum
Antworten: 6
Letzter Beitrag: 04-08-06, 10:38
-
By steven_r in forum NEWSboard Programmierung
Antworten: 2
Letzter Beitrag: 16-05-06, 07:59
-
By loeweadolf in forum NEWSboard Programmierung
Antworten: 4
Letzter Beitrag: 21-12-05, 19:02
Berechtigungen
- Neue Themen erstellen: Nein
- Themen beantworten: Nein
- You may not post attachments
- You may not edit your posts
-
Foren-Regeln
|
Erweiterte Foren Suche
Google Foren Suche
Forum & Artikel Update eMail
AS/400 / IBM i
Server Expert Gruppen
Unternehmens IT
|
Kategorien online Artikel
- Big Data, Analytics, BI, MIS
- Cloud, Social Media, Devices
- DMS, Archivierung, Druck
- ERP + Add-ons, Business Software
- Hochverfügbarkeit
- Human Resources, Personal
- IBM Announcements
- IT-Karikaturen
- Leitartikel
- Load`n`go
- Messen, Veranstaltungen
- NEWSolutions Dossiers
- Programmierung
- Security
- Software Development + Change Mgmt.
- Solutions & Provider
- Speicher – Storage
- Strategische Berichte
- Systemmanagement
- Tools, Hot-Tips
Auf dem Laufenden bleiben
|
Bookmarks