pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniel CAUNE <d.caune@free.fr>
To: pgsql-sql@postgresql.org
Subject: Executing plpgsql scripts using psql, is that possible?
Date: Mon, 16 Jan 2006 05:35:47 -0500
Message-ID: <0IT6005QV7JN4WX1@VL-MO-MR004.ip.videotron.ca> (raw)

Hi,

I would like to write some administration plpgsql scripts that populate some tables (dimension tables) and to execute them using psql.  I’m not sure that is possible with psql as it is with Oracle sqlplus or SQL Server MSQuery:

Oracle sqlplus:
---------------
DECLARE
  V_MyObjectID bigint;
BEGIN
  V_MyObjectID := RegisterMyObject('a string', 'another string');
  AddObjectProperty(V_MyObjectID, 'a string');
  AddObjectProperty(V_MyObjectID, 'another string');
END;

SQL Server MSQuery:
-------------------
DECLARE @MyObjectID int
SET @MyObjectID = RegisterMyObject('a string', 'another string')
EXECUTE AddObjectProperty(MyObjectID, 'a string');
EXECUTE AddObjectProperty(MyObjectID, 'another string');

Any idea how I can translate such a script for psql?  I mean, without creating a function that wraps the whole, of course! :-)

Thanks,


Daniel




view thread (6+ messages)  latest in thread

Message-ID: <0IT6005QV7JN4WX1@VL-MO-MR004.ip.videotron.ca>
Permalink:  ../0IT6005QV7JN4WX1@VL-MO-MR004.ip.videotron.ca/
Also on:    postgresql.org/message-id/0IT6005QV7JN4WX1@VL-MO-MR004.ip.videotron.ca

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: d.caune@free.fr
  Subject: Re: Executing plpgsql scripts using psql, is that possible?
  In-Reply-To: <0IT6005QV7JN4WX1@VL-MO-MR004.ip.videotron.ca>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox