Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: DBD::Sybase prepare statement returns empty query hash but no errstr

by Jenda (Abbot)
on Oct 30, 2019 at 15:59 UTC ( [id://11108120]=note: print w/replies, xml ) Need Help??


in reply to DBD::Sybase prepare statement returns empty query hash but no errstr

OT, not even Sybase cares about newlines so there's no need to bend over backwards with all those quotes and dots.

my $query = $db->{dbh}->prepare( " declare \@skiprows int, \@getrows int; select \@skiprows = $skiprows; select \@getrows = $getrows; set rowcount \@skiprows; select * into #debt from debt order by debt_id, debt_no asc; set rowcount \@getrows; select * from debt where (debt_id NOT IN ( select * from #debt ) ) ORDER BY debt_id, debt_no ASC" );

Jenda
1984 was supposed to be a warning,
not a manual!

  • Comment on Re: DBD::Sybase prepare statement returns empty query hash but no errstr
  • Download Code

Replies are listed 'Best First'.
Re^2: DBD::Sybase prepare statement returns empty query hash but no errstr
by jcb (Parson) on Oct 30, 2019 at 23:53 UTC

    I use a similar syntax for lining up my source code:

    my $st = $dbh->prepare (q[SELECT foo, bar, baz FROM whatever] .q[ WHERE foo = xyz AND bar IS NOT NULL AND ...]);

      The thing is there's no need to close and reopen the string literal. You are working too hard and if you then need to copy&paste the SQL elsewhere you have to work again.

      my $st = $dbh->prepare(q[ SELECT foo, bar, baz FROM whatever WHERE foo = xyz AND bar IS NOT NULL AND ... ]);

      Jenda
      1984 was supposed to be a warning,
      not a manual!

        You do have to close and reopen the literal if you want Emacs to indent your code properly. Emacs indentation commands will not change multi-line string constants.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-20 01:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found