简体   繁体   中英

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 ?

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

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM