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.
Here as Reqname is not defined, the error message has text:line 4(as Reqname is used in line 4 in the sql statement).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();
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
In reply to Pass the values to the sybase stored procedure using DBI-Sybase module and exexute the procedure. by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |