SQL Abfragen (Binärzahlen)

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • SQL Abfragen (Binärzahlen)

    Hallo,
    ich habe eine Oracle Datenbank und hab ein paar Probleme
    1.)
    was mein erstes Problem ist, eine Zahl in eine Binärzahl umzuwandeln, das heißt:
    37 -> 100101

    2.)
    das zweite Problem was ich habe ist, ist das ich mehrere Zahlen habe, sie dann in Binäre Zahlen umwandle und damit Fehler-Abfragen mache. Ich zeig mal ein Beispiel so kann ich es denk ich besser erklären.

    Quellcode

    1. F6 F5 F4 F3 F2 Fehler1
    2. 37 -> 1 0 0 1 0 1
    3. 5 -> 0 0 0 1 0 1
    4. 22 -> 0 1 0 1 1 0



    Überall wo eine 1 steht heißt Fehler.
    Die Abfrage soll so aussehen z.B.:
    Zeige mir die Zahl, überall wo an der 3 und 1 Stelle ein Fehler ist an (als Decimal).
    Das heisst bei unserem Beispiel, die 37 und 5.

    Ich weiss nicht wie ich anfgangen soll, könnte mir jemand beim Code helfen?

    Danke im voraus
  • kannst du 1 und 2 vielleicht zusammen lösen indem du den SQL Datentyp SET verwendest?

    dev.mysql.com/tech-resources/a…s/mysql-set-datatype.html
    The SET datatype is a string type, but is often referred to as a complex type due to the increased complexity involved in implementing them. A SET datatype can hold any number of strings from a predefined list of strings specified during table creation. The SET datatype is similar to the ENUM datatype in that they both work with predefined sets of strings, but where the ENUM datatype restricts you to a single member of the set of predefined strings, the SET datatype allows you to store any of the values together, from none to all of them.[...]