Home > Archive > PostgreSQL SQL > December 2006 > Type casts with arrays









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Type casts with arrays
stroncococcus

2006-12-06, 7:18 pm

Hy!

I have a problem inside a little Perl script, where I try to do a
casting inside a SQL statement.

my $mature_link_update = $dbh->prepare("UPDATE mature_mirna SET
loop_links = loop_links || CAST (ARRAY[?] AS interger[] WHERE
mat_accession=?");
or
my $mature_link_update = $dbh->prepare("UPDATE mature_mirna SET
loop_links = loop_links || (CAST (? AS interger[]) WHERE
mat_accession=?");

gives me the error:
"ERROR: syntax error at or near "WHERE" at character 75"

How do I use those CAST's exactly?

The primary problem, why I wanted to do this, was that perl didn't do
those casts.
$dbh->prepare("UPDATE mature_mirna SET loop_links = (loop_links ||
ARRAY[?]) WHERE mat_accession=?");
with
$mature_link_update-> execute(int($loop_ta
ble_id), $mat_accession);
gave me the error
operator does not exist: integer[] || text[]

Perhaps someone knows here a solution, too?

Best regards,
Kai

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com