Solved

Passing CLOB value to stored procedure from c# code

Posted on 2008-10-07
1
3,428 Views
Last Modified: 2013-12-17
I have a  stored procedure (as below) which basically iterates through the passed in values array_mq_rid_in and updates the records. array_mq_rid_in value can be greater than 50K so I have its datatype accepted as clob. this stored procedure works fine...

My question is how do I send this string value to clob...from c# method. how do I convert/pass ridCSV to clob type from c# --> "p0.Value = ridCSV; " . Because when I execute below code with more than 50K of ridCSV it throws an exception such as "ORA-01460: unimplemented or unreasonable conversion requested".

C# Method:
public bool MigrateStudies(string ridCSV)
        {
            try
            {
               
                //set parameters
                OracleParameter p0 = new OracleParameter("ARRAY_MQ_RID_IN", OracleType.Clob);
                p0.Value = ridCSV;
                //execute update statement to database
                int rowsAffected = ExecuteNonQuery(CommandType.StoredProcedure, "MIGRATEROWS", p0);
                if (rowsAffected > 0)
                    return true;
                else
                    return false;
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }


SQL Procedure:
PROCEDURE MigrateRows
(
      array_mq_rid_in IN CLOB
)
as
  tbl_rid mdig_util.mq_rid_table;
  currentDate date;
BEGIN
      -- Call Function to convert array_mq_rid_in (csv string) to table
      tbl_rid := mdig_util.CovertRIDStringToArray(array_mq_rid_in);

      -- If tbl_rid returned from the function is not null then continue with update
      IF tbl_rid IS NOT NULL THEN
            FOR i IN tbl_rid.FIRST..tbl_rid.LAST
                  LOOP
                  
                        -- Set migrate now timestamp, also clear postponed or declined status
                        -- and make sure study is queued
                        SELECT SYSDATE into currentDate FROM dual;
                        UPDATE migrationqueue
                              SET POSTPONED = 'NO',
                              postponed_comment = '',
                              declined = 'NO',
                              declined_comment = '',      
                              queued = 'YES',       
                              move_retry = 0,
                              copy_retry = 0,
                              store_retry = 0,       
                              MIGRATE_NOW_TIMESTAMP = currentDate            
                        where rid = (tbl_rid(i));
                      
                  END LOOP;
      END IF;
END MigrateNowStudies;
0
Comment
Question by:darshita00
1 Comment
 

Accepted Solution

by:
darshita00 earned 0 total points
ID: 22661140
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video shows how to recover a database from a user managed backup
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now