PDA

View Full Version : Sleeper: Working with Oracle CLOB DataType



bhanupraveen
05-01-2012, 11:55 PM
Hi,

I have a scenario where in i need to connect to Oracle and get data from a table which contains CLOB datatype value. Below is my code:


Dim ConnectionString As String
Dim SQL_String As String
Set con = New ADODB.Connection
Set recset = New ADODB.Recordset
Oracle_Data_Source = "perf01"
Oracle_User = "PERF_OWNER"
Oracle_Password = "PERF_OWNER"
ConnectionString = "Provider=msdaora;Data Source=" + Oracle_Data_Source + "; User Id=" + Oracle_User + "; Password=" + Oracle_Password
con.ConnectionString = ConnectionString
con.Open con.ConnectionString
SQL_String = "select ID,dbms_lob.substr(bus_key,25,10) from MDI_WORK"
recset.Open SQL_String, con, adOpenStatic, adLockReadOnly
Do While Not recset.EOF
Debug.Print recset.Fields(0).Value
Debug.Print recset.Fields(1).Value
Loop

When i try to execute this code, getting "Application Defined or Object Defined error '1004'", Pls help me.

GTO
05-02-2012, 12:28 AM
Greetings,

Welcome to vbaexpress :-)

I see that you just joined, please see Here (http://www.excelguru.ca/content.php?184)

As you just joined, I am sure that not providing that you cross-posted here (http://www.mrexcel.com/forum/showthread.php?t=632801) was simply an oversight. Please consider giving the 'answerers' at one site a chance to answer before posting at multiple sites. As Ken explains better than I, it is frustrating to expend time and effort only to find that someone else is attempting a similar vein.

Mark

Aussiebear
05-02-2012, 02:10 AM
Well said GTO