Here is the error :#!/usr/bin/perl use strict; use warnings; use DBI; my $dbh = DBI->connect("DBI:Pg:dbname=northwind;host=localhost", "post +gres", "postgres", {'RaiseError' => 1}); my $empid = $dbh->prepare('SELECT DISTINCT("EmployeeID") as empid FROM + "Employees" ORDER BY 1'); $dbh->do("SET search_path to northwind") or die; $empid->execute(); while(my $ref = $empid->fetchrow_hashref()) { $dbh->do("SET search_path to nortwind") or die; $dbh->do("COPY (SELECT encode(\"Photo\", 'hex') FROM \"Employees\" WHERE \"EmployeeID\"='$ref->{'empid'}') TO '/home/postgres/scripts/images/'$ref->{'empid'}.hex'") o +r die; system("/usr/bin/xxd -p -r /home/postgres/scripts/images/'$ref->{'empi +d'}.jpg'"); } $dbh->disconnect(); exit;
Please do help. Thanks TerryDBD::Pg::db do failed: ERROR: syntax error at or near "1." LINE 8: '/home/postgres/scripts/images/'1.hex' ^ at photo.pl li +ne 17. DBD::Pg::db do failed: ERROR: syntax error at or near "1." LINE 8: '/home/postgres/scripts/images/'1.hex' ^ at photo.pl li +ne 17.
In reply to Re: Need help with inserting images to excel from db
by terrykhatri
in thread Need help with inserting images to excel from db
by terrykhatri
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |