emedded SQL in C to get the record type from plpgsql - Mailing list pgsql-bugs

From Sun Duozhong(孙多忠)
Subject emedded SQL in C to get the record type from plpgsql
Date
Msg-id 000001ca9fd6$fc3b4180$f4b1c480$@com
Whole thread Raw
Responses Re: emedded SQL in C to get the record type from plpgsql
List 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

Address368 Guangzhou Avenue South,Guangzhou 510300,P.R.C.

------------------------------------------------------------

 

pgsql-bugs by date:

Previous
From: Giorgio Valoti
Date:
Subject: Status of submitted bugs
Next
From: Mason Hale
Date:
Subject: Re: unable to fail over to warm standby server