X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5043D9DC806 for ; Mon, 16 Jan 2006 02:35:50 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68471-09 for ; Mon, 16 Jan 2006 02:35:49 -0400 (AST) X-Greylist: delayed 01:00:00.478713 by SQLgrey- Received: from relais.videotron.ca (relais.videotron.ca [24.201.245.36]) by postgresql.org (Postfix) with ESMTP id 4F7ED9DC802 for ; Mon, 16 Jan 2006 02:35:47 -0400 (AST) Received: from lythanhphu ([66.130.233.129]) by VL-MO-MR004.ip.videotron.ca (Sun Java System Messaging Server 6.2-2.05 (built Apr 28 2005)) with ESMTP id <0IT6005QU7JN4WX1@VL-MO-MR004.ip.videotron.ca> for pgsql-sql@postgresql.org; Mon, 16 Jan 2006 00:35:47 -0500 (EST) Date: Mon, 16 Jan 2006 05:35:47 -0500 From: Daniel CAUNE Subject: Executing plpgsql scripts using psql, is that possible? To: pgsql-sql@postgresql.org Message-id: <0IT6005QV7JN4WX1@VL-MO-MR004.ip.videotron.ca> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Mailer: Microsoft Office Outlook, Build 11.0.6353 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: quoted-printable Thread-index: AcYaiJzwdRA5/frKSKmJ/b2i3qJssA== X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=2.007 required=5 tests=[DATE_IN_FUTURE_03_06=2.007] X-Spam-Score: 2.007 X-Spam-Level: ** X-Archive-Number: 200601/87 X-Sequence-Number: 23876 Hi, I would like to write some administration plpgsql scripts that populate = some tables (dimension tables) and to execute them using psql. = I=E2=80=99m 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 :=3D RegisterMyObject('a string', 'another string'); AddObjectProperty(V_MyObjectID, 'a string'); AddObjectProperty(V_MyObjectID, 'another string'); END; SQL Server MSQuery: ------------------- DECLARE @MyObjectID int SET @MyObjectID =3D 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