From: | Sun Duozhong(孙多忠) <sunduozhong(at)revenco(dot)com> |
---|---|
To: | <pgsql-bugs-owner(at)postgresql(dot)org> |
Subject: | emedded SQL in C to get the record type from plpgsql |
Date: | 2010-01-28 05:01:40 |
Message-ID: | 000001ca9fd6$fc3b4180$f4b1c480$@com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
So how can emedded SQL in C to get the record type which returning from
plpgsql function?
I have tested as following code:
CREATE OR REPLACE FUNCTION test4(IN a integer, OUT b int,OUT c int) AS
$BODY$ declare begin b:=100; c:=200; return; END $BODY$
LANGUAGE 'plpgsql' VOLATILE
COST 100;
// imbedded SQL in C
int test(int a)
{
EXEC SQL TYPE my_type IS STRUCT
{
int b[1];
int c[1];
};
EXEC SQL BEGIN DECLARE SECTION;
my_type ppp;
EXEC SQL END DECLARE SECTION;
EXEC SQL WHENEVER sqlerror SQLPRINT;
EXEC SQL select test4(1) into :ppp;
EXEC SQL COMMIT;
return 0;
}
Running binary cause error:
SQL error: invalid input syntax for type int: "(100,200)",
My project is migrating from Oracle to postgresql,can you help me ?
Regards,
George
------------------------------------------------------------
Duozhong Sun
Guangdong Revenco Enterprise Co. Ltd. AMRI Department
Tel:+86 20 8713 5305,+86 15800005957
Fax:+86 20 87135388
Address:368 Guangzhou Avenue South,Guangzhou 510300,P.R.C.
------------------------------------------------------------
From | Date | Subject | |
---|---|---|---|
Next Message | Craig Ringer | 2010-01-28 06:36:48 | Re: BUG #5298: emedded SQL in C to get the record type from plpgsql |
Previous Message | George | 2010-01-28 04:13:15 | BUG #5298: emedded SQL in C to get the record type from plpgsql |