please give me reply ,,,,solve my problem,,,

i want to access a stored procedure in ORACLE using data control.

Take any example,,,just take a STORED PROCEDURE - which returns addition of 2 numbers,,,I want to access that result using DATA CONTROL.

Please send the code or tell me the process to solve this problem...

Thank you in Advance for your time.
Kishore .

STORED PROCEDURE in ORACLE.
---------------------------
create or replace procedure p(x in number,y in number,z out number) is
begin
z:=x+y;
end;


Comments

  • : create or replace procedure p(x in number,y in number,z out number) is
    : begin
    : z:=x+y;
    : end;

    Why in the world do you want to incur the overhead of database communication just to add two numbers together?

    Secondly, I don't think that a DataControl would work in this case since you're not returning a recordset. You would probably have to create a command object and add parameters for x, y, and z, then Execute it and retrieve your value from the z parameter.

    If you're really intent on using a DataControl to do this, you would probably have to execute an SQL statement that returned your sum as a field in a record for the DataControl to know what to do with it. But for that to work you'd have to change your stored procedure to a stored function. Something like:
    [code]
    create or replace function f(x in number, y in number) return number;

    select f(3,4) as z from dual;
    [/code]
    But if you're going to do that, you might as well just build an SQL string like this:
    [code]
    select 3 + 4 as z from dual;
    [/code]

    I'm hoping that this is just an exercise to learn how to call stored procedures from VB, in which case I refer to my previous statement that you would need to use a Command object and add Parameters for each of the in and out parameters of the stored procedure. I'll leave that up to you.


  • hai every body,
    Infidel's solution to my problem was very perfect,
    Thank you to Infidel,
    thank you very much infidel ..check your guest book...
    Kishore
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories