|
|
sybperl-l Archive
Up Prev Next
From: Michael Peppler <mpeppler at mbay dot net>
Subject: Re: stored procedures
Date: Jan 13 1998 2:46PM
Ronald Page wrote:
>
> For some reason this question I sent and in fact no notes since 1/2/98
> have come back to me.
It seems like the list was down for a couple of days (more like a
week, really).
>
> However, after looking at Michael's home page, I figured out the using
> ct_command, ct_send, and ct_param is the way to go.
Yes, that is one of the options.
However, you can also use ct_sql():
$ref = $db->ct_sql("declare @id_key int
exec insert_identity \@id_key output, 1.0, \"sparky\", \"$now\"
select @id_key");
which will put all the results in the array referenced by $ref. This
isn't as clean when the stored procs have OUTPUT params, though...
Michael
>
> > -----Original Message-----
> > From: Ronald Page
> > Sent: Tuesday, January 06, 1998 3:34 PM
> > To: 'SYBPERL-L@trln.lib.unc.edu'
> > Subject: stored procedures
> >
> > Is it possible to execute a stored procedure using "ct_sql"? Or
> > perhaps I should ask, what is the correct way to execute stored
> > procedures using ctlib?
> >
> >
> > For example, using embedded SQL and C, the following works:
> >
> > EXEC SQL EXEC :rc = insert_identity :electronic_identity_key
> > output,
> > 1.0, :account_name, "sparky",
> > :now;
> >
> > What I don't see is how one would specify the return and output
> > variables in Perl/SybPerl. I've tried various combinations including
> >
> > $ref = $db->ct_sql("exec \$rc=insert_identity
> > \$electronic_identity_key output, 1.0, \"sparky\", \"$now\"");
> >
> > Any pointers? Thanks in advance.
> >
> > --
> > Ronald Page
> > Information Technology
> > Arizona State University
--
Michael Peppler -||- Data Migrations Inc.
mpeppler@datamig.com -||- http://www.mbay.net/~mpeppler
|