SPL in 4GL 7.2?
Posted in 2000
Topics: Stored Procedures & SPL, Connectivity: ESQL/C, 4GL & Embedded SQL, Triggers, Constraints & Referential Integrity
Can I call a stored procedure from a 4gl program? My reading of the manuals leaves me confused on the issue. If the answer is yes, what is the syntax? If the answer is no, could I use a trigger that called an SP and fed it some values?
yes.
use a prepare statement to execute the procedure:
define myf1 like mytable.f1
define myf2 like mytable.f2
prepare mystatement from "execute procedure myprocedurename ()"
declare mycursor for mystatement
foreach mycursor into myf1, myf2
...
end foreach
the procedure might look like:
create procedure myprocedurename ()
returning smallint, smallintforeach SELECT bla bla bla from bla bla etc...
return f1, f2 with resume;
end foreach;
return f1, f2;
end procedure
Bradford Young wrote:
> Can I call a stored procedure from a 4gl program? My reading of the
> manuals leaves me confused on the issue. If the answer is yes, what is
> the syntax?
> If the answer is no, could I use a trigger that called an SP and fed it
> some values?
In article <394F7987.93202562@cornercap.com>,
Bradford Young <byoung@cornercap.com> wrote:
> Can I call a stored procedure from a 4gl program? My reading of the
> manuals leaves me confused on the issue. If the answer is yes, what
is
> the syntax?
> If the answer is no, could I use a trigger that called an SP and fed
it
> some values?
>
Try a bit of this in 4gl
let lStmt = 'execute procedure bo222aDat1 (?,?,?)'
prepare pDoPrint from lStmt
declare cDoPrint cursor for pDoPrint
....
foreach cDoPrint using mDatVal1,mDatVal2,mDatVal3
into mVar1,mVar2 .....
end foreach
and this via dbaccess
create dba procedure bo222aDat1( mV1 char(2),mV2 char(2),
mV3 char(2))
returning char(8), char(10);
define tCustomer like opheadm.customer;
define tInvoiceNo like opheadm.invoice_no;
foreach select ~~~~~~~~~
from ~~~~~~~~
where ~~
return tCustomer, tInvoiceNo
with resume;
end foreach;
return tCustomer, tInvoiceNo
with resume;
end procedure;
Sent via Deja.com http://www.deja.com/
Before you buy.