in reply to Pass the values to the sybase stored procedure using DBI-Sybase module and exexute the procedure.

T-SQL is rejecting the '=,' caused by the empty data. But even if that were filled, you would get another error for the nvarchars because you are entering the data unquoted into the procedure and it would complain with words to the effect: "no such column". This can be resolved by placing quotes around the nvarchar RHS's although not for numeric data. It is unclear what you intend when the data is empty -- should it be accepted or rejected as null? Should the procedure set it to null? Should the referential integrity checks pick it up later? Should the Perl script reject it already? etc. etc.

Update:There is also the related question of whether empty numeric data should become initialised to 0 or whether some other null treatment such as one of the possibilities above should be applied.

-M

Free your mind

  • Comment on Re: Pass the values to the sybase stored procedure using DBI-Sybase module and exexute the procedure.

Replies are listed 'Best First'.
Re^2: Pass the values to the sybase stored procedure using DBI-Sybase module and exexute the procedure.
by Anonymous Monk on Jun 29, 2006 at 04:51 UTC
    Thanks a lot for your suggestion Moron.
    I have modified my code as suggested by you. i.e using quotes for empty data.

    But, actually I have to pass NULL values if the data passed to column is empty. But by using quotes, the value is stored as empty string in the database instead of NULLS.

    Is there anyway to handle this in Perl script itself so that NULL values are passed to the SYBASE stored procedure when the data that is passed to the column is nothing(NULL or no data).

    Thanks a lot to all the Perl Monks for your effort and time!!!

      What I meant to suggest was:

      - numeric data not have quotes in the RHS

      - string data should have quotes in RHS constant assignments

      - but empty data needs a null treatment - such as the NULL keyword.

      I avoided being specific because normally one needs to know more about the database design before suggesting what to do about nulls - it is common for some empty fields to be unnacceptable and whereas this can be controlled by a database constraint, it is now very popular to precontrol it at the data entry point rather than endure the overhead of submitting to the database.

      -M

      Free your mind