Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Passing CLOB value to stored procedure from c# code

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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

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…
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Suggested Courses

926 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