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

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

by Jenda (Abbot)
on Oct 30, 2019 at 15:59 UTC ( #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 (Curate) 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
Node Status?
node history
Node Type: note [id://11108120]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2020-04-01 09:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    To "Disagree to disagree" means to:









    Results (187 votes). Check out past polls.

    Notices?