Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8577899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:15:50+00:00 2026-06-11T20:15:50+00:00

Possible Duplicate: Why Do I get OutOfRange Exception in GetOrdinal Function of this CLOB

  • 0

Possible Duplicate:
Why Do I get OutOfRange Exception in GetOrdinal Function of this CLOB field?

I need to read a CLOB field from an ORACLE table int a C# variable of type String. Does anyone know how to accomplish this task? 

This is what I have done but I am getting an IndexOutofRange when calculating the GetOrdinal of the field. Thanks in advance.

 public void ReadFunction(string FName, out string fContent) 
{ 
    OracleCommand command = _connection.CreateCommand(); 
    OracleTransaction transaction = _connection.BeginTransaction(); 
    command.Transaction = transaction; 
    command.CommandText = "SELECT TO_CLOB(TO_NCLOB(FUNCTION_SCRIPT)) FROM IS_FUNCTION where   FNAME=:fName "; 
    command.Parameters.Add("FName", OracleType.NVarChar).Value = FName; 
    OracleDataReader odr = command.ExecuteReader(); 
    int temp = odr.GetOrdinal("FUNCTION_SCRIPT"); 
    OracleLob myLob = odr.GetOracleLob(temp); 
    fContent = (String)myLob.Value; 
    odr.close(); 
} 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T20:15:51+00:00Added an answer on June 11, 2026 at 8:15 pm

    This is the code to get the Blob, then you should cast it as astring in the way you need it. I do not know the format you need.

      // create and open connection
      // change for your environment
      string connStr = "User Id=pm; Password=pm; Data Source=orcllx; Pooling=false";
      OracleConnection con = new OracleConnection(connStr);
      try
      {
        con.Open();
      }
      catch (OracleException ex)
      {
        MessageBox.Show(ex.Message);
      }
    
      // statement to get a blob
      string sql = "select ad_composite from print_media where product_id=3106 and
                   ad_id=13001";
    
      // create command object
      // InitialLOBFetchSize
      //  defaults to 0
      OracleCommand cmd = new OracleCommand(sql, con);
    
      cmd.InitialLOBFetchSize = 8192;
    
      // create a datareader
      OracleDataReader dr = cmd.ExecuteReader();
    
      // read the single row result
      try
      {
        dr.Read();
      }
      catch (OracleException ex)
      {
        MessageBox.Show(ex.Message);
      }
    
      // use typed accessor to retrieve the blob
      OracleBlob blob = dr.GetOracleBlob(0);
    
      // create a memory stream from the blob
      MemoryStream ms = new MemoryStream(blob.Value);
    
      // set the image property equal to a bitmap
      // created from the memory stream
      pictureBox1.Image = new Bitmap(ms);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Get query string values in JavaScript I need a function to read
Possible Duplicate: Get all files from VSS for a given date? I need to
Possible Duplicate: Get column index from label in a data frame I need to
Possible Duplicate: Get random item from array I need a code to set a
Possible Duplicate: Get Variable from httpcontext coming from NSUrlRequest This question will be a
Possible Duplicate: get site name from a URL in python For URLs like this:
Possible Duplicate: Get all Attributes from a HTML element with Javascript/jQuery I need to
Possible Duplicate: Get file name from URI string in C# How to extract file
Possible Duplicate: Get a list of dates between two dates This is my sql:
Possible Duplicate: Get output from a process Executing DOS commands from Java I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.