Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-26338

Quiz report - ORA-00932: inconsistent datatypes: expected NUMBER got CHAR

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • 2.0.2
    • 2.0.1
    • Quiz

      The quiz review (and reports) are returning the following error (moodle in debug mode):
      Error reading from database

      More information about this error

      Debug info: ORA-00932: inconsistent datatypes: expected NUMBER got CHAR
      SELECT u.id || '#' || COALESCE(qa.attempt, '0') AS uniqueid, qa.uniqueid AS attemptuniqueid, qa.id AS attempt, u.id AS userid, u.idnumber, u.firstname, u.lastname, u.picture, u.imagealt, u.email, qa.sumgrades, qa.timefinish, qa.timestart, qa.timefinish - qa.timestart AS duration , COALESCE((SELECT MAX(qqr.regraded) FROM m_quiz_question_regrade qqr WHERE qqr.attemptid = qa.uniqueid),-1) AS regraded FROM m_user u LEFT JOIN m_quiz_attempts qa ON qa.userid = u.id AND qa.quiz = :quizid WHERE qa.id IS NOT NULL AND qa.preview = 0 ORDER BY uniqueid ASC
      [array (
      'quizid' => '155',
      'oracle_num_rows' => 100,
      )]
      Stack trace:
      line 391 of /lib/dml/moodle_database.php: dml_read_exception thrown
      line 268 of /lib/dml/oci_native_moodle_database.php: call to moodle_database->query_end()
      line 1042 of /lib/dml/oci_native_moodle_database.php: call to oci_native_moodle_database->query_end()
      line 1354 of /lib/tablelib.php: call to oci_native_moodle_database->get_records_sql()
      line 321 of /mod/quiz/report/overview/overview_table.php: call to table_sql->query_db()
      line 1375 of /lib/tablelib.php: call to quiz_report_overview_table->query_db()
      line 391 of /mod/quiz/report/overview/report.php: call to table_sql->out()
      line 90 of /mod/quiz/report.php: call to quiz_overview_report->display()

      I have fixed the error (for Oracle is OK, but it should be tested for the other databases too) updating the following files:

      /var/www/moodle20/mod/quiz/report/responses/report.php

      188c188
      < $fields = $DB->sql_concat('u.id', '\'#\'', 'COALESCE(qa.attempt, \'0\')').' AS concattedid, ';

      > $fields = $DB->sql_concat('u.id', '\'#\'', 'COALESCE(qa.attempt, 0)').' AS concattedid, ';

      /var/www/moodle20/mod/quiz/report/overview/report.php

      < $fields = $DB->sql_concat('u.id', '\'#\'', 'COALESCE(qa.attempt, \'0\')').' AS uniqueid, ';

      > $fields = $DB->sql_concat('u.id', '\'#\'', 'COALESCE(qa.attempt, 0)').' AS uniqueid, ';

            timhunt Tim Hunt
            raduflor2002 Radu Florescu
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.