Starting with pl/pgsql..

From: Terry Yapt <yapt(at)technovell(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Starting with pl/pgsql..
Date: 2002-07-06 10:08:11
Message-ID: 3D26C18B.F954DDF9@technovell.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hello all,

I have starting with PostGreSQL. I come from Oracle 8i and 9i but we want to start using PostGreSQL in a few projects and see if it runs fine.

I have testing now pl/pgsql language. It is very important for me because I have a lot of oracle pl/sql code in all my databases and I think is better do almost everything will be possible on the server than the client...

Ok. I have read all Oracle -> PostGreSQL documents (Programmer, O'reilly book, etc)... and I am trying to do my first pl/pgsql "procedure".

First question:
ONLY functions exists on pl/pgsql ? No Procedures ? No Packages ?

Second question:
I am doing this and obtaining this too:
www=# select x(10,40);
NOTICE: Error occurred while executing PL/pgSQL function x
NOTICE: line 8 at assignment
ERROR: zero-length delimited identifier

I have changed almost everything. The way to do, variable names, etc.. but the same error (or others) I am obtained.

I don't understand anything.... and it is a TEST-EASY function. :-((((

Thanks and best regards..

=============================================================
Table "pepe"
Column | Type | Modifiers
--------+-----------------------+-----------
a | numeric(2,0) | not null
b | character varying(50) |
Primary key: pepe_pkey
=============================================================
-- Function: x(int4, int4)
CREATE FUNCTION "x"("int4", "int4") RETURNS "int4" AS ' DECLARE
inicio alias for $1;
final alias for $2;
--
texto varchar;
BEGIN
FOR X IN inicio..final LOOP
texto := "ESTE ES: " || X;
INSERT INTO pepe VALUES (X, texto);
END LOOP;
END;
' LANGUAGE 'plpgsql';
=============================================================

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Andrew McMillan 2002-07-06 11:35:27 Re: Carraige Return issue
Previous Message Oliver Elphick 2002-07-05 18:56:34 Re: limiting a select