Oracle - select from dual

Posts   
 
    
methodman
User
Posts: 194
Joined: 24-Aug-2009
# Posted on: 19-Aug-2011 10:48:36   

Is it possible to create a query

select function(value) from dual;

I know how-to create a function call,but I have no idea how to create the from dual part.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 19-Aug-2011 11:19:17   

You may create a porocedure or function in your oracle schema to wrap the dual select.

methodman
User
Posts: 194
Joined: 24-Aug-2009
# Posted on: 19-Aug-2011 11:45:35   

If I would wrapp the function into other function the wrapper function had to be also executed in a select statement with a "from dual" select, doesn't it?

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 19-Aug-2011 12:08:24   

Not an expert in Oracle, but I thought you can create a stored procedure in your schema/package that would internally execute the select from dual. And return the values.

methodman
User
Posts: 194
Joined: 24-Aug-2009
# Posted on: 19-Aug-2011 12:40:52   

Yes, a procedure would work, but we have a lot of such functions from an legacy db.

I guess it could not be that hard to add some static class named Dual to the generated code which would write just create "from dual" statement. simple_smile

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 19-Aug-2011 13:16:56   

You can add such class to the generated code. Since this have nothing to do with the catalog you are using nor the schema being used, then you won't need a template nor a generated code for it.