Calling stored procedures from an OCI application

From: Gunnar Orvarsson <gunnaro_at_hafro.is>
Date: 15 Apr 1994 09:39:59 GMT
Message-ID: <2olndf$o0k_at_hafro.is>


Hi.

I've just installed Oracle 7, and am trying to examine some of the new features it is supposed to offer. One of the most attractive ones are the so-called stored procedures.

We have some applications written in C++ using the OCI interface. What we would like to do is to be able to call the stored procedures from within our applications.

As I'm completely new to this, and have never used PL/SQL before, I haven't been able to make this work properly.

I have one simple table t, with one number column x. I've defined two stored procedures to deal with it.

	create or replace procedure ins (i in integer) as
	begin
		insert into t (x) values(i);
	end;

This one works fine from within the OCI application. I create a statement: like "begin ins(:n) ; end; ", bind a variable to n and everything goes as expected.

However, I would like to be able to bind an out variable as well, and be able to select from the table into it. I've tried the following:

  create or replace procedure list (n in number, x out number) is   begin

        select x into x from t where x = n;
  end;

But this dosn't work. It fails when trying to bind the out variable to the selected column.

Does anyone if this is possible and how this procedure should be written correctly in order to make this work?

Best regards,

--
Gunnar Orvarsson                                 Internet:    gunnaro_at_hafro.is
Hafrannsoknastofnunin/Fiskistofa                 Telephone:   +354 1 697909
(Marine Research Inst./Directorate of Fisheries) Fax:         +354 1 697991
Ingolfsstraeti 1, Reykjavik, Iceland             Home phone:  +354 1 813253
Received on Fri Apr 15 1994 - 11:39:59 CEST

Original text of this message