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
andsee 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
databasesand 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';
=============================================================