Re: How to perform JOINs with DBI

From: Tim Bunce (Tim.Bunce_at_pobox.com)
Date: 07/24/04


Date: Sat, 24 Jul 2004 08:06:13 +0100
To: "Moreno, Javier" <JavierMoreno@eaton.com>

On Fri, Jul 23, 2004 at 12:19:24PM -0500, Moreno, Javier wrote:
> Hi all,
>
> I am having issues trying to do the following:
>
> SELECT I.idIssue, I.Description, I.idEntry, I.idStatus, E.Description, E.CreateDate, E.idPriority,
> E.idSeverity, E.idUser, E.DueDate FROM MASTER_Issue I, MASTER_Entry E WHERE I.idIssue = ? AND I.idEntry
> = E.idEntry
>
> The query runs fine but I get no information back from it. What could be wrong? I ran the same query
> (replacing the placeholder with the value) on the database and it ran fine and returned information.

If I.idIssue is a CHAR type field then you'll need to tell DBD::Oracle
to bind the placeholder as a CHAR. Otherwise the value is bound as a varchar
and oracle doesn't use the blank-padded-comparison-semantics that you need.

        use DBI qw(:sql_types);

        ...
        $sth->bind_param(1, $foo, SQL_CHAR);

Tim.



Relevant Pages

  • Re: Using DBI, Set Select to Variable
    ... What I can't figure out is how to load it to a single variable if I ... This suggestion is missing how to pass the placeholder value to the query: ... The second argument is used to pass options to the query. ... pass in an undef so that the values for the placeholders ...
    (comp.lang.perl.misc)
  • Re: insert a dictionary into sql data base
    ... Carsten Haese wrote: ... > The main thing to note here is that we *are* using string formatting to ... > build a query that's based on a variable table name and a variable column ... and in another instance it was a placeholder sent to the dbapi ...
    (comp.lang.python)
  • Re: search and replace a SQL query
    ... > i want to search through the query and for every placeholder insert a variable ... to escape them (with backslashes), not quote them: ...
    (perl.beginners)
  • Re: crosstab query filtered by form
    ... data point and ignore the placeholder "~". ... >> report, our company's regions down the side. ... >> that some of the regions don't sell all of the products, ... >> way to include all products in the query even if they're ...
    (microsoft.public.access.queries)
  • Re: inserting data coming from a hash
    ... Would I just use a placeholder in my statement and pass it in via ... # data that match the order of your query. ... (q{insert blah blah values ... # stuff to insert and just hash-slice it ...
    (perl.dbi.users)