Ron,
Here goes
# Retrieve all infomation for this issue and store on variables
$::sql = "SELECT I.idIssue, I.Description, I.idEntry, I.idStatus, E.Description,";
$::sql.= " E.CreateDate, E.idPriority, E.idSeverity, E.idUser, E.DueDate";
$::sql.= " FROM MASTER_Issue I, MASTER_Entry E";
$::criteria_var = "I.idIssue";
$::criteria = $::in{'MASTER_Issue.idIssue'};
$::add_criteria = "AND I.idEntry = E.idEntry";
$::reference = &SQL_Select($::sql, $::criteria_var, $::criteria, $::add_criteria);
# This routine will select information from the database depending on the parameters
passed on to it
sub SQL_Select {
my ($sql, $criteria_field, $criteria, $add_criteria) = @_;
# Append criteria if present
if ($criteria_field && $criteria) {
$sql.= " WHERE $criteria_field = ?";
}
# Any AND, OR or additional clauses
if ($add_criteria) {
$sql.= " $add_criteria";
}
# Prepare a SQL statement
my $sth = $::dbh->prepare( $sql ) or
&Error("Unable to prepare statement.");
# Execute the SQL statement prepared above, use with or without criteria
depending on if it is present
# or not
if ($criteria) {
my $rc = $sth->execute ( $criteria ) or
&Error("Unable to execute statement", "$sql with criteria
$criteria");
} else {
my $rc = $sth->execute or
&Error("Unable to execute statement", $sql);
}
# Return an array reference pointing to the results
return my $result = $sth->fetchall_arrayref;
}
-----Original Message-----
From: Reidy, Ron [mailto:[EMAIL PROTECTED]
Sent: Friday, July 23, 2004 12:54 PM
To: Moreno, Javier; [EMAIL PROTECTED]
Subject: RE: How to perform JOINs with DBI
Javier,
Post your Perl code (relevant peices only).
rr
-----Original Message-----
From: Moreno, Javier [mailto:[EMAIL PROTECTED]
Sent: Fri 7/23/2004 11:35 AM
To: Reidy, Ron; [EMAIL PROTECTED]
Cc:
Subject: RE: How to perform JOINs with DBI
Ron,
It returns the row I need.
Regards,
Javier Moreno
-----Original Message-----
From: Reidy, Ron [mailto:[EMAIL PROTECTED]
Sent: Friday, July 23, 2004 12:33 PM
To: Moreno, Javier; [EMAIL PROTECTED]
Subject: RE: How to perform JOINs with DBI
Javier,
What does it do in SQL*Plus?
rr
-----Original Message-----
From: Moreno, Javier [mailto:[EMAIL PROTECTED]
Sent: Fri 7/23/2004 11:31 AM
To: Reidy, Ron; [EMAIL PROTECTED]
Cc:
Subject: RE: How to perform JOINs with DBI
Ron,
This is the Oracle query
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 = 'I4632362004' AND I.idEntry = E.idEntry
Per Alan Kong's suggestion I tried single quoting the value but that did not work
either.
Regards,
Javier Moreno
-----Original Message-----
From: Reidy, Ron [mailto:[EMAIL PROTECTED]
Sent: Friday, July 23, 2004 12:24 PM
To: Moreno, Javier; [EMAIL PROTECTED]
Subject: RE: How to perform JOINs with DBI
Javier,
This is not a DBI issue. What does the query do in SQL*Plus? Is the relationship
between the tables mandatory, or should you be using an outer or inner join?
--
Ron Reidy
Sr, DBA
Array BioPharma, Inc.
-----Original Message-----
From: Moreno, Javier [mailto:[EMAIL PROTECTED]
Sent: Fri 7/23/2004 11:19 AM
To: [EMAIL PROTECTED]
Cc:
Subject: How to perform JOINs with DBI
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.
Regards,
Javier Moreno
----------------
<<ole0.bmp>>
Systems Engineer - Transmissions
"When you have eliminated all which is impossible, then whatever remains, however
improbable, must be the truth" - Sherlock Holmes
This electronic message transmission is a PRIVATE communication which contains
information which may be confidential or privileged. The information is intended
to be for the use of the individual or entity named above. If you are not the
intended recipient, please be aware that any disclosure, copying, distribution
or use of the contents of this information is prohibited. Please notify the
sender of the delivery error by replying to this message, or notify us by
telephone (877-633-2436, ext. 0), and then delete it from your system.
This electronic message transmission is a PRIVATE communication which contains
information which may be confidential or privileged. The information is intended
to be for the use of the individual or entity named above. If you are not the
intended recipient, please be aware that any disclosure, copying, distribution
or use of the contents of this information is prohibited. Please notify the
sender of the delivery error by replying to this message, or notify us by
telephone (877-633-2436, ext. 0), and then delete it from your system.
This electronic message transmission is a PRIVATE communication which contains
information which may be confidential or privileged. The information is intended
to be for the use of the individual or entity named above. If you are not the
intended recipient, please be aware that any disclosure, copying, distribution
or use of the contents of this information is prohibited. Please notify the
sender of the delivery error by replying to this message, or notify us by
telephone (877-633-2436, ext. 0), and then delete it from your system.