in reply to Re^2: how to call stored procedure from ms sql
in thread how to call stored procedure from ms sql

A few questions for you:

  1. can you call the stored procedure from your database shell? (I have no idea what mssql stored procedures should look like, but it's the first thing to try, because if it won't work from your database directly, it's not going to work from a Perl script).
  2. what is the error message that was in the database's error string, that friedo suggested you take a look at? (There might be someone on here who can read minds, but it's sure not me)
  3. could you ennumerate those 'every ways' that you've tried, and what the error messages were from them?
  4. could you give more information about the script, such as which DBD you're using?
  • Comment on Re^3: how to call stored procedure from ms sql

Replies are listed 'Best First'.
Re^4: how to call stored procedure from ms sql
by ephemeralz (Initiate) on Apr 26, 2005 at 00:36 UTC
    1. the ms sql stored procedure is posted in my comment. it does work. 2. there's no error at the prepare statement, the error is at Database error: Can't call method "bind_param" on an undefined value 3. ways tried: $sql = q{ BEGIN :rv := sp_updateStorageSystem(parameter1_in => ?, parameter2_in => ? ); END; }; a) $sth = $dbh->prepare( $sql ) or die $dbh->errstr; b) $sth = $dbh->prepare( "exec sp_updateStorageSystem" ) or die $dbh->errstr; c) $sth = $dbh->prepare( "begin sp_updateStorageSystem end;" ) or die $dbh->errstr; 4. using dbd::odbc how does bind_param works?

      The error message that you are saying happened : Can't call method "bind_param" on an undefined value will only occur, to the best of my knowledge, when the prepare fails, and does not return a statement handle.

      The other possibility is that the statement handle has gone out of scope. Did you declare the scope of the statement handle before you entered the eval block? (this is one of those things that 'use strict' is rather good at catching)

      update:: paragraph 1 conflicted w/ paragraph 2