Skip site navigation (1) Skip section navigation (2)

What's wrong in this pltcl function ?

From: Constantin Teodorescu <teo(at)flex(dot)ro>
To: PostgreSQL Interfaces <pgsql-interfaces(at)postgresql(dot)org>
Subject: What's wrong in this pltcl function ?
Date: 2002-10-14 09:14:03
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces
create function ruldeb(bpchar) returns bpchar as '
    set cont $1
    set rulaj 0.0
    spi_exec -array rec "select valoare from valori where debitor LIKE 
\'$cont%\'" {
        set rulaj [expr {$rulaj + $rec(valoare)}]
    if {![info exists GD(conturi_lookup)]} {
        set GD(conturi_lookup) [spi_prepare "select cheie,denumire from 
conturi where id=\'\\$1\'" [list bpchar]]
    spi_execp -count 1 $GD(conturi_lookup) [list $cont]
    return "{$cheie} {$denumire} $rulaj"
' LANGUAGE 'pltcl';

is giving the following error:

ERROR:  pltcl: can't read "cheie": no such variable
can't read "cheie": no such variable
    while executing
"return "{$cheie} {$denumire} $rulaj""
    (procedure "__PLTcl_proc_1759991" line 12)
    invoked from within
"__PLTcl_proc_1759991 4:0:1:1:2:"

Please, could someone give me a clue?

thanks in advance,
Constantin Teodorescu


pgsql-interfaces by date

Next:From: Nigel J. AndrewsDate: 2002-10-14 14:11:27
Subject: Re: What's wrong in this pltcl function ?
Previous:From: John Joseph BachirDate: 2002-10-13 21:14:02
Subject: what versino of perl

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group