[GENERAL] function returning select result to JDBC

2013-07-12 Thread giozh
I need to write a function (invoked by a jdbc client) that returns select query result. That function could return also set of row. How should i declare return type of function? -- View this message in context: http://postgresql.1045698.n5.nabble.com/function-returning-select-result-to-JDBC-tp

[GENERAL] function query error: column does not exist

2013-07-11 Thread giozh
i've a function takes as argument some values of few types, and make some INSERT operation using that values. I've occour an error while calling that function, the error is on a varchar variable. this is the insert code: >EXECUTE 'INSERT INTO table VALUES('||value1||','[...]','||value_char||')';

Re: [GENERAL] function with unknown params

2013-07-09 Thread giozh
ok, it works. But why on error message i had that two unknown data type? if was an error on date type, why it don't signal that? -- View this message in context: http://postgresql.1045698.n5.nabble.com/function-with-unknown-params-tp5763215p5763224.html Sent from the PostgreSQL - general mailin

[GENERAL] function with unknown params

2013-07-09 Thread giozh
i've declared and implemented e function like: CREATE OR REPLACE FUNCTION acquistoLotto(m_g INTEGER, grossista VARCHAR(20), produttore BIGINT, costo INTEGER, dat DATE, descr VARCHAR(120), num_prod INTEGER) RETURNS VOID AS $$ but when i'm trying to call it like select acquistoLotto(0, 'grossista'

Re: [GENERAL] unable to call a function

2013-07-07 Thread giozh
ok, now it works with varchar args. thanks -- View this message in context: http://postgresql.1045698.n5.nabble.com/unable-to-call-a-function-tp5762590p5762891.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. -- Sent via pgsql-general mailing list (pgsql-general@p

Re: [GENERAL] unable to call a function

2013-07-05 Thread giozh
so thanks to all for the answers. But i'm going to be frustrated, no one of your solutions seems to work, and i can't understand why, because i've write another two functions that works well... I always obtain error: or unknown function (if i pass args without ' ') or "column not exist". i've notic

Re: [GENERAL] unable to call a function

2013-07-04 Thread giozh
something gone wrong the same... REATE OR REPLACE FUNCTION check_if_if_exist(id integer, table_name character, table_column character) RETURNS boolean AS $BODY$ DECLARE res BOOLEAN; BEGIN EXECUTE 'SELECT EXISTS(SELECT * FROM'||table_name|| 'WHERE'||table_column||'='||$

Re: [GENERAL] unable to call a function

2013-07-04 Thread giozh
ok, i've modify mi function, but now i'm not able to execute it: SELECT check_if_exist(10, table, col); ERROR: column "table" does not exist -- View this message in context: http://postgresql.1045698.n5.nabble.com/unable-to-call-a-function-tp5762590p5762600.html Sent from the PostgreSQL -

Re: [GENERAL] unable to call a function

2013-07-04 Thread giozh
ok, i've modify mi function, but now i'm not able to execute it: SELECT check_if_exist(10, table, col); ERROR: column "table" does not exist -- View this message in context: http://postgresql.1045698.n5.nabble.com/unable-to-call-a-function-tp5762590p5762599.html Sent from the PostgreSQL - ge

[GENERAL] unable to call a function

2013-07-04 Thread giozh
i've write this function that search if inside a specified table there's a specified value: CREATE FUNCTION check_if_if_exist(id INTEGER, table_name character(50), table_column character(20) ) RETURNS BOOLEAN AS $$ BEGIN RETURN EXECUTE 'SELECT EXISTS(SELECT * FROM table_name WHERE table