Hi all
I'm new to PostgreSql
i'm trying to write a simple function

CREATE OR REPLACE FUNCTION insert_tmp_pswd2 (int4, varchar)
RETURNS int4 AS '
DECLARE

tmp VARCHAR;
BEGIN
insert into "ExAfrica".test2 values($1, $2,now());select 1;
END;
'
LANGUAGE 'sql';

i really dont know why he doesnt want to declare new vars...
pls help!
thanks!

I think you're missing a return statement.
You could define a variable which you would assign a value to and then return it.

but the 'select 1' should do the return statement no?

I've just noticed, you're using sql as the language. If you need variables, you'll need to use e. g. plpgsql instead.
To return a select result and use variable, you might need to create a function returning a set or you can assign the result of your select statement into a variable you would return in the code.
Take a look at the examples here:
http://www.postgresql.org/docs/current/static/sql-createfunction.html

i tried to write plpgsql as language but he screams and tells me that he doesnt know this type of language.
i'm using razorSQL.
do u maybe know a good developer for ubuntu?
pgadmin is terrible and so is phppgadmin

What version of PostgreSQL do you use?
You can try to enable plpgsql with a command like this:

createlang -h hostname plpgsql dbname

plpgsql should be enabled by default in PostgreSQL 8.4 and newer, but it might be disabled by default in older versions.

I use pgAdmin, NetBeans, SquirrelSQL or SQL Workbench/J, depending on how much I'm fed up with the lack of autocomplete in pgAdmin. If I don't want to leave the IDE, I use NetBeans, otherwise I tend to use SquirrelSQL. I tend to use SQL Workbench/J if I need to pump some data and need no data transformations.

The paid version of DbVisualizer was very nice when I was trying it out the last time, but it's a bit too expensive for me. Maybe this Christmas...

thanks alot!
i will try what you said on Sunday when i'll return to work.
have a great weekend!

You're quite welcome. I hope what I wrote will be of any help to you.
Have a great weekend too :D