5

In most sql databases I have seen you can do something like:

SELECT ABS(-2.4) 

and I get back 2.4. Notice there is no FROM clause.

When I try to do this in OpenEdge via Squirrel and the JDBC driver I get a syntax error. Is there a way to run SELECT statements like this (sans FROM clause) via JDBC?

Mike Cheel
  • 12,626
  • 10
  • 72
  • 101

1 Answers1

6

Single row/column Dual equivalent; SYSPROGRESS.SYSCALCTABLE

Alex K.
  • 171,639
  • 30
  • 264
  • 288
  • Can you explain your answer a bit more please? I think what you are saying is to add this to the FROM clause, which I know works. Is there a way to NOT include the FROM? If not is there a particular reason as to why you must include this table? I notice you cannot even do something like SELECT 2 + 2. – Mike Cheel Jan 28 '14 at 19:27
  • Its simply because the semantics of the engine's SQL dialect require that a FROM clause be specified with a SELECT, so that's what you must do. Related for Oracle; http://stackoverflow.com/questions/73751/what-is-the-dual-table-in-oracle – Alex K. Jan 28 '14 at 20:58
  • I haven't worked much with Oracle so interesting to know. Incidentally, I notice if I SELECT 2+2 FROM AnotherTable (existing table) it will output for each existing row. – Mike Cheel Jan 28 '14 at 21:05
  • Aye, that behaviour will be constant across all databases – Alex K. Jan 29 '14 at 11:02
  • I didn't know if it differed until I tried it. I didn't even consider that some databases required a table. To me it seems a bit inflexible. – Mike Cheel Jan 29 '14 at 14:33