xoid
xoid

Reputation: 1134

Execute PgSQL with perl-DBI?

I need to execute complex SQLs at PostgreSQL server .

Something like this:

$sql=<<EOF;
BEGIN;
DO SOME SQL HERE
END;
EOF

$dbh->do($sql) ;

If this is not possible, how can I create and execute stored procedure in DBD::Pg? I have no access to additional software or libraries but perl + DBI

Where is the manuals about how to work with PGSQL by perl-DBI ?

Upvotes: 1

Views: 1634

Answers (2)

user272735
user272735

Reputation: 10648

Yes, it is a very possible to execute a complex SQL and stored procedures from a Perl program. See e.g.

With PostgreSQL the stored procedure execution example from DBI FAQ is:

$dbh->do( "SELECT someProcedure;" );

Upvotes: 2

Szymon Lipiński
Szymon Lipiński

Reputation: 28574

Use the DBD::Pg driver; You can find it at cpan: https://metacpan.org/pod/DBD::Pg

Upvotes: 1

Related Questions