Oracle 10.2 / ODP-NET 10.2.0.2.20 Bugs with DB-Links and Bind Variables



  • Can anyone please test if he can reproduce this bugs. You need 2 Databases to test with ab db link between.

     

     

    		[STAThread]
    		static void Main(string[] args)
    		{
    			const string connectionstring = "user id=master;data source=<dbname here>;password=<password here>";
    			const string sql = "select :1 from dual@<name of a db-link here>";
    			//crashes also with every other select statement that uses strings via bind parameters over db-links
    			Random rng = new Random();
    			// exception occures only with this values
    			int len1 = rng.Next(43,166);
    			int len2 = rng.Next(len1*4+1,666);
    			//also crashes with combinations 
    			// len1=1  len2=5
    			// len1=1  len2=6
    			// len1=1  len2=7
    			// len1=1  len2=8
    			// len1=1  len2=9
    			// len1=1  len2=10
    			// len1=2  len2=7
    			// len1=2  len2=8
    			// len1=2  len2=9
    			// len1=2  len2=10
    			// with all other values of len1 and len2 it works fine
    
    		OracleConnection conn = new OracleConnection(connectionstring);
    		conn.Open();
    
    		using(OracleCommand cmd = conn.CreateCommand())
    		{
    			cmd.CommandText = &quot;alter system flush shared_pool&quot;;
    			cmd.ExecuteNonQuery();
    		}
    
    		using(OracleCommand cmd = conn.CreateCommand())
    		{
    			cmd.CommandText = sql;
    			string val = CreateRandomStringWithLength(len1);
    			cmd.Parameters.Add(&quot;anything&quot;,val);
    			try
    			{
    				string result = (string)cmd.ExecuteScalar();
    				Console.WriteLine(&quot;Statement1: &quot;+result);
    			}
    			catch(Exception ex)
    			{
    				Console.WriteLine(&quot;\nStatement1: Exception\n&quot;+ex.Message);
    			}
    		}
    
    		using(OracleCommand cmd = conn.CreateCommand())
    		{
    			cmd.CommandText = sql;
    			cmd.Parameters.Add(&quot;anything&quot;,CreateRandomStringWithLength(len2));
    			try
    			{
    				string result = (string)cmd.ExecuteScalar();
    				Console.WriteLine(&quot;Statement2: &quot;+result);
    			}
    			catch(Exception ex)
    			{
    				Console.WriteLine(&quot;\nStatement2: Exception\n&quot;+ex.Message);
    			}
    		}
    
    		Console.ReadLine();
    	}
    
    	private static string CreateRandomStringWithLength(int length)
    	{
    		string s = &quot;&quot;;
    		for (int i = 0; i &lt; length; i++)
    		{
    			s += (char)(&#39;C&#39; + rng.Next(20));
    		}
    		return s;
    	}
    
     
     
    I Always got this  
     
    Statement1: OUGCKNNUQHDNEJMDGHSLCGTKLJNCUOPCRRKLKLUSCTPLUIEUP (any string)

    Statement2: Exception
    ORA-01460: unimplemented or unreasonable conversion requested
    ORA-02063: preceding line from NAB


     

Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.