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.

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

 

Reply via email to