Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hallo Robert,
Am 10.12.2011 20:10, schrieb Robert Großkopf:
Hallo Thomas,
vor knapp einem Jahr hatte ich schon mal das Problem, in Base zu einem
Datum eine Anzahl von Jahren zu addieren. Von der Liste (Andreas) bekam
ich Hilfe und hatte dann diese Formel:

CONVERT ( CONVERT ( ( YEAR( "Datumsfeld" ) + "AnzahlJahre" ) , CHAR ) +
'-' + CONVERT ( MONTH( "Datumsfeld" ) , CHAR ) + '-' + CONVERT ( DAY(
"Datumsfeld" ) , CHAR ) , DATE ) AS "Ablauf"

Bis vor ca. 6 Wochen funktionierte das auch. Jetzt bekomme ich aber
immer eine Fehlermeldung:

"SQL-Status: 37000
Fehler-Code: -16
Wrong data type: java.lang.IllegalArgumentException in statement [SELECT
..."

Als Ursache habe ich einstellige Monate bzw. Tage ausgemacht.

Meine nicht sehr elegante Lösung: Mit case when ... bei Bedarf die
fehlende Null eingefügt und es geht.
Da es so eine Funktion wie DATE_ADD in der HSQLDB nicht gibt hier mein
Alternativvorschlag:

  SUBSTRING(CONCAT('0',CONVERT ( MONTH( "Datumsfeld" ) ,CHAR )),-2)

Damit schreibst Du einfach eine 0 vor die jeweiligen Werte und list
nachher von hinten die letzten beiden Strings.

Merkwürdigerweise funktioniert die alternative Anweisung zu CONCAT (||)
nicht in dieser Verschachtelung.

Danke, das ist etwas besser als meine Bastellösung. Übrigens geht bei mir
als Alternative zu concat das + (Pluszeichen).

Thomas

--
Informationen zum Abmelden: E-Mail an users+help@de.libreoffice.org
Probleme? http://de.libreoffice.org/hilfe-kontakt/mailing-listen/abmeldung-liste/
Tipps zu Listenmails: http://wiki.documentfoundation.org/Netiquette/de
Listenarchiv: http://listarchives.libreoffice.org/de/users/
Alle E-Mails an diese Liste werden unlöschbar öffentlich archiviert

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.