Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6224401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:39:57+00:00 2026-05-24T08:39:57+00:00

In Perl module I have code like this: … my $param = 123; my

  • 0

In Perl module I have code like this:

 ...
 my $param = 123;
 my $sql = "select id, name from obj where id = ?";
 $sth = $DBH->prepare($sql) || die $DBH->errstr;
 $sth->execute($param) || die $DBH->errstr;
 ...

whern param has value all is well, but in this module there are conditions when you need to select all rows from table (in my code $param = undef)

Does anyone know how to do this without changing the query?

thx!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T08:39:58+00:00Added an answer on May 24, 2026 at 8:39 am

    I usually prefer to solution provided by bohica, but Oracle can do some strange optimizations, and playing a bit with the query can for some queries get much better performance, or much worse. (Always benchmark any solution)

    select * from cust where cust_no = nvl(?, cust_no);
    

    This will match cust_no = ? when the bind variable is set and cust_no = cust_no when the bind variable is null. Oracle does optimize cust_no = cust_no out usually and just returns all rows.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let us say if I have a Perl module Resounces.pm with this code snippet
I have a Perl module that I would like to use from Java. Is
I have a Perl module and I'd like to be able to pick out
I have a module something like this, in lib, called Fool.pm, which is based
I have this code #!/usr/bin/perl -w use strict; use URI; use LWP::UserAgent; use Data::Dumper;
I have a Perl hash of people like this: my $data = { 124535
Scenario 1: I have one wrapper Perl script which uses another Perl module and
I used SWIG to generate a Perl module for a C++ program. I have
I have been trying to use the Perl utility/module "prove" as a test harness
I'm having a little problem with nginx and the Perl FCGI module. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.