select delivers wrong rowid

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
Tobsel
Posts: 15
Joined: Fri 28 May 2010 12:31

select delivers wrong rowid

Post by Tobsel » Mon 12 Aug 2019 09:14

On one of our customers database a select delivers the wrong rowid. The C# Code looks like this

var conn = new OracleConnection();
conn.Server = "1.1.1.1";
conn.Sid = "XXX";
conn.UserId = "xxx";
conn.Password = "xxx";
conn.Direct = true;
conn.Port = 1521;

conn.Open();
var dt = new DataTable();
var adp = new OracleDataAdapter("select smtp_server, rowid from ext_allgemein", conn);
adp.Fill(dt);

MyDataGrid.ItemsSource = dt.DefaultView;
conn.Close();
MyDataGrid.ItemsSource = dt.DefaultView;
conn.Close();

When I execute the select with the same user on PL/SQL-Developer the rowid is "AGsYahAAGAAAzirAAA". Executing the same select with the code above the rowid is "AAGsYahAAGAAAzirAAA". Just the "G" changes to an "A". We are sure that we are on the correct database because if we change the value of the "SMTP_SERVER" column with PL/SQL Developer to anything else it is also shown in the code (DataTable) above but the rowid is still wrong. We use this rowid for an update and got the invalid rowid exception. We can reproduce this only on one of our customers database. There is not other Table or View with the same name on the database etc.

DB-Version: 12.1.0.2.0
Devart Version: 9.7.734

Do you have any idea?

Shalex
Site Admin
Posts: 8787
Joined: Thu 14 Aug 2008 12:44

Re: select delivers wrong rowid

Post by Shalex » Mon 19 Aug 2019 15:31

Please run the code in a console application:

Code: Select all

    conn.Open();

    var cmd = conn.CreateCommand();
    cmd.CommandText = "select smtp_server, ROWIDTOCHAR(rowid) as string from ext_allgemein";
    var reader = cmd.ExecuteReader();
    while (reader.Read())
    {
        string id = (string)reader.GetValue("string");
        Console.WriteLine(id);
    }
    Console.ReadKey();
Are you getting a correct value (AGsYahAAGAAAzirAAA)?

Tobsel
Posts: 15
Joined: Fri 28 May 2010 12:31

Re: select delivers wrong rowid

Post by Tobsel » Wed 11 Sep 2019 13:42

Yes, it is correct now. It seems to be the "ROWIDTOCHAR(rowid)". But why? We have many running databases where this is not a problem with just selecting "rowid" in the select.

"select smtp_server, rowid from ext_allgemein" works in SQL-Plus Command Windows or PL/SQL-Developer without a problem.

Shalex
Site Admin
Posts: 8787
Joined: Thu 14 Aug 2008 12:44

Re: select delivers wrong rowid

Post by Shalex » Thu 12 Sep 2019 17:48

Please run the code in a console application without ROWIDTOCHAR:

Code: Select all

    conn.Open();

    var cmd = conn.CreateCommand();
    cmd.CommandText = "select smtp_server, rowid as string from ext_allgemein";
    var reader = cmd.ExecuteReader();
    while (reader.Read())
    {
        string id = (string)reader.GetValue("string");
        Console.WriteLine(id);
    }
    Console.ReadKey();
Are you getting a correct value (AGsYahAAGAAAzirAAA) without ROWIDTOCHAR?

Tobsel
Posts: 15
Joined: Fri 28 May 2010 12:31

Re: select delivers wrong rowid

Post by Tobsel » Mon 16 Sep 2019 08:12

Without the "ROWIDTOCHAR" I get the wrong value

Post Reply