Here is a simple example of a SP and the code for it that I use.

create procedure SavePlanMember
@iPlanId int,
@iUserId int
as

INSERT INTO PlanMembers
 (iPlanId, iUserId)
VALUES (@iPlanId, @iUserId)


my $sth  = $db->prepare(qq|SavePlanMember [EMAIL PROTECTED] = 1111, [EMAIL PROTECTED] 
= 1|)
or die "Can't Prepare " . $db->errstr();
$sth->execute() or die "Can't Execute " $sth->errstr();

I'm using FreeTDS and DBD::Sybase so I can't use placeholders with MS-SQL..

Hope this helps.

-Chris
----- Original Message ----- 
From: "v79k" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 20, 2004 12:45 PM
Subject: Syntax for calling stored procedure from Perl Script


> Hi,
> My Perl script connects to the database(SQL Server
> 2000) and queries it. Also updates a column.
> It works fine but now I have to do it with stored
> procedures. I created the stored procedures
> but am unsure of the syntax to call it from Perl
> script. The procedure takes in one parameter,
> a perl variable say $x.
>
> I even tried without paramaters but in either case get
> the following error.
>
> my $query = $dbh->prepare("{call procedureName ($x)
> }");
>  $query->execute(); # Execute SQL Query!
>
> Error: Incorrect syntax near '{'...
>
>
> I must pass parameters to the stored procedure. the
> procedure exists in the database.
>
> Any help/comments are appreciated.
>
> Thanks,
> vk
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Photos: High-quality 4x6 digital prints for 25c
> http://photos.yahoo.com/ph/print_splash
>

Reply via email to