Announcement

Collapse
No announcement yet.

decode statement

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

  • decode statement

    hallo zusammen

    ich suche ein decode statement (oracle) das nicht einfach wenn wert x eingetragen gib wert y aus macht, sondern einfach gib das wo im feld x definiert ist aus.

    also nicht: decode(Feld1,'x','x','nicht x').......
    (wenn "x" in Feld1 steht gib "x" aus ansonten gib "nicht x" aus)

    ich brauche aber ein statemend
    decode('Feld1','','ist leer')......
    (also gib wert aus Feld1 aus wenn das Feld1 leer ist, gib "ist leer" aus)

    wie mache ich das? muss ich im decode statement immer definieren wenn im Feld1 das steht gib das auch aus? kann ich nicht definieren egal was in Feld1 steht gib es aus und ansonsten schreib "ist leer"????

    vielen dank
    Zuletzt editiert von beatles; 16.02.2009, 15:15.

  • #2
    Hi,

    ich vermute Du verwendest Oracle. Für das Verarbeiten von NULL Werten (ich denke das meinst Du mit leer) gibt es die Funktionen NVL bzw. NVL2

    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
      hi dimitri

      ich glaube, das würde nur ansatzweise funktionieren.
      NVL ist ja für wenn Feld null ist gib expr2 aus. ich möchte aber gib das was im Feld ist aus und falls null dann gib "ist leer" aus....

      Comment


      • #4
        Aber genau das macht NVL.

        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

        Working...
        X