Ask a Question related to Coldfusion Database Access, Design and Development.
-
news.tpi.pl #1
SQL query problem
I have a problem.
I try to execute SQL command which return more than 9 columns by DBD:PgPP
and DBI (module).
The procedure return error:
Can't call method "fetch" on an undefined value at
c:/per/site/lib/DBD.PgPP.pm line 330.
If I execute less than 9 collumn is OK.
How I can resolve this problem
Robson
[email]r.wyka@interia.pl[/email]
POLAND
news.tpi.pl Guest
-
Query problem, please help.
mysql Ver 12.22 Distrib 4.0.24, for pc-linux-gnu (i386) gives me: The following database Error occured: You have an error in your SQL syntax.... -
***Sql Query problem
Randy Webb wrote: SELECT DISTINCT OrderID FROM trans WHERE Trans_ID = 1 AND OrderID NOT IN (SELECT DISTINCT OrderID FROM trans WHERE Trans_ID =... -
Query of Query problem
Error Executing Database Query. Query Of Queries runtime error. Table named "DATA" was not found in Memory. It is misspelled, or the table is... -
Query on Query and CF casting problem
I am using a custom tag in MX7 that was working fine in 5 that renders a table. The input to the custom tag is a query and it's columns along with... -
query problem
SELECT top5.PRODID, p.PRODNAME FROM ( SELECT TOP 5 SALES = COUNT(*), PRODID FROM SALES GROUP BY PRODID ORDER BY SALES DESC ) AS top5 INNER JOIN... -
-
news.tpi.pl #3
SQL query problem
I have a problem.
I try to execute SQL command which return more than 9 columns by DBD:PgPP
and DBI (module).
The procedure return error:
Can't call method "fetch" on an undefined value at
c:/per/site/lib/DBD.PgPP.pm line 330.
If I execute less than 9 collumn is OK.
How I can resolve this problem
Robson
[email]r.wyka@interia.pl[/email]
POLAND
news.tpi.pl Guest
-
Michael Budash #4
Re: SQL query problem
In article <bfm09b$5b6$1@atlantis.news.tpi.pl>,
"news.tpi.pl" <mareks1@poczta.onet.pl> wrote:
pls post the pertinent code leading up to and including the 'fetch' part.> I have a problem.
> I try to execute SQL command which return more than 9 columns by DBD:PgPP
> and DBI (module).
> The procedure return error:
> Can't call method "fetch" on an undefined value at
> c:/per/site/lib/DBD.PgPP.pm line 330.
> If I execute less than 9 collumn is OK.
> How I can resolve this problem
>
> Robson
> [email]r.wyka@interia.pl[/email]
> POLAND
>
>
--
Michael Budash
Michael Budash Guest
-
Jeff Boes #5
Re: SQL query problem
At some point in time, "news.tpi.pl" <mareks1@poczta.onet.pl> wrote:
Hmm, that looks like the statement didn't parse properly. Please post code.>I have a problem.
>I try to execute SQL command which return more than 9 columns by DBD:PgPP
>and DBI (module).
>The procedure return error:
>Can't call method "fetch" on an undefined value at
>c:/per/site/lib/DBD.PgPP.pm line 330.
Jeff Boes Guest
-
news.tpi.pl #6
Re: SQL query problem
WINDOWS XP + perl v5.80
I create table:
table
id_odb1 int4 primary key,
id_odb2 int4 not null references
ilosc int2,
stan int2,
rok char(4),
moc char(8),
uwagi char(40),
id_typ int2 not null references,
adapt char(4),
$sth = $conn->prepare("SELECT * from table");
$sth->execute();
my @RAD=$sth->fetchrow_array();
or
$sth = $conn->prepare("SELECT id_odb1,
id_odb2,ilosc,stan,rok,moc,uwagi,id_typ,adapt from tabela");
$sth->execute();
IS ERROR
Can't call method "fetch" on an undefined value at
Unknown message type: ' ' at:c:/per/site/lib/DBD.PgPP.pm line 634.
Can,t call method "fetch" on an undefined value at
c:/per/site/lib/DBD.PgPP.pm line 330.
news.tpi.pl Guest
-
news@roaima.freeserve.co.uk #7
Re: SQL query problem
news.tpi.pl <mareks1@poczta.onet.pl> wrote:
[...]> I create table:
> table
> id_odb1 int4 primary key,
> id_odb2 int4 not null references
> ilosc int2,
You appear to be using Postgres (well, you're using the PgPP driver). INT2> Can,t call method "fetch" on an undefined value at
> c:/per/site/lib/DBD.PgPP.pm line 330.
isn't a valid data type. What is your exact table definition?
Chris
--
@s=split(//,"Je,\nhn ersloak rcet thuarP");$k=$l=@s;for(;$k;$k--){$i=($i+1)%$l
until$s[$i];$c=$s[$i];print$c;undef$s[$i];$i=($i+(ord$c))%$l}
news@roaima.freeserve.co.uk Guest
-
news@roaima.freeserve.co.uk #8
Re: SQL query problem
news.tpi.pl <mareks1@poczta.onet.pl> wrote:
....which is also separately described in comp.lang.perl.modules. Please> I have a problem.
don't multi-post as it splits up the separate threads of discussion.
I've already responded there so I won't repeat myself here.
Cheers,
Chris
--
@s=split(//,"Je,\nhn ersloak rcet thuarP");$k=$l=@s;for(;$k;$k--){$i=($i+1)%$l
until$s[$i];$c=$s[$i];print$c;undef$s[$i];$i=($i+(ord$c))%$l}
news@roaima.freeserve.co.uk Guest
-
news.tpi.pl #9
Re: SQL query problem
Main code:
$database="bpsimple";
$host= "10.10.35.96";
$username="postgres";
$password="";
$conn = DBI->connect("dbi:PgPP:dbname=$database;host=$host;por t=5432",
$username, $password);
doSQL($conn, "DROP TABLE odbiorniki");
doSQL($conn, "CREATE TABLE odbiorniki ( id_odbiornika int4 primary key,
id_odbiorcy int4 not null references odbiorcy (id_odbiorcy),id_producenta
int2 not null references sl_prod (id_producenta), ilosc int2,stan int2, rok
char(4), piek_moc char(8),uwagi char(40), odb_typ int2 not null references
sl_typy (id_typ), adapt char(3))");
open (dat,"dane.txt");
foreach(<dat>){
s/^\s+//; s/\s+$//; chomp ($_);
my
($dat_id,$dat_id_odb,$dat_prod,$dat_szt,$dat_stan, $dat_rok,$dat_piek,$dat_uw
agi,$dat_idtyp)=split(/\;/,$_);
$dat_idtyp =~ s/\s+$//; chomp ($dat_idtyp);
doSQL($conn, "INSERT INTO odbiorniki
(id_odbiornika,id_odbiorcy,id_producenta,ilosc,sta n,rok,piek_moc,uwagi,odb_t
yp,adapt) values
($dat_id,$dat_id_odb,$dat_prod,$dat_szt,$dat_stan, \'$dat_rok\',\'$dat_piek\'
,\'$dat_uwagi\',$dat_idtyp,\'NIE\')");
} close(dat);
sub doSQL
{
open(blad,">>blad_odb.txt");
my ($conn, $command) = @_;
#print $command, "\r";
my $sth = $conn->prepare($command);
my $nrows = $sth->execute;
print "status is ", $DBI::err, "\n" if $DBI::err;
print "#rows affected is ", $nrows, "\n";
print blad "error message: ", $DBI::errstr,"$_", "\n" if $DBI::err;
close(blad);
}
$conn->disconnect;
sub sprawdz_indeks{
if ($index == 0){open(blad,">>blad_odb.txt");
print blad " Nie znaleziono indeksu odbiornika dla
rekordu:\n";
print blad " $_\n";
close(blad);
}}
news.tpi.pl Guest
-
news.tpi.pl #10
Re: SQL query problem
doSQL($conn, "CREATE TABLE odbiorniki ( id_odbiornika int4 primary key,
id_odbiorcy int4 not null references odbiorcy (id_odbiorcy),id_producenta
int2 not null references sl_prod (id_producenta), ilosc int2,stan int2, rok
char(4), piek_moc char(8),uwagi char(40), odb_typ int2 not null references
sl_typy (id_typ), adapt char(3))");
doSQL($conn, "INSERT INTO odbiorcy (
id_odbiorcy,nazwa_odbiorcy,adres_odbiorcy)
values($odb_ewid,\'$odb_nazwa\',\'$odb_adres\')");
sub doSQL
{
open(blad,">>blad_odb.txt");
my ($conn, $command) = @_;
#print $command, "\r";
my $sth = $conn->prepare($command);
my $nrows = $sth->execute;
print "status is ", $DBI::err, "\n" if $DBI::err;
print "#rows affected is ", $nrows, "\n";
print blad "error message: ", $DBI::errstr,"$_", "\n" if $DBI::err;
close(blad);
}
news.tpi.pl Guest
-
news.tpi.pl #11
Re: SQL query problem
Main create table "odbiorniki" code:
-----------------------------------------------
doSQL($conn, "DROP TABLE odbiorniki");
doSQL($conn, "CREATE TABLE odbiorniki ( id_odbiornika int4 primary key,
id_odbiorcy int4 not null references odbiorcy (id_odbiorcy),id_producenta
int2 not null references sl_prod (id_producenta), ilosc int2,stan int2, rok
char(4), piek_moc char(8),uwagi char(40), odb_typ int2 not null references
sl_typy (id_typ), adapt char(3))");
open (dat,"dane.txt");
foreach(<dat>){
my
($dat_id,$dat_id_odb,$dat_prod,$dat_szt,$dat_stan, $dat_rok,$dat_piek,$dat_uw
agi,$dat_idtyp)=split(/\;/,$_);
$dat_idtyp =~ s/\s+$//; chomp ($dat_idtyp);
doSQL($conn, "INSERT INTO odbiorniki
(id_odbiornika,id_odbiorcy,id_producenta,ilosc,sta n,rok,piek_moc,uwagi,odb_t
yp,adapt) values
($dat_id,$dat_id_odb,$dat_prod,$dat_szt,$dat_stan, \'$dat_rok\',\'$dat_piek\'
,\'$dat_uwagi\',$dat_idtyp,\'NIE\')");
} close(dat);
------------------------
news.tpi.pl Guest
-
navee #12
SQL query problem
Hi,
My search query should look for two tables for the matching record. If the record doesn't in table1 look into table2. How to write a query for this example.
Thanks.
navee Guest
-
byron1021 #13
Re: SQL query problem
select col1, col2, tablename = 'tablea' from tablea where x = #somevalue# UNION
select acol as col1, bcol as col2, tablename = 'tableb' from tableb where y =
#somevalue# The column names for Unions must match up, hence the aliasing i
put in for the cols in the second table. Also Union returns distinct record
sets, so if the same record exists in both tables, it would only return one
row. I added the last col in case you needed to know what table the data came
from. This is how I would do it for MS Sql Server.
byron1021 Guest
-
-
Tim Mannah #15
SQL query problem
Can some please take a look at the SQL in this statement and tell me why it
wont work.
The same statement works in MSSQL with hardcoded values instead of the '" &
Replace(MM_valUsername,"'","''" etc.
MM_rsUser.Source = "SELECT dbo.tbMembers.MemberId,
dbo.tbMembers.MemberPass, dbo.tbMembers.email,
MAX(dbo.tbMemberAccessLvl.AccessLvl) AS AccessLvl"
If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source &
"," & MM_fldUserAuthorization
MM_rsUser.Source = MM_rsUser.Source & " FROM dbo.tbMembers INNER JOIN
dbo.tbMemberAccessLvl ON tbMembers.MemberId = tbMemberAccessLvl.MemberID
WHERE (dbo.tbMembers.MemberId='" & Replace(MM_valUsername,"'","''") &"' OR
dbo.tbMembers.email='" & Replace(MM_valUsername,"'","''") &"') AND
dbo.tbMembers.MemberPass='" & Replace(Request.Form("password"),"'","''") &
"' GROUP BY dbo.tbMembers.MemberId, dbo.tbMembers.MemberPass,
dbo.tbMembers.email"
Tim Mannah Guest



Reply With Quote

