//----------------------SOLVED
OK so I was just trying different things and deleting the ";" at the end of the line solves it *-*. Maybe it can help other people
//---------------------END SOLVED
Hi guys im having a real problem with the OCI driver
i execute this line
SELECT rn, frase, autor FROM (SELECT rownum AS rn, t.frase, t.autor FROM TABLE_frases t) where rn =4;
in the SQL Developer with no problems, I receive the line I want.
but when I do this in my app
if (db.open ()){
query->exec ("SELECT COUNT (*) FROM TABLE_FRASES");
query->next ();
int random_row = this->random_number (query->value (0).toInt ());
query->exec ("SELECT rn, frase, autor FROM (SELECT rownum AS rn, t.frase, t.autor FROM TABLE_FRASES t) WHERE rn = 4;");//+ random_row);
query->next ();
qDebug () << query->value (0).toString ()<< query->value (1).toString ();
if (db.open ()){
query = new QSqlQuery (db);
query->exec ("SELECT COUNT (*) FROM TABLE_FRASES");
query->next ();
int random_row = this->random_number (query->value (0).toInt ());
query->exec ("SELECT rn, frase, autor FROM (SELECT rownum AS rn, t.frase, t.autor FROM TABLE_FRASES t) WHERE rn = 4;");//+ random_row);
query->next ();
QStringList frase_autor;
qDebug () << query->value (0).toString ()<< query->value (1).toString ();
To copy to clipboard, switch view to plain text mode
executing the same line gives the following result:
QSqlQuery::value: not positioned on a valid record
QSqlQuery::value: not positioned on a valid record
"" ""
Anyone knows what the problem might be?
Bookmarks