Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 

 
 

ORA-24338: statement handle not executed tips

Oracle Error Tips by Stephanie F.

 

The Oracle docs note this on the ora-24338 error:

 

Error: ORA-24338
Text: statement handle not executed
---------------------------------------------------------------------------
Cause: A fetch was attempted before executing a statement handle.
Action: Execute a statement and then fetch the data.

 

On the Oracle Technology Network Forums, a user posts after having problems with ORA-24338.  The error was occurring after assigning FetchPermission to a new ArrayList, as can be seen in the statement below:

// CLASS CODE
using System;
using System.Collections;
using System.Data;
using Oracle.DataAccess.Client;

namespace SurgAuthenication
{
public class UserAuthenicate
{
// get user permissions for all folders
public ArrayList FetchPermissions(string usr, string srv)
{
string connectString = "";
if ( srv.ToLower() == "demo" )
{
connectString = "Data Source=surgdemo;User ID=surgery;Password=server;pooling=false";
}
else
{
connectString = "Data Source=surgsrv.wrightpatterson.afmc.ds.af.mil;User ID=surgery;Password=server;pooling=false";
}
ArrayList al = new ArrayList();

string sql = "SELECT access_buckslip, " +
"access_messaging, " +
"access_scheduling, " +
"access_supplies, " +
"access_anesthesia, " +
"access_reports, " +
"access_admin " +
"FROM users " +
"WHERE LOWER(username) = LOWER('"+usr+"')";

IDataReader odr = GetDataReader(sql, connectString);

while ( odr.Read() )
{
al.Add(odr["access_buckslip"].ToString());
al.Add(odr["access_messaging"].ToString());
al.Add(odr["access_scheduling"].ToString());
al.Add(odr["access_supplies"].ToString());
al.Add(odr["access_anesthesia"].ToString());
al.Add(odr["access_reports"].ToString());
al.Add(odr["access_admin"].ToString());

}

odr.Close();
odr.Dispose();
return al;
}

private static IDataReader GetDataReader(string sql, string conn)
{
OracleCommand cmd = new OracleCommand();

try
{
cmd.CommandType = CommandType.Text;
cmd.CommandText = sql;
cmd.Connection = new OracleConnection(conn);
cmd.Connection.Open();
return cmd.ExecuteReader(System.Data.CommandBehavior.SingleRow);
}
catch ( Oracle.DataAccess.Client.OracleException oe )
{
if ( cmd.Connection != null )
{
if ( cmd.Connection.State != ConnectionState.Closed )
{
cmd.Connection.Close();
}
}
throw oe;
}
finally
{
cmd.Connection.Close();
cmd.Dispose();
}
}
}
}

// CLIENT CODE
using System;
using System.Collections;
using SurgAuthenication;

namespace Test
{
class MainClass
{
public static void Main(string[] args)
{
string usr;
string conn;
//string folder;
Console.Write("Enter username: ");
usr = Console.ReadLine();
Console.Write("Enter server: ");
conn = Console.ReadLine();
SurgAuthenication.UserAuthenicate au = new UserAuthenicate();
// ERROR OCCURS ON THE NEXT LINE
ArrayList al = new ArrayList(au.FetchPermissions(usr,conn));
IEnumerator en = al.GetEnumerator();

if ( al.Count == 0 )
{
Console.WriteLine("Username does not exist!");
}
else
{
while ( en.MoveNext() )
{
Console.WriteLine(en.Current);
}
}
}
}
}

// TABLE
CREATE TABLE users
(
username varchar2(15) not null,
access_buckslip number(1),
access_messaging number(1),
access_supplies number(1),
access_anesthesia number(1),
access_reports number(1),
access_admin number(1),
CONSTRAINT users_pk PRIMARY KEY(username)
)
TABLESPACES surgtbs

INSERT INTO users VALUES('brockj',3,3,3,3,3,3)
/

  • It was suggested that the Create Table Statement should first be checked to make sure it is all correct.
     
  • The second suggestion was successful in resolving ORA-24338
    • In the GetDataReader method, you are closing and disposing the command object in the finally block. The data reader is a connected object - can you try your code without closing and disposing the command object?

 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster
 
 
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2017

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

Remote Emergency Support provided by Conversational

 

Hit Counter