?
Solved

Insert row into Oracle table using VBA

Posted on 2000-04-12
5
Medium Priority
?
2,483 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 400 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

765 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