Solved

Insert row into Oracle table using VBA

Posted on 2000-04-12
5
2,454 Views
Last Modified: 2013-12-25
I am new to Visual Basic, so please humour me even if this is a dumb question!

I am using VBA in Excel 97. I have used Objects for Session, Database and Dynaset.

I can execute Oracle stored procedures
using :

dim session as object
dim oradatabase as object
dim oradynaset as object
dim query_string as string

Set orasession = CreateObject("OracleInProcServer.XOraSession")

Set oradatabase = orasession.DbOpenDatabase("dbalias", "userid/password", 0&)

query_string = "select oracle_stored_procedure(parm1, parm2) from dual"

set oradynaset = oradatabase.dbcreatedynaset(query_string, 0&)

Everything works out fine!

Now, I want to execute 'Insert into table values( ,  , )' kind of statements. And here I am lost on what is the way to go about achieving this.

This is a one-time code execution, so I don't need to worry about efficiency, modularity, etc.

I would appreciate samples of code which will enable me to do this.

Thanks,
Cuckie.
0
Comment
Question by:cuckie
[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
  • 2
  • 2
5 Comments
 
LVL 4

Expert Comment

by:arcusd
ID: 2710480
ordatabase.execute "insert statment....
0
 

Author Comment

by:cuckie
ID: 2712560
Hi arcusd,

I had tried this y'day afternoon. But for some reason I get the following error on the oradatabase.execute "insert into...." stmt :

Run-time error '438':
Object doesn't support this property or method

0
 
LVL 4

Accepted Solution

by:
gcs001 earned 100 total points
ID: 2713416
An easier way of seeing which properties/methods are available for the Oracle InProcServer is to reference the Oracle InProcServer using the Project-References menu and then to declare them as the appropriate types as in:

Dim OraSession As OraSession
Dim OraDatabase As OraDatabase
Dim OraDynaset As OraDynaset

This is commonly referred to as early binding.

Then if you type in OraDatabase. it will display a dropdown list of available properties/methods for the OraDatabase object.  See if you have ExecuteSQL there.

Regards,
Grant.

0
 

Author Comment

by:cuckie
ID: 2713802
Thanks, Grant.

That did the trick!
0
 
LVL 4

Expert Comment

by:gcs001
ID: 2713868
Pleasure cuckie.
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

687 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