Subject Re: [firebird-support] how to use order by for selected record in insert
Author Uwe Grauer
Mercea Paul wrote:
> Hi
>
> Using FB1.5 I need to copy records from one ID to another in same order
> I have a procedure for copy that contains :
> insert into rpr_com (code, order, complete_descr)
> select :newid, c2.order, c2. complete_descr
> from rpr_comp c2
> where c2. code=:oldid;
>
> I need to order the select by second column (order) ,something like:
> insert into rpr_com (code, order, complete_descr)
> select :newid, c2.order, c2. complete_descr
> from rpr_comp c2
> where c2. code=:oldid order by c2.order;
>
> but I get compilation error when I save the procedure!
>
> How can I insert ? (without using variables)
>
> TIA,
> Paul

It would help to see the compilation error you are getting.
I think "order" is a reserved word in Firebird.

Uwe