getting return value from a sql function

P

Polina

Hello!

I'm searching a way to get (in vba) the return value of a sql
function. I tried the following code:

Set cn = CreateObject("ADODB.Connection")
cn.ConnectionString = "DSN=;UID=;PWD="
cn.Open
sql = "DECLARE RetVal VARCHAR2(200); BEGIN RetVal :=
USER.MY_SQL_FUNCTION; END; "
cn.Execute sql

My function delivers a string as return value. Does anybody know how
to get it in vba?

Thank you for your help!
Polina
 
R

Rod Gill

Hi,

I've found the easiest way is to create use functions in SQL Server and have
the answer returned as if it was a normal record.

--
For VBA posts, please use the public.project.developer group.
For any version of Project use public.project
For any version of Project Server use public. project.server

Rod Gill
Project MVP
For Microsoft Project companion projects, best practices and Project VBA
development services
visit www.projectlearning.com/
 
P

Polina

Thank you, Rod!
Another way could be a procedure (instead of a function) that writes
the required values in a table. Then it is very simple to get a normal
record.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top