Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Passing CLOB value to stored procedure from c# code

Posted on 2008-10-07
1
Medium Priority
?
3,800 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
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.

719 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