Solved

Passing CLOB value to stored procedure from c# code

Posted on 2008-10-07
1
3,628 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
darshita00 earned 0 total points
ID: 22661140
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

751 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