Обсуждение: PL/pgsql

Поиск
Список
Период
Сортировка

PL/pgsql

От
Gustavo Tadao Okida
Дата:
    Hi,

I'm a new PostgreSql user but I have some experience in Oracle. So I 
decided to use PL/pgsql to build my procedure (functions).

I create an database called MyDatabase and add this language into it 
with: createlang plpgsql MyDatabase. After this, I wrote a function with 
pgaccess :

Name: spi_novo_parametro         paramters:
returns: char                                   language: plpgsql

DECLARE   val INTEGER :=1;
BEGIN   insert into identificador_pri values(1, "OK");   RETURN "OK";
END;

It was OK when I saved it in pgaccess front end.

When I tested it, by query tab, writing select spi_novo_parametro();, it 
return me this message:

Error: can't read
"PgAcVar(mw,.pgaw:22,nrecs)": no such element in array

and the stack is:

Error: can't read "PgAcVar(mw,$wn,nrecs)": no such element in array while executing

"For {set row 0} {$row<$PgAcVar(mw,$wn,nrecs)} {incr row}{   if {[lindex $PgAcVar(mw,$wn,nrecs) $row]>$y} break }"
(procedure "Tables::canvasClick" line 5)
invoked from within
"Tables::canvasClick .pgaw:22 229 240" (command bound to event)


Could you help me?

Thanks in advance.

Tadao









Re: PL/pgsql

От
Ian Barwick
Дата:
On Wednesday 25 September 2002 21:38, Gustavo Tadao Okida wrote:
(...)
> After this, I wrote a function with
> pgaccess :
>
> Name: spi_novo_parametro         paramters:
> returns: char                                   language: plpgsql
>
> DECLARE
>     val INTEGER :=1;
> BEGIN
>     insert into identificador_pri values(1, "OK");
>     RETURN "OK";
> END;
>
> It was OK when I saved it in pgaccess front end.
>
> When I tested it, by query tab, writing select spi_novo_parametro();, it
> return me this message:
>
> Error: can't read
> "PgAcVar(mw,.pgaw:22,nrecs)": no such element in array

(...)

I don't know PgAccess, but possibly your function is incorrect
and the errors produced on execution are confusing PgAccess?
Try defining and executing the function in the psql command line client.
This may give you a better idea of what is happening.

I would also strongly recommend replacing the double quotes
with pairs of single quotes, e.g. ''OK'' instead of "OK" .

Ian Barwick
barwick@gmx.net