Solved

Passing CLOB value to stored procedure from c# code

Posted on 2008-10-07
1
3,560 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

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…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

821 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