Re: Dynamic "Orde by" parameter in Oracle Stored procedure

From: Carlos <miotromailcarlos_at_netscape.net>
Date: Mon, 16 Aug 2010 12:17:52 -0700 (PDT)
Message-ID: <c0c13b16-37d0-4037-b437-78107c646509_at_m1g2000yqo.googlegroups.com>



On Aug 16, 8:53 pm, Amritha <amritha.da..._at_gmail.com> wrote:
> Hi,
>
> I would like to execute a SELECT * from table1 order by <XYZ>
> and get the results into IN OUT cursor.
>
> I want to pass XYZ as input parameter to stored procedure.
> It is treating it as string.
>
> For example: if XYZ value is field1, it is executing the SQL statement
> as
> SELECT * from table1 order by 'field1'
> instead of
> SELECT * from table1 order by field1
>
> Please help.

Take a look at 'Dynamic SQL'

Cheers.

Carlos. Received on Mon Aug 16 2010 - 14:17:52 CDT

Original text of this message