Executing plpgsql scripts using psql, is that possible?

From: Daniel CAUNE <d(dot)caune(at)free(dot)fr>
To: pgsql-sql(at)postgresql(dot)org
Subject: Executing plpgsql scripts using psql, is that possible?
Date: 2006-01-16 10:35:47
Message-ID: 0IT6005QV7JN4WX1@VL-MO-MR004.ip.videotron.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message John DeSoi 2006-01-16 13:50:58 Re: Executing plpgsql scripts using psql, is that possible?
Previous Message Tom Lane 2006-01-16 00:10:18 Re: What does "merge-joinable join conditions" mean ????