Announcement

Collapse
No announcement yet.

update feld mit formel in einem anderen feld

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • update feld mit formel in einem anderen feld

    Hallo,
    ich habe folgendes problem.
    Beisp.
    Tabelle mit feldern preis,preisformel,preiskomponente1,preiskomponente 2,...

    Feld preis -> numerisch
    Preisformel -> string
    preiskomponente1,preiskomponente2,... -> numerisch

    Feld preis (als wert !) soll ersetzt werden durch berechnung der formel in preisformel
    In preisformel könnte stehen: preiskomponente1*preiskomponente2+preiskomponente3 .

    wie lautet der sql befehl

    update artikel set preis = preisformel ?????????????????

    Vielen Dank für die Hilfe

  • #2
    Preisformel -> string
    Nein die Formel ist ein Ausdruck, kein String.

    update artikel set preis = preisformel ?????????????????
    Ja genau so:
    Code:
    update artikel set preis = preiskomponente1*preiskomponente2+preiskomponente3
    Dim
    Zitat Tom Kyte:
    I have a simple philosophy when it comes to the Oracle Database: you can treat it as a black box and just stick data into it, or you can understand how it works and exploit it as a powerful computing environment.

    Comment


    • #3
      Danke erst mal für die Anwort. Aber im Feld preisformel steht eine beliebige Formel. Was ich angegeben habe ist nur ein Beispiel. Wenn in jedem Datensatz das gleiche stehen würde hast Du recht. Dann wäre es auch einfach ...

      Comment


      • #4
        Dann musst Du für jede unterschiedliche Formel dein Update eben anders generieren.
        5 verschiedene Formeln -> 5 verschiedene Updates.

        Dim
        Zitat Tom Kyte:
        I have a simple philosophy when it comes to the Oracle Database: you can treat it as a black box and just stick data into it, or you can understand how it works and exploit it as a powerful computing environment.

        Comment


        • #5
          Das Feld Preisformel ist frei belegbar mit Formeln d.h. die Anzahl unterschiedlicher Formeln ist gar nicht absehbar ...

          Comment


          • #6
            Ja und was spricht dem entgegen das anhand des Wertest der dort drinnen steht das Update generiert wird? Wobei ich den Sinn nicht verstehe die komplette Tabelle für jede neue Formel komplett upzudaten.

            Wenn es nur um eine Anzeige geht, kannst Du die Formel auch in einen SELECT einbauen.

            Dim
            Zitat Tom Kyte:
            I have a simple philosophy when it comes to the Oracle Database: you can treat it as a black box and just stick data into it, or you can understand how it works and exploit it as a powerful computing environment.

            Comment


            • #7
              Sinn der Maßnahme ist das Feld Preis entsprechend zu füllen. Eben nach der Vorschrift in Preisformel ... und den in Preiskomponenten eingetragenen Werten.

              Comment


              • #8
                Hallo,

                um es Kurz zu machen: Soetwas wie EVAL() oder EXEC(), mit dem man einen String als Code ausführen kann kennt MySQL nicht. Hier müßtest du dir selbst eine Funktion als Formelparser schreiben.

                Gruß Falk
                Wenn du denkst du hast alle Bugs gefunden, dann ist das ein Bug in deiner Denksoftware.

                Quellcode ohne ein Mindestmaß an Formatierung sehe ich mir nicht an! Ich leiste keinen Privatsupport per Mail oder PN!

                Comment


                • #9
                  Danke für die klare Anwort

                  Viele Grüsse...

                  Comment

                  Working...
                  X