Page 1 of 1

UniDAC. PostgreSQL. How to use RETURNING in Query

Posted: Mon 25 Oct 2010 14:00
by pru
I'm read:
http://www.devart.com/forums/viewtopic. ... =returning
and
http://www.devart.com/forums/viewtopic. ... =returning
But this not work in UniDac :(

How to use RETURNING in Query?

Example:
INSERT INTO distributors (did, dname) VALUES (DEFAULT, 'XYZ Widgets')
RETURNING did;

Posted: Tue 26 Oct 2010 07:12
by AlexP
hello,

In UniDAC the RETURNING statment works correctly as it does in PgDAC.
For example:

CREATE TABLE test
(
id numeric NOT NULL DEFAULT 1,
txt character(50)
)

add the following code to TUniQuery:

INSERT INTO test1(id, txt) VALUES (DEFAULT, 'XYZ Widgets UNI')
RETURNING id

and execute the following commands:

UniQuery1.Open;
ShowMessage(UniQuery1.FieldByName('id').AsString);

you should see a message with the following text: '1'