PL/pgSQL - ecpg
От | S Kalyanasundaram |
---|---|
Тема | PL/pgSQL - ecpg |
Дата | |
Msg-id | 38F4CE59.444423A9@niksun.com обсуждение исходный текст |
Список | pgsql-sql |
When i call the procedure below from a ecpg program i get sql error too few arguments.. before and after executing the function.. can somebody help me?? thanks in advance ranjani. CREATE FUNCTION insert_zone_man(varchar,varchar,int4,int4) RETURNS int4 AS ' DECLAREtmp RECORD;p_ip ALIAS FOR $1; c_ip ALIAS FOR $2;sts ALIAS FOR $3;zm_flg ALIAS FOR $4; BEGIN IF p_ip ISNOT NULL THEN SELECT INTO tmp ip_address FROM Node WHERE node.ip_address = ''p_ip''; IF NOT FOUND THEN INSERT INTO Node VALUES(c_ip,sts,zm_flg); END IF; END IF; RETURN 1; END; ' LANGUAGE 'plpgsql'; I am calling this function from test.pgc program as follows.. #include <stdio.h> exec sql include sqlca; exec sql whenever sqlerror sqlprint; int main () { exec sql begin declare section;char command[500]; exec sql end declare section; char msg[128]; FILE *dbgs; int i,j; if((dbgs = fopen("log", "w")) != NULL) ECPGdebug(1, dbgs); strcpy(msg, "connect"); exec sql connect to distributed; strcpy(msg, "calling function"); sprintf(command , "SELECT insert_zone_man('10.0.0.1'::varchar,'10.0.0.112'::varchar,1::int,1::int)"); exec sql execute immediate :command; strcpy(msg,"disconnect"); exec sql disconnect; if(dbgs != NULL) fclose(dbgs); return(0); }
В списке pgsql-sql по дате отправления: