SQL is not supported in OpenEdge Classes

Posted by atuldalvi123 on 26-Aug-2016 06:47

Is there any way to execute the SQL statements in class objects ?

All Replies

Posted by Mike Fechner on 26-Aug-2016 06:57

I guess the compiler has already answered your question.

SQL is not supported in classes. (13476)

It has intentionally been left out. The SQL support in the ABL is limited. But if you really have to, run a .p file  that contains your SQL from a class.

Posted by Brian K. Maher on 26-Aug-2016 06:58

not really.  The “sql” you execute from, for example, the procedure editor is actually the ancient and deprecated “sql-89” stuff.  What are you trying to do that you think you nee sql in an ABL application?

Posted by atuldalvi123 on 26-Aug-2016 07:31

Does select statement supports dynamic where clause in .p program ?

So that I can pass where string as a input to the procedure from class method and count the number of records.

something like

select * from TT where ( cstring)

Posted by Brian K. Maher on 26-Aug-2016 07:44

You really don’t want to be using SQL in ABL programs.  Understand that this stuff is VERY old, is deprecated (i.e. no fixes) and only supports SQL-89.  Just don’t go there.  Please don’t go there.  You can do dynamic where clauses with dynamic queries (i.e. query-prepare).  Use that instead.

Posted by atuldalvi123 on 26-Aug-2016 07:52

Yes, i am using dynamic queries too but the SELECT statement is giving result much faster than the dynamic queries. So we are planning to use the SELECT statement.

Posted by ChUIMonster on 26-Aug-2016 07:54

Do NOT use SQL inside the 4gl.  That is the road to hell.

If you think it is faster you are almost certainly doing something very wrong with your 4gl code.  Post some examples of comparative code and I'm sure we can help you find a better way.

Posted by Mike Fechner on 26-Aug-2016 07:56

Dynamic queries and SELECT in the ABL follow the same query execution strategies.
 
You should double check that your dynamic queries make good use of indexes.

Posted by Brian K. Maher on 26-Aug-2016 07:58

Well, if you insist then all I can say is eventually you will say to yourself ... “Self.  Bummer.  It hurts to be me”.

This thread is closed