here is some sample code:

use Pg;  # perl module for PostgreSQL

# connect to the database
        $conn = Pg::connectdb("dbname = $database_name");
        # make sure connection to db was established
        if (PGRES_CONNECTION_OK ne $conn->status) {
                print $conn->errorMessage;
                exit(-1);
        }
        print "connected to db $database_name\n";

# Build query:
        $sql_query = ("UPDATE items \
                SET vendor_group  =  " . $group . " \
                WHERE number      = '" . $row[ITEM_NUMBER] . "' \
                and hub_id      =  " . $row[HUB_ID] . " \
                ");

#Execute query:
        $result = $conn->exec("$_[0]");

#Error Checking:
        if($result->resultStatus ne PGRES_COMMAND_OK &&
        $result->resultStatus ne PGRES_TUPLES_OK) {
                ...
        }

You can build your delete statements and any other queries just by modifying the "Build query:" section.

regards,

Devinder Rajput
Stores Division Corporate Offices
Chicago, IL
(773) 442-6474



Farah <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]

01/01/2003 02:25 AM

       
        To:        [EMAIL PROTECTED]
        cc:        
        Subject:        [ADMIN] postgres & perl



admin, (sorry if my english is not well)

i want to know the perl source code for delete and editing the table values from pgsql. i have a problem of that. can you help me...?


Do you Yahoo!?

Yahoo! Mail Plus - Powerful. Affordable. Sign up now

Reply via email to