Hi,
Can anyone please help me to solve this problem?

In a script, I am using a hash variable to retrieve the values from the webpage(using CGI scripting). These values are passed to SYBASE stored procedure to insert into a table.
The problem is when we do not enter values to some of the fields in webpage, the values for some of the keys of hash are undefined; and when i am trying to use this hash(where some of the key values are undefined), I am getting error msg as below
"DBD::Sybase::st execute failed: Server message number=170 severity=15 state=1 line=11 server=SALWEB02 text=Line 4: Incorrect syntax near ','.

For example.

my %FORM; $FORM{Number} = '2'; $FORM{Name} = "test"; $FORM{ReqName}; $FORM{Email}= 'test@mail'; $FORM{Part} = '12'; and $sql = qq!exec ex_proc \@part= $FORMPartNumber}, \@Num = $FORM{Number}, \@Name = $FORM{Name}, \@ReqName= $FORM{ReqName}, \@Email= $FORM{Email}!; $ins_sth = $dbh->prepare($sql); $ins_sth->execute();
Here as Reqname is not defined, the error message has text:line 4(as Reqname is used in line 4 in the sql statement).
and my procedure is as
CREATE PROCEDURE ex_proc (@part nvarchar(128), @Num nvarchar(128), @Name nvarchar(256), @ReqName nvarchar(256), @Email nvarchar(128)) AS INSERT INTO sample (part, Num,Name, ReqName, Email) VALUES ( @part, + @Num, @Name, @ReqName, @Email) GO

Can anyone help me why this error is occuring and how to resolve it?
Thanks in advance.

In reply to Pass the values to the sybase stored procedure using DBI-Sybase module and exexute the procedure. by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.