Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Can't execute sql

by ibanix (Hermit)
on Jan 28, 2003 at 19:18 UTC ( [id://230694]=note: print w/replies, xml ) Need Help??


in reply to Can't execute sql

I am not well versed in DBI, but I'll take some guesses:

* Do you really mean to say $$dbh->prepare($sql)? That would deference $dbh, I believe -- maybe you just want $dbh->prepare($sql)?

* What's on line 209? Is it the $sth->execute() statement?

* Have you checked that DB-specific driver (DBD::whatever) for the ct_cmd_alloc error? Or the DBI docs?

Sorry I can't be more helpful,
ibanix

$ echo '$0 & $0 &' > foo; chmod a+x foo; foo;

Replies are listed 'Best First'.
Re: Re: Can't execute sql
by mnlight (Scribe) on Jan 28, 2003 at 19:33 UTC
    yes line 209 is $sth->execute()
    I do execute similar code in a different sub routine. The only difference is the sql statement.
    In this code I am executing a stored proc in the other code I am executing a select statement that fetches the database name.
    As you can see I do successfully get the database name D_CHRIS
    The $$dbh is correct. We use our own module that passes back references from $app.
      Check the the user running the script has correct rights to run the stored proc?

      Try some test cases against the stored proc?

      ibanix $ echo '$0 & $0 &' > foo; chmod a+x foo; foo;

      Knowing the database still would help. How SP's are executed differs across databases. In Oracle, for example, I need to surround the SP to be executed with BEGIN/END statements like this:

      $sth = $dbh->prepare(" BEGIN :1:=util.end_of_day(:2); END; ");
        Database is Sybase user is sa.
        If I cut and paste the sql from the error message and run it on the Sybase server it works just fine. I have run it with the exec, execute and with out.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://230694]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2024-04-24 12:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found