Board index » delphi » Stored Procedures.......Help Needed For A Stored Procedure {*word*269}

Stored Procedures.......Help Needed For A Stored Procedure {*word*269}

Hi,
Oracle 7.3.3        Delphi 4
I have just started on Stored procedures.  I have sort of got to grips with
the Delphi end but the Oracle end is confusing me.  What I want to do is
something like :-

Select Person.Forename From Person
Where Person.Surname = :ParSurname;

I will be assigning ParSurname on a button click.

Can some one show me how this is done please?  Once I know how to send one
parameter the world is my oyster........hahahaha........

Thanks in advance
--
Anth...@tamesystems.com  Anth...@adcruze.freeserve.co.uk

 

Re:Stored Procedures.......Help Needed For A Stored Procedure {*word*269}


theStoredProc.ParamByName('ParSurName').asString := 'theSurname';
Quote
Anthony D'Cruze wrote:

> Hi,
> Oracle 7.3.3        Delphi 4
> I have just started on Stored procedures.  I have sort of got to grips with
> the Delphi end but the Oracle end is confusing me.  What I want to do is
> something like :-

> Select Person.Forename From Person
> Where Person.Surname = :ParSurname;

> I will be assigning ParSurname on a button click.

> Can some one show me how this is done please?  Once I know how to send one
> parameter the world is my oyster........hahahaha........

> Thanks in advance
> --
> Anth...@tamesystems.com  Anth...@adcruze.freeserve.co.uk

Re:Stored Procedures.......Help Needed For A Stored Procedure {*word*269}


Something like this in Oracle (untested):

create package person_pkg as
  type forename_cur_type is ref cursor;

  procedure get_forename(
    p_surname_vc in varchar2,
    forename_cur in out forename_cur_type
  );
end;

create package body person_pkg as
  procedure get_forename(
    p_surname_vc in varchar2,
    forename_cur in out forename_cur_type
  ) is
  begin
    open forename_cur for
      select forename
      from person
      where surname = p_surname_vc;
  end;
end;

from Delphi (also untested):

with StoredProc1 do
begin
  StoredProcName := 'PERSON_PKG.GET_FORENAME';  // set this at design-time
  ParamByName('p_surname_vc').AsString := Edit1.Text;
  Open;
end;

If Delphi doesn't "autodetect" parameter types, then parameter FORENAME_CUR
should be type ftCursor.

V/R
Russell L. Smith

Quote
Anthony D'Cruze wrote in message <7723qs$f...@forums.borland.com>...
>Select Person.Forename From Person
>Where Person.Surname = :ParSurname;

>I will be assigning ParSurname on a button click.

Other Threads